Project

General

Profile

« Previous | Next » 

Revision a280e7e3

Added by Leszek Koltunski about 1 year ago

ask for reviews more
bump to 1.13.3

View differences:

build.gradle
15 15
        applicationId "org.distorted.magic"
16 16
        minSdkVersion 21
17 17
        targetSdkVersion 34
18
        versionCode 84
19
        versionName "1.13.2"
18
        versionCode 85
19
        versionName "1.13.3"
20 20
    }
21 21

  
22 22
    buildTypes {
src/main/java/org/distorted/main/RubikObjectLibInterface.java
60 60
  private int mIsNewRecord;
61 61
  private int mNewRecord;
62 62
  private int mLastCubitColor, mLastCubit, mLastCubitFace;
63
  private boolean mReviewAsked;
64
  private int mNumRotations, mNumScrambles;
63 65

  
64 66
///////////////////////////////////////////////////////////////////////////////////////////////////
65 67

  
......
67 69
    {
68 70
    mAct = new WeakReference<>(act);
69 71
    mLastCubitColor = -1;
72
    mReviewAsked = false;
73
    mNumRotations = 0;
74
    mNumScrambles = 0;
70 75
    }
71 76

  
72 77
///////////////////////////////////////////////////////////////////////////////////////////////////
......
151 156

  
152 157
  private void requestReview(RubikActivity act)
153 158
    {
154
    final RubikScores scores = RubikScores.getInstance();
155
    int numWins = scores.incrementNumWins();
156
    int numRuns = scores.getNumRuns();
159
    android.util.Log.e("D", "ASKING FOR REVIEW");
157 160

  
158
    if( numRuns==3 || numRuns==6 || numWins==7 || numWins==30 || numWins==50 || numWins==80 || numWins==100)
159
      {
160
      final long timeBegin = System.currentTimeMillis();
161
      final ReviewManager manager = ReviewManagerFactory.create(act);
162
      Task<ReviewInfo> request = manager.requestReviewFlow();
161
    mReviewAsked = true;
162
    final String name = RubikScores.getInstance().getName();
163
    final long timeBegin = System.currentTimeMillis();
164
    final ReviewManager manager = ReviewManagerFactory.create(act);
165
    Task<ReviewInfo> request = manager.requestReviewFlow();
163 166

  
164
      request.addOnCompleteListener(new OnCompleteListener<ReviewInfo>()
167
    request.addOnCompleteListener(new OnCompleteListener<ReviewInfo>()
168
      {
169
      @Override
170
      public void onComplete (@NonNull Task<ReviewInfo> task)
165 171
        {
166
        @Override
167
        public void onComplete (@NonNull Task<ReviewInfo> task)
172
        if (task.isSuccessful())
168 173
          {
169
          if (task.isSuccessful())
170
            {
171
            final String name = scores.getName();
172
            ReviewInfo reviewInfo = task.getResult();
173
            Task<Void> flow = manager.launchReviewFlow(act, reviewInfo);
174
          ReviewInfo reviewInfo = task.getResult();
175
          Task<Void> flow = manager.launchReviewFlow(act, reviewInfo);
174 176

  
175
            flow.addOnFailureListener(new OnFailureListener()
176
              {
177
              @Override
178
              public void onFailure(Exception e)
179
                {
180
                analyticsReport(act,"Failed", name, timeBegin);
181
                }
182
              });
183

  
184
            flow.addOnCompleteListener(new OnCompleteListener<Void>()
177
          flow.addOnFailureListener(new OnFailureListener()
178
            {
179
            @Override
180
            public void onFailure(Exception e)
185 181
              {
186
              @Override
187
              public void onComplete(@NonNull Task<Void> task)
188
                {
189
                analyticsReport(act,"Complete", name, timeBegin);
190
                }
191
              });
192
            }
193
          else
182
              analyticsReport(act,"Failed", name, timeBegin);
183
              }
184
            });
185

  
186
          flow.addOnCompleteListener(new OnCompleteListener<Void>()
194 187
            {
195
            String name = scores.getName();
196
            analyticsReport(act,"Not Successful", name, timeBegin);
197
            }
188
            @Override
189
            public void onComplete(@NonNull Task<Void> task)
190
              {
191
              analyticsReport(act,"Complete", name, timeBegin);
192
              }
193
            });
198 194
          }
199
        });
200
      }
195
        else analyticsReport(act,"Not Successful", name, timeBegin);
196
        }
197
      });
201 198
    }
202 199

  
203 200
///////////////////////////////////////////////////////////////////////////////////////////////////
......
222 219
          }
223 220
        });
224 221
      }
222
    else
223
      {
224
      mNumScrambles++;
225

  
226
      if( mNumScrambles==10 && !mReviewAsked )
227
        {
228
        RubikActivity act = mAct.get();
229
        requestReview(act);
230
        }
231
      }
225 232
    }
226 233

  
227 234
///////////////////////////////////////////////////////////////////////////////////////////////////
228 235

  
229 236
  public void onFinishRotation(int axis, int row, int angle)
230 237
    {
238
    mNumRotations++;
239

  
231 240
    if( ScreenList.getCurrentScreen()== ScreenList.SOLV )
232 241
      {
233 242
      RubikScreenSolving solv = (RubikScreenSolving) ScreenList.SOLV.getScreenClass();
......
238 247
      RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
239 248
      play.addMove(mAct.get(), axis, row, angle);
240 249
      }
250

  
251
    if( mNumRotations==40 && !mReviewAsked )
252
      {
253
      RubikActivity act = mAct.get();
254
      requestReview(act);
255
      }
241 256
    }
242 257

  
243 258
///////////////////////////////////////////////////////////////////////////////////////////////////
......
455 470
      {
456 471
      RubikActivity act = mAct.get();
457 472
      reportRecord(act,startTime,endTime,debug,scrambleNum);
458
      requestReview(act);
473

  
474
      RubikScores scores = RubikScores.getInstance();
475
      int numWins = scores.incrementNumWins();
476
      int numRuns = scores.getNumRuns();
477

  
478
      if( numRuns==3 || numRuns==6 || numWins==4 || numWins==20 || numWins==50 || numWins==80 || numWins==100)
479
        {
480
        requestReview(act);
481
        }
459 482

  
460 483
      switch(mIsNewRecord)
461 484
        {
......
463 486
                                {
464 487
                                RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
465 488
                                int level = play.getLevel();
466
                                RubikScores scores = RubikScores.getInstance();
467 489
                                int newStars = scores.computeNumStars(level);
468 490
                                int totStars = scores.getNumStars();
469 491
                                scores.changeNumStars(newStars);

Also available in: Unified diff