Project

General

Profile

« Previous | Next » 

Revision 7ac0ee88

Added by Leszek Koltunski about 3 years ago

Simplify ObjectList: now there's just one object per size.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java
82 82
          {
83 83
          RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
84 84
          int object = play.getObject();
85
          int size   = play.getSize();
86
          int sizeIndex = ObjectList.getSizeIndex(object,size);
87 85

  
88
          bundle.putInt("tab", ObjectList.pack(object,sizeIndex) );
86
          bundle.putInt("tab", object );
89 87
          bundle.putBoolean("submitting", true);
90 88

  
91 89
          RubikDialogScores scoresDiag = new RubikDialogScores();
src/main/java/org/distorted/dialogs/RubikDialogPattern.java
105 105
    for(int i=0; i< RubikPatternList.NUM_OBJECTS; i++)
106 106
      {
107 107
      ObjectList list = RubikPatternList.getObject(i);
108
      int size        = RubikPatternList.getSize(i);
109
      int sizeIndex   = ObjectList.getSizeIndex(list.ordinal(),size);
110 108
      int iconSize    = RubikActivity.getDrawableSize();
111
      int iconID      = list.getIconIDs(iconSize)[sizeIndex];
109
      int iconID      = list.getIconID(iconSize);
112 110

  
113 111
      ImageView imageView = new ImageView(act);
114 112
      imageView.setImageResource(iconID);
src/main/java/org/distorted/dialogs/RubikDialogPatternView.java
95 95
        RubikPattern pattern = RubikPattern.getInstance();
96 96
        int[][] moves   = pattern.reInitialize(mTab, groupPosition, childPosition);
97 97
        ObjectList list = RubikPatternList.getObject(mTab);
98
        int size        = RubikPatternList.getSize(mTab);
99 98

  
100
        ract.setupObject(list, size, moves);
99
        ract.setupObject(list, moves);
101 100

  
102 101
        ScreenList.switchScreen(ract, ScreenList.PATT);
103 102
        RubikScreenPattern state = (RubikScreenPattern) ScreenList.PATT.getScreenClass();
src/main/java/org/distorted/dialogs/RubikDialogScores.java
105 105

  
106 106
    viewPager.setCurrentItem(curTab);
107 107
    ObjectList list;
108
    int iconSize = RubikActivity.getDrawableSize();
108 109

  
109 110
    for (int object = 0; object< ObjectList.NUM_OBJECTS; object++)
110 111
      {
111 112
      list = ObjectList.getObject(object);
112
      int iconSize = RubikActivity.getDrawableSize();
113
      int[] iconID = list.getIconIDs(iconSize);
114
      int len = list.getSizes().length;
115

  
116
      for(int size=0; size<len; size++)
117
        {
118
        int t = ObjectList.pack(object,size);
119
        ImageView imageView = new ImageView(act);
120
        imageView.setImageResource(iconID[size]);
121
        TabLayout.Tab tab = tabLayout.getTabAt(t);
122
        if(tab!=null) tab.setCustomView(imageView);
123
        }
113
      int iconID = list.getIconID(iconSize);
114
      ImageView imageView = new ImageView(act);
115
      imageView.setImageResource(iconID);
116
      TabLayout.Tab tab = tabLayout.getTabAt(object);
117
      if(tab!=null) tab.setCustomView(imageView);
124 118
      }
125 119

  
126 120
    Dialog dialog = builder.create();
src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java
117 117

  
118 118
    for(int i=0; i<mNumTabs; i++)
119 119
      {
120
      int object   = ObjectList.unpackObject(i);
121
      int sizeIndex= ObjectList.unpackSizeIndex(i);
122
      lastTab[i]   = ObjectList.getDBLevel(object, sizeIndex);
123
      maxTab[i]    = Math.min(lastTab[i],MAX);
124
      toDoTab[i]   = 0;
120
      lastTab[i]= ObjectList.getDBLevel(i);
121
      maxTab[i] = Math.min(lastTab[i],MAX);
122
      toDoTab[i]= 0;
125 123

  
126 124
      toDo += maxTab[i];
127 125
      }
......
210 208
    {
211 209
    mAct = act;
212 210
    mDialog = diag;
213
    mNumTabs = ObjectList.getTotal();
211
    mNumTabs = ObjectList.NUM_OBJECTS;
214 212
    mViews = new RubikDialogScoresView[mNumTabs];
215 213
    mViewPager = viewPager;
216 214
    mIsSubmitting = isSubmitting;
src/main/java/org/distorted/dialogs/RubikDialogScoresView.java
88 88

  
89 89
    Resources res = act.getResources();
90 90
    String packageName = act.getPackageName();
91

  
92
    int object   = ObjectList.unpackObject(tab);
93
    int sizeIndex= ObjectList.unpackSizeIndex(tab);
94 91
    RubikScores scores = RubikScores.getInstance();
95 92

  
96 93
    boolean inserted = false;
97
    long myRecordInMillis = scores.getRecord(object, sizeIndex, level);
94
    long myRecordInMillis = scores.getRecord(tab, level);
98 95
    float myRecordInSeconds = (myRecordInMillis/10)/100.0f;
99 96
    String myName = scores.getName();
100 97
    if( myName.length()==0 ) myName = act.getString(R.string.you);
src/main/java/org/distorted/dialogs/RubikDialogSetName.java
149 149
          RubikScores.getInstance().setName(name);
150 150
          RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
151 151

  
152
          int object = play.getObject();
153
          int size   = play.getSize();
154
          int sizeIndex = ObjectList.getSizeIndex(object,size);
155

  
156 152
          Bundle bundle = new Bundle();
157
          bundle.putInt("tab", ObjectList.pack(object,sizeIndex) );
153
          bundle.putInt("tab", play.getObject() );
158 154
          bundle.putBoolean("submitting", true);
159 155

  
160 156
          RubikDialogScores scores = new RubikDialogScores();
src/main/java/org/distorted/dialogs/RubikDialogTutorialView.java
77 77

  
78 78
    TutorialList list  = TutorialList.getObject(position);
79 79
    ObjectList objList = list.getObjectList();
80
    int size           = list.getSize();
81 80

  
82 81
    View tab = inflate( act, R.layout.dialog_tutorial_tab, null);
83 82
    LinearLayout layout = tab.findViewById(R.id.tabLayout);
......
93 92

  
94 93
      int countryID = res.getIdentifier( coun, "drawable", packageName);
95 94

  
96
      View row = createRow(ract,countryID,desc,url,auth,widthT,objList,size);
95
      View row = createRow(ract,countryID,desc,url,auth,widthT,objList);
97 96
      layout.addView(row);
98 97
      }
99 98

  
......
110 109
///////////////////////////////////////////////////////////////////////////////////////////////////
111 110

  
112 111
  private View createRow(final RubikActivity act, int countryID, final String desc, final String url,
113
                         final String auth, int width, final ObjectList obj, final int size)
112
                         final String auth, int width, final ObjectList obj)
114 113
    {
115 114
    View row = inflate( act, R.layout.dialog_tutorial_row, null);
116 115
    Button butt = row.findViewById(R.id.tutorialButton);
......
126 125
        {
127 126
        if( mCanClick )
128 127
          {
129
          act.switchTutorial(url,obj,size);
130
          analyticsReport(act,desc,auth,obj,size);
128
          act.switchTutorial(url,obj);
129
          analyticsReport(act,desc,auth,obj);
131 130
          clickPossible(false);
132 131
          }
133 132
        }
......
150 149

  
151 150
///////////////////////////////////////////////////////////////////////////////////////////////////
152 151

  
153
  private void analyticsReport(RubikActivity act, String desc, String author, ObjectList obj, int size)
152
  private void analyticsReport(RubikActivity act, String desc, String author, ObjectList obj)
154 153
    {
155 154
    String message = desc+" ("+author+")";
156 155

  
......
161 160
    else
162 161
      {
163 162
      FirebaseAnalytics analytics = act.getAnalytics();
164
      String name = obj.name()+"_"+size;
165 163

  
166 164
      if( analytics!=null )
167 165
        {
168 166
        Bundle bundle = new Bundle();
169 167
        bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, message);
170
        bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
168
        bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, obj.name());
171 169
        analytics.logEvent(FirebaseAnalytics.Event.TUTORIAL_BEGIN, bundle);
172 170
        }
173 171
      }
src/main/java/org/distorted/main/RubikActivity.java
276 276
      boolean success = false;
277 277
      RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
278 278
      int object = play.getObject();
279
      int size   = play.getSize();
280 279

  
281 280
      if( object>=0 && object< ObjectList.NUM_OBJECTS )
282 281
        {
283
        ObjectList obj = ObjectList.getObject(object);
284
        int[] sizes = obj.getSizes();
285
        int sizeIndex = ObjectList.getSizeIndex(object,size);
286

  
287
        if( sizeIndex>=0 && sizeIndex<sizes.length )
288
          {
289
          success = true;
290
          view.getPreRender().changeObject(obj,size);
291
          }
282
        success = true;
283
        ObjectList nextObj = ObjectList.values()[object];
284
        view.getPreRender().changeObject(nextObj);
292 285
        }
293 286

  
294 287
      if( !success )
295 288
        {
296 289
        ObjectList obj = ObjectList.getObject(RubikScreenPlay.DEF_OBJECT);
297
        int s = RubikScreenPlay.DEF_SIZE;
298

  
299
        play.setObjectAndSize(this,obj,s);
300
        view.getPreRender().changeObject(obj,s);
290
        play.setObject(this,obj);
291
        view.getPreRender().changeObject(obj);
301 292
        }
302 293

  
303 294
      if( mIsChinese && !mPolicyAccepted ) PrivacyPolicy();
......
466 457

  
467 458
///////////////////////////////////////////////////////////////////////////////////////////////////
468 459

  
469
    public void changeObject(ObjectList newObject, int newSize, boolean reportChange)
460
    public void changeObject(ObjectList newObject, boolean reportChange)
470 461
      {
471 462
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
472 463
      RubikPreRender pre = view.getPreRender();
......
478 469
        if( oldObject!=null )
479 470
          {
480 471
          ObjectList oldList = oldObject.getObjectList();
481
          int oldNum = oldObject.getNumLayers();
482 472
          float fps = view.getRenderer().getFPS();
483 473
          fps = (int)(fps+0.5f);
484 474
          StringBuilder name = new StringBuilder();
485 475
          name.append(oldList.name());
486
          name.append('_');
487
          name.append(oldNum);
488 476
          name.append(' ');
489 477
          name.append(fps);
490 478
          name.append(" --> ");
491 479
          name.append(newObject.name());
492
          name.append('_');
493
          name.append(newSize);
494 480

  
495 481
          if( BuildConfig.DEBUG )
496 482
            {
......
510 496
          }
511 497
        }
512 498

  
513
      pre.changeObject(newObject,newSize);
499
      pre.changeObject(newObject);
514 500
      }
515 501

  
516 502
///////////////////////////////////////////////////////////////////////////////////////////////////
517 503

  
518
    public void setupObject(ObjectList object, int size, int[][] moves)
504
    public void setupObject(ObjectList object, int[][] moves)
519 505
      {
520 506
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
521 507
      RubikPreRender pre = view.getPreRender();
522
      pre.setupObject(object,size,moves);
508
      pre.setupObject(object,moves);
523 509
      }
524 510

  
525 511
///////////////////////////////////////////////////////////////////////////////////////////////////
......
642 628

  
643 629
///////////////////////////////////////////////////////////////////////////////////////////////////
644 630

  
645
    public void switchTutorial(String url, ObjectList object, int size)
631
    public void switchTutorial(String url, ObjectList object)
646 632
      {
647 633
      Intent myIntent = new Intent(this, TutorialActivity.class);
648 634
      myIntent.putExtra("url", url);
649 635
      myIntent.putExtra("obj", object.ordinal());
650
      myIntent.putExtra("siz", size);
651 636
      startActivity(myIntent);
652 637
      }
653 638
}
src/main/java/org/distorted/main/RubikPreRender.java
61 61
  private boolean mUIBlocked, mTouchBlocked;
62 62
  private boolean mIsSolved;
63 63
  private ObjectList mNextObject;
64
  private int mNextSize;
65 64
  private long mRotationFinishedID;
66 65
  private final long[] mEffectID;
67 66
  private boolean mIsNewRecord;
......
115 114

  
116 115
///////////////////////////////////////////////////////////////////////////////////////////////////
117 116

  
118
  private void createObjectNow(ObjectList object, int size, int[][] moves)
117
  private void createObjectNow(ObjectList object, int[][] moves)
119 118
    {
120 119
    boolean firstTime = (mNewObject==null);
121 120

  
......
125 124
    Context con = mView.getContext();
126 125
    Resources res = con.getResources();
127 126

  
128
    mNewObject = object.create(size, mView.getQuat(), moves, res, mScreenWidth);
127
    mNewObject = object.create(mView.getQuat(), moves, res, mScreenWidth);
129 128

  
130 129
    if( mNewObject!=null )
131 130
      {
......
248 247
    {
249 248
    mChangeObject = false;
250 249

  
251
    if ( mNewObject==null || mNewObject.getObjectList()!=mNextObject || mNewObject.getNumLayers()!=mNextSize)
250
    if ( mNewObject==null || mNewObject.getObjectList()!=mNextObject )
252 251
      {
253 252
      blockEverything(BlockController.RUBIK_PLACE_1);
254
      createObjectNow(mNextObject, mNextSize, null);
253
      createObjectNow(mNextObject, null);
255 254
      doEffectNow( BaseEffect.Type.SIZECHANGE );
256 255
      }
257 256
    }
......
262 261
    {
263 262
    mSetupObject = false;
264 263

  
265
    if ( mNewObject==null || mNewObject.getObjectList()!=mNextObject || mNewObject.getNumLayers()!=mNextSize)
264
    if ( mNewObject==null || mNewObject.getObjectList()!=mNextObject)
266 265
      {
267 266
      blockEverything(BlockController.RUBIK_PLACE_2);
268
      createObjectNow(mNextObject, mNextSize, mNextMoves);
267
      createObjectNow(mNextObject, mNextMoves);
269 268
      doEffectNow( BaseEffect.Type.SIZECHANGE );
270 269
      }
271 270
    else
......
344 343
    RubikScores scores = RubikScores.getInstance();
345 344

  
346 345
    int object      = play.getObject();
347
    int size        = play.getSize();
348 346
    int level       = play.getLevel();
349 347
    ObjectList list = ObjectList.getObject(object);
350 348
    String name     = scores.getName();
351 349

  
352
    String record = list.name()+"_"+size+" level "+level+" time "+mNewRecord+" isNew: "+mIsNewRecord+" scrambleNum: "+mScrambleObjectNum;
350
    String record = list.name()+" level "+level+" time "+mNewRecord+" isNew: "+mIsNewRecord+" scrambleNum: "+mScrambleObjectNum;
353 351

  
354 352
    if( BuildConfig.DEBUG )
355 353
       {
......
499 497

  
500 498
///////////////////////////////////////////////////////////////////////////////////////////////////
501 499

  
502
  void changeObject(ObjectList object, int size)
500
  void changeObject(ObjectList object)
503 501
    {
504
    if( size>0 )
505
      {
506
      mChangeObject = true;
507
      mNextObject = object;
508
      mNextSize   = size;
509
      }
502
    mChangeObject = true;
503
    mNextObject = object;
510 504
    }
511 505

  
512 506
///////////////////////////////////////////////////////////////////////////////////////////////////
513 507

  
514
  void setupObject(ObjectList object, int size, int[][] moves)
508
  void setupObject(ObjectList object, int[][] moves)
515 509
    {
516
    if( size>0 )
517
      {
518
      mSetupObject= true;
519
      mNextObject = object;
520
      mNextSize   = size;
521
      mNextMoves  = moves;
522
      }
510
    mSetupObject= true;
511
    mNextObject = object;
512
    mNextMoves  = moves;
523 513
    }
524 514

  
525 515
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/main/RubikSurfaceView.java
257 257
              int color = solver.getCurrentColor();
258 258
              mLastCubit = object.getCubit(point);
259 259
              mPreRender.setTextureMap( mLastCubit, mLastCubitFace, color );
260
              mLastCubitColor = SolverMain.cubitIsLocked(object.getObjectList(), object.getNumLayers(), mLastCubit);
260
              mLastCubitColor = SolverMain.cubitIsLocked(object.getObjectList(), mLastCubit);
261 261
              }
262 262
            }
263 263
          }
src/main/java/org/distorted/network/RubikNetwork.java
37 37
import org.distorted.objectlib.main.ObjectList;
38 38

  
39 39
import static org.distorted.objectlib.main.ObjectList.MAX_LEVEL;
40
import static org.distorted.objectlib.main.ObjectList.NUM_OBJECTS;
40 41

  
41 42
///////////////////////////////////////////////////////////////////////////////////////////////////
42 43

  
......
96 97
    "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff"
97 98
    };
98 99

  
99
  private static int mTotal = 0;
100 100
  private static String[][][] mCountry;
101 101
  private static String[][][] mName;
102 102
  private static float[][][] mTime;
......
113 113

  
114 114
  private static void initializeStatics()
115 115
    {
116
    if( mTotal==0      ) mTotal   = ObjectList.getTotal();
117
    if( mCountry==null ) mCountry = new String[mTotal][MAX_LEVEL][MAX_PLACES];
118
    if( mName==null    ) mName    = new String[mTotal][MAX_LEVEL][MAX_PLACES];
119
    if( mTime==null    ) mTime    = new  float[mTotal][MAX_LEVEL][MAX_PLACES];
120
    if( mPlaces==null  ) mPlaces  = new int[mTotal][MAX_LEVEL];
116
    if( mCountry==null ) mCountry = new String[NUM_OBJECTS][MAX_LEVEL][MAX_PLACES];
117
    if( mName==null    ) mName    = new String[NUM_OBJECTS][MAX_LEVEL][MAX_PLACES];
118
    if( mTime==null    ) mTime    = new  float[NUM_OBJECTS][MAX_LEVEL][MAX_PLACES];
119
    if( mPlaces==null  ) mPlaces  = new int[NUM_OBJECTS][MAX_LEVEL];
121 120
    }
122 121

  
123 122
///////////////////////////////////////////////////////////////////////////////////////////////////
......
166 165
      return false;
167 166
      }
168 167

  
169
    for(int i=0; i<mTotal; i++)
168
    for(int i=0; i<NUM_OBJECTS; i++)
170 169
      for(int j=0; j<MAX_LEVEL; j++)
171 170
        {
172 171
        mPlaces[i][j] = 0;
......
205 204

  
206 205
    if( s5>s4 && s4>s3 && s3>s2 && s2>s1 && s1>0 )
207 206
      {
208
      int object = ObjectList.unpackObjectFromString( row.substring(0,s1) );
207
      int object = ObjectList.getOrdinal( row.substring(0,s1) );
209 208

  
210
      if( object>=0 && object<mTotal )
209
      if( object>=0 && object<NUM_OBJECTS )
211 210
        {
212 211
        int level      = Integer.parseInt( row.substring(s1+1,s2) );
213 212
        String name    = row.substring(s2+1, s3);
src/main/java/org/distorted/network/RubikScores.java
27 27

  
28 28
import com.google.firebase.crashlytics.FirebaseCrashlytics;
29 29

  
30
import static org.distorted.objectlib.main.ObjectList.MAX_NUM_OBJECTS;
31 30
import static org.distorted.objectlib.main.ObjectList.NUM_OBJECTS;
32 31
import static org.distorted.objectlib.main.ObjectList.MAX_LEVEL;
33 32

  
......
43 42
  public static final long NO_RECORD = Long.MAX_VALUE;
44 43
  private static RubikScores mThis;
45 44

  
46
  private final long[][][] mRecords;
47
  private final int [][][] mSubmitted;
45
  private final long[][] mRecords;
46
  private final int [][] mSubmitted;
48 47

  
49 48
  private String mName, mCountry;
50 49
  private boolean mNameIsVerified;
......
57 56

  
58 57
  private RubikScores()
59 58
    {
60
    mRecords   = new long[NUM_OBJECTS][MAX_NUM_OBJECTS][MAX_LEVEL];
61
    mSubmitted = new int [NUM_OBJECTS][MAX_NUM_OBJECTS][MAX_LEVEL];
59
    mRecords   = new long[NUM_OBJECTS][MAX_LEVEL];
60
    mSubmitted = new int [NUM_OBJECTS][MAX_LEVEL];
62 61

  
63 62
    for(int i=0; i<NUM_OBJECTS; i++)
64
      for(int j=0; j<MAX_NUM_OBJECTS; j++)
65
        for(int k=0; k<MAX_LEVEL; k++)
66
          {
67
          mRecords[i][j][k]   = NO_RECORD;
68
          mSubmitted[i][j][k] = 0;
69
          }
63
      for(int j=0; j<MAX_LEVEL; j++)
64
        {
65
        mRecords[i][j]   = NO_RECORD;
66
        mSubmitted[i][j] = 0;
67
        }
70 68

  
71 69
    mName = "";
72 70
    mCountry = "un";
......
106 104
    mNameIsVerified = true;
107 105

  
108 106
    for(int i=0; i<NUM_OBJECTS; i++)
109
      for(int j=0; j<MAX_NUM_OBJECTS; j++)
110
        for(int k=0; k<MAX_LEVEL; k++)
111
          {
112
          mSubmitted[i][j][k]=1;
113
          }
107
      for(int j=0; j<MAX_LEVEL; j++)
108
        {
109
        mSubmitted[i][j]=1;
110
        }
114 111
    }
115 112

  
116 113
///////////////////////////////////////////////////////////////////////////////////////////////////
......
124 121

  
125 122
  synchronized boolean thereAreUnsubmittedRecords()
126 123
    {
127
    ObjectList list;
128
    int length;
129

  
130 124
    for(int object=0; object<NUM_OBJECTS; object++)
131 125
      {
132
      list = ObjectList.getObject(object);
133
      length = list.getSizes().length;
134

  
135
      for(int size=0; size<length; size++)
136
        for(int level=0; level<MAX_LEVEL; level++)
137
          {
138
          if( mSubmitted[object][size][level]==0 && mRecords[object][size][level]<NO_RECORD )
139
            {
140
            return true;
141
            }
142
          }
126
      for(int level=0; level<MAX_LEVEL; level++)
127
        {
128
        if( mSubmitted[object][level]==0 && mRecords[object][level]<NO_RECORD ) return true;
129
        }
143 130
      }
144 131

  
145 132
    return false;
......
149 136

  
150 137
  synchronized String getRecordList(String strObj, String strLvl, String strTim)
151 138
    {
152
    ObjectList list;
153 139
    StringBuilder builderObj = new StringBuilder();
154 140
    StringBuilder builderLvl = new StringBuilder();
155 141
    StringBuilder builderTim = new StringBuilder();
156 142
    boolean first = true;
157
    int[] sizes;
158
    int length;
159 143

  
160 144
    for(int object=0; object<NUM_OBJECTS; object++)
161 145
      {
162
      list = ObjectList.getObject(object);
163
      sizes = list.getSizes();
164
      length = sizes.length;
146
      String name = ObjectList.getObject(object).name();
165 147

  
166
      for(int size=0; size<length; size++)
148
      for(int level=0; level<MAX_LEVEL; level++)
167 149
        {
168
        for(int level=0; level<MAX_LEVEL; level++)
150
        if( mSubmitted[object][level]==0 && mRecords[object][level]<NO_RECORD )
169 151
          {
170
          if( mSubmitted[object][size][level]==0 && mRecords[object][size][level]<NO_RECORD )
152
          if( !first )
171 153
            {
172
            if( !first )
173
              {
174
              builderObj.append(',');
175
              builderLvl.append(',');
176
              builderTim.append(',');
177
              }
178
            else
179
              {
180
              first=false;
181
              }
182

  
183
            builderObj.append(list.name());
184
            builderObj.append("_");
185
            builderObj.append(sizes[size]);
186
            builderLvl.append(level);
187
            builderTim.append(mRecords[object][size][level]);
154
            builderObj.append(',');
155
            builderLvl.append(',');
156
            builderTim.append(',');
157
            }
158
          else
159
            {
160
            first=false;
188 161
            }
162

  
163
          builderObj.append(name);
164
          builderLvl.append(level);
165
          builderTim.append(mRecords[object][level]);
189 166
          }
190 167
        }
191 168
      }
......
197 174
// Public API
198 175
///////////////////////////////////////////////////////////////////////////////////////////////////
199 176

  
200
  public synchronized long getRecord(int object, int size, int level)
177
  public synchronized long getRecord(int obj, int level)
201 178
    {
202
    int maxsize = ObjectList.getObject(object).getSizes().length;
203

  
204
    if( object>=0 && object<NUM_OBJECTS && size>=0 && size<maxsize && level>=0 && level<MAX_LEVEL )
205
      {
206
      return mRecords[object][size][level];
207
      }
208

  
209
    return -1;
179
    return (obj>=0 && obj<NUM_OBJECTS && level>=0 && level<MAX_LEVEL) ? mRecords[obj][level] : -1;
210 180
    }
211 181

  
212 182
///////////////////////////////////////////////////////////////////////////////////////////////////
213 183

  
214
  public synchronized boolean isSubmitted(int object, int size, int level)
184
  public synchronized boolean isSubmitted(int obj, int level)
215 185
    {
216
    int maxsize = ObjectList.getObject(object).getSizes().length;
217

  
218
    if( object>=0 && object<NUM_OBJECTS && size>=0 && size<maxsize && level>=0 && level<MAX_LEVEL )
219
      {
220
      return mSubmitted[object][size][level]==1;
221
      }
222

  
223
    return false;
186
    return obj>=0 && obj<NUM_OBJECTS && level>=0 && level<MAX_LEVEL && mSubmitted[obj][level]==1;
224 187
    }
225 188

  
226 189
///////////////////////////////////////////////////////////////////////////////////////////////////
......
289 252

  
290 253
///////////////////////////////////////////////////////////////////////////////////////////////////
291 254

  
292
  public synchronized boolean isSolved(int object, int size, int level)
255
  public synchronized boolean isSolved(int obj, int level)
293 256
    {
294
    int maxsize = ObjectList.getObject(object).getSizes().length;
295

  
296
    if( object>=0 && object<NUM_OBJECTS && size>=0 && size<maxsize && level>=0 && level<MAX_LEVEL )
297
      {
298
      return mRecords[object][size][level]<NO_RECORD;
299
      }
300

  
301
    return false;
257
    return obj>=0 && obj<NUM_OBJECTS && level>=0 && level<MAX_LEVEL && mRecords[obj][level]<NO_RECORD;
302 258
    }
303 259

  
304 260
///////////////////////////////////////////////////////////////////////////////////////////////////
......
350 306
  public synchronized void savePreferences(SharedPreferences.Editor editor)
351 307
    {
352 308
    StringBuilder builder = new StringBuilder();
353
    ObjectList list;
354
    int[] sizes;
355
    int length;
309
    String name;
356 310

  
357 311
    for(int level=0; level<MAX_LEVEL; level++)
358 312
      {
......
360 314

  
361 315
      for(int object=0; object<NUM_OBJECTS; object++)
362 316
        {
363
        list = ObjectList.getObject(object);
364
        sizes = list.getSizes();
365
        length = sizes.length;
366

  
367
        for(int size=0; size<length; size++)
368
          {
369
          builder.append(list.name());
370
          builder.append("_");
371
          builder.append(sizes[size]);
372
          builder.append("=");
373
          builder.append(mRecords[object][size][level]);
374
          builder.append(",");
375
          builder.append(mSubmitted[object][size][level]);
376
          builder.append(" ");
377
          }
317
        name = ObjectList.getObject(object).name();
318
        builder.append(name);
319
        builder.append("=");
320
        builder.append(mRecords[object][level]);
321
        builder.append(",");
322
        builder.append(mSubmitted[object][level]);
323
        builder.append(" ");
378 324
        }
379 325

  
380 326
      editor.putString("scores_record"+level, builder.toString());
......
393 339
  public synchronized void restorePreferences(SharedPreferences preferences)
394 340
    {
395 341
    String recordStr, subStr, nameStr, sizeStr, timeStr, submStr, errorStr="";
396
    int start, end, equals, underscore, comma;
397
    int object, sizeIndex, subm;
342
    int start, end, equals, underscore, comma, object, subm;
398 343
    long time;
399 344
    boolean thereWasError = false;
400 345

  
......
427 372

  
428 373
          if( object>=0 && object< NUM_OBJECTS )
429 374
            {
430
            sizeIndex = ObjectList.getSizeIndex(object,Integer.parseInt(sizeStr));
431 375
            time = Long.parseLong(timeStr);
432 376
            subm = Integer.parseInt(submStr);
433 377

  
434
            if( sizeIndex>=0 && sizeIndex<MAX_NUM_OBJECTS && subm>=0 && subm<=1 )
378
            if( subm>=0 && subm<=1 )
435 379
              {
436
              mRecords  [object][sizeIndex][level] = time;
437
              mSubmitted[object][sizeIndex][level] = subm;
380
              mRecords  [object][level] = time;
381
              mSubmitted[object][level] = subm;
438 382
              }
439 383
            else
440 384
              {
441
              errorStr += ("error1: size="+sizeIndex+" subm="+subm+" obj: "+nameStr+" size: "+sizeStr+"\n");
385
              errorStr += ("error1: subm="+subm+" obj: "+nameStr+" size: "+sizeStr+"\n");
442 386
              thereWasError= true;
443 387
              }
444 388
            }
......
482 426

  
483 427
///////////////////////////////////////////////////////////////////////////////////////////////////
484 428

  
485
  public synchronized boolean setRecord(int object, int size, int level, long timeTaken)
429
  public synchronized boolean setRecord(int object, int level, long timeTaken)
486 430
    {
487
    int maxsize = ObjectList.getObject(object).getSizes().length;
488

  
489
    if( object>=0 && object<NUM_OBJECTS && size>=0 && size<maxsize && level>=1 && level<=MAX_LEVEL )
431
    if( object>=0 && object<NUM_OBJECTS && level>=1 && level<=MAX_LEVEL && mRecords[object][level-1]>timeTaken )
490 432
      {
491
      if( mRecords[object][size][level-1]> timeTaken )
492
        {
493
        mRecords  [object][size][level-1] = timeTaken;
494
        mSubmitted[object][size][level-1] = 0;
495
        return true;
496
        }
433
      mRecords  [object][level-1] = timeTaken;
434
      mSubmitted[object][level-1] = 0;
435
      return true;
497 436
      }
498 437

  
499 438
    return false;
src/main/java/org/distorted/patterns/RubikPatternList.java
25 25

  
26 26
public enum RubikPatternList
27 27
  {
28
  CUBE2 (ObjectList.CUBE, 2, PatternCube2.patterns),
29
  CUBE3 (ObjectList.CUBE, 3, PatternCube3.patterns),
30
  CUBE4 (ObjectList.CUBE, 4, PatternCube4.patterns),
31
  CUBE5 (ObjectList.CUBE, 5, PatternCube5.patterns),
32
  PYRA3 (ObjectList.PYRA, 3, PatternPyraminx3.patterns),
33
  PYRA4 (ObjectList.PYRA, 4, PatternPyraminx4.patterns),
34
  PYRA5 (ObjectList.PYRA, 5, PatternPyraminx5.patterns),
35
  MEGA3 (ObjectList.MEGA, 3, PatternMegaminx.patterns),
36
  MEGA5 (ObjectList.MEGA, 5, PatternGigaminx.patterns),
28
  CUBE2 (ObjectList.CUBE_2, PatternCube2.patterns),
29
  CUBE3 (ObjectList.CUBE_3, PatternCube3.patterns),
30
  CUBE4 (ObjectList.CUBE_4, PatternCube4.patterns),
31
  CUBE5 (ObjectList.CUBE_5, PatternCube5.patterns),
32
  PYRA3 (ObjectList.PYRA_3, PatternPyraminx3.patterns),
33
  PYRA4 (ObjectList.PYRA_4, PatternPyraminx4.patterns),
34
  PYRA5 (ObjectList.PYRA_5, PatternPyraminx5.patterns),
35
  MEGA3 (ObjectList.MEGA_3, PatternMegaminx.patterns),
36
  MEGA5 (ObjectList.MEGA_5, PatternGigaminx.patterns),
37 37
  ;
38 38

  
39 39
  public static final int NUM_OBJECTS = values().length;
40 40
  private final ObjectList mObject;
41
  private final int mSize;
42 41
  private final String[][] mPatterns;
43 42

  
44 43
  private static final RubikPatternList[] objects;
......
63 62

  
64 63
///////////////////////////////////////////////////////////////////////////////////////////////////
65 64

  
66
  RubikPatternList(ObjectList object, int size, String[][] patterns)
65
  RubikPatternList(ObjectList object, String[][] patterns)
67 66
    {
68 67
    mObject   = object;
69
    mSize     = size;
70 68
    mPatterns = patterns;
71 69
    }
72 70

  
......
74 72
// PUBLIC API
75 73
///////////////////////////////////////////////////////////////////////////////////////////////////
76 74

  
77
  public static int getOrdinal(int objectOrdinal, int size)
75
  public static int getOrdinal(int object)
78 76
    {
79 77
    for(int i=0; i<NUM_OBJECTS; i++)
80 78
      {
81
      if( objects[i].mObject.ordinal() == objectOrdinal && objects[i].mSize == size )
79
      if( objects[i].mObject.ordinal() == object )
82 80
        {
83 81
        return i;
84 82
        }
......
93 91
    {
94 92
    return objects[ordinal].mObject;
95 93
    }
96

  
97
///////////////////////////////////////////////////////////////////////////////////////////////////
98

  
99
  public static int getSize(int ordinal)
100
    {
101
    return objects[ordinal].mSize;
102
    }
103 94
  }
src/main/java/org/distorted/screens/RubikScreenAbstract.java
35 35
    {
36 36
    RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
37 37
    int obj  = play.getObject();
38
    int size = play.getSize();
39
    int ret = RubikPatternList.getOrdinal(obj,size);
38
    int ret = RubikPatternList.getOrdinal(obj);
40 39

  
41 40
    if( ret<0 )
42 41
      {
43
      ret = ObjectList.getSizeIndex(RubikScreenPlay.DEF_OBJECT, RubikScreenPlay.DEF_SIZE);
42
      ret = RubikPatternList.getOrdinal(RubikScreenPlay.DEF_OBJECT);
44 43
      }
45 44

  
46 45
    return ret;
......
52 51
    {
53 52
    RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
54 53
    int obj  = play.getObject();
55
    int size = play.getSize();
56 54

  
57
    int ret = TutorialList.getOrdinal(obj,size);
55
    int ret = TutorialList.getOrdinal(obj);
58 56

  
59 57
    if( ret<0 )
60 58
      {
61
      ret = ObjectList.getSizeIndex(RubikScreenPlay.DEF_OBJECT, RubikScreenPlay.DEF_SIZE);
59
      ret = TutorialList.getOrdinal(RubikScreenPlay.DEF_OBJECT);
62 60
      }
63 61

  
64 62
    return ret;
src/main/java/org/distorted/screens/RubikScreenPattern.java
63 63
  void leaveScreen(RubikActivity act)
64 64
    {
65 65
    RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
66

  
67 66
    ObjectList object = RubikPatternList.getObject(mPatternOrdinal);
68
    int size = RubikPatternList.getSize(mPatternOrdinal);
69 67

  
70
    if( !play.setObjectAndSize(act,object,size) )
68
    if( !play.setObject(act,object) )
71 69
      {
72 70
      int objectPlay= play.getObject();
73
      int sizePlay  = play.getSize();
74 71

  
75
      act.changeObject(ObjectList.getObject(objectPlay),sizePlay, false);
72
      act.changeObject(ObjectList.getObject(objectPlay),false);
76 73
      }
77 74
    }
78 75

  
src/main/java/org/distorted/screens/RubikScreenPlay.java
53 53
public class RubikScreenPlay extends RubikScreenBase
54 54
  {
55 55
  public static final int LEVELS_SHOWN = 10;
56
  public static final int DEF_OBJECT= ObjectList.CUBE.ordinal();
57
  public static final int DEF_SIZE  =  3;
56
  public static final int DEF_OBJECT= ObjectList.CUBE_3.ordinal();
58 57

  
59 58
  private static final int[] BUTTON_LABELS = { R.string.scores,
60 59
                                               R.string.patterns,
......
71 70
  private Button mPlayButton;
72 71
  private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup;
73 72
  private int mObject = DEF_OBJECT;
74
  private int mSize   = DEF_SIZE;
75 73
  private int mObjectSize, mMenuLayoutWidth, mMenuLayoutHeight, mPlayLayoutWidth;
76 74
  private int mLevelValue;
77 75
  private float mButtonSize, mMenuItemSize, mMenuTextSize;
......
79 77
  private LinearLayout mPlayLayout;
80 78
  private int mUpperBarHeight;
81 79

  
82
  private boolean mIsFullScreen;
83

  
84 80
///////////////////////////////////////////////////////////////////////////////////////////////////
85 81

  
86 82
  void leaveScreen(RubikActivity act)
......
166 162
          {
167 163
          View popupView = mPlayPopup.getContentView();
168 164
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
169
          final int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
170
          final int dbLevel = ObjectList.getDBLevel(mObject, sizeIndex);
165
          final int dbLevel = ObjectList.getDBLevel(mObject);
171 166
          final int levelsShown = Math.min(dbLevel,LEVELS_SHOWN);
172 167
          final int popupHeight = (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f));
173 168
          final int realHeight = Math.min(popupHeight,maxHeight);
......
205 200

  
206 201
  private void setupObjectWindow(final RubikActivity act, final float width, final float height)
207 202
    {
208
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube2,R.drawable.ui_medium_cube2, R.drawable.ui_big_cube2, R.drawable.ui_huge_cube2);
203
    int icon = RubikActivity.getDrawable(R.drawable.small_cube2,R.drawable.medium_cube2, R.drawable.big_cube2, R.drawable.huge_cube2);
209 204

  
210 205
    BitmapDrawable bd = (BitmapDrawable) act.getResources().getDrawable(icon);
211 206
    int cubeWidth = bd.getIntrinsicWidth();
......
250 245
    for(int object=0; object< ObjectList.NUM_OBJECTS; object++)
251 246
      {
252 247
      final ObjectList list = ObjectList.getObject(object);
253
      final int[] sizes = list.getSizes();
254 248
      int iconSize = RubikActivity.getDrawableSize();
255
      int[] icons = list.getIconIDs(iconSize);
256
      int len = sizes.length;
249
      int icons = list.getIconID(iconSize);
257 250
      final int obj = object;
258 251
      int row = indices[object];
259 252

  
260
      for(int i=0; i<len; i++)
253
      ImageButton button = new ImageButton(act);
254
      button.setBackgroundResource(icons);
255
      button.setOnClickListener( new View.OnClickListener()
261 256
        {
262
        final int index = i;
263

  
264
        ImageButton button = new ImageButton(act);
265
        button.setBackgroundResource(icons[i]);
266
        button.setOnClickListener( new View.OnClickListener()
257
        @Override
258
        public void onClick(View v)
267 259
          {
268
          @Override
269
          public void onClick(View v)
260
          if( act.getPreRender().isUINotBlocked() && ScreenList.getCurrentScreen()== ScreenList.PLAY )
270 261
            {
271
            if( act.getPreRender().isUINotBlocked() && ScreenList.getCurrentScreen()== ScreenList.PLAY )
272
              {
273
              mObject = obj;
274
              mSize   = sizes[index];
275
              act.changeObject(list,sizes[index], true);
276
              adjustLevels(act);
277
              mController.clearMoves(act);
278
              }
279

  
280
            mObjectPopup.dismiss();
262
            mObject = obj;
263
            act.changeObject(list, true);
264
            adjustLevels(act);
265
            mController.clearMoves(act);
281 266
            }
282
          });
283 267

  
284
        GridLayout.LayoutParams params = new GridLayout.LayoutParams(rowSpecs[row],colSpecs[nextInRow[row]]);
285
        params.bottomMargin = margin;
286
        params.topMargin    = margin;
287
        params.leftMargin   = margin;
288
        params.rightMargin  = margin;
268
          mObjectPopup.dismiss();
269
          }
270
        });
289 271

  
290
        nextInRow[row]++;
272
      GridLayout.LayoutParams params = new GridLayout.LayoutParams(rowSpecs[row],colSpecs[nextInRow[row]]);
273
      params.bottomMargin = margin;
274
      params.topMargin    = margin;
275
      params.leftMargin   = margin;
276
      params.rightMargin  = margin;
291 277

  
292
        objectGrid.addView(button, params);
293
        }
278
      nextInRow[row]++;
279

  
280
      objectGrid.addView(button, params);
294 281
      }
295 282
    }
296 283

  
......
360 347
      {
361 348
      case 0: RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
362 349
              int object = play.getObject();
363
              int size   = play.getSize();
364
              int sizeIndex = ObjectList.getSizeIndex(object,size);
365 350
              Bundle sBundle = new Bundle();
366
              sBundle.putInt("tab", ObjectList.pack(object,sizeIndex) );
351
              sBundle.putInt("tab", object );
367 352
              sBundle.putBoolean("submitting", false);
368 353
              RubikDialogScores scores = new RubikDialogScores();
369 354
              scores.setArguments(sBundle);
......
420 405
  public void savePreferences(SharedPreferences.Editor editor)
421 406
    {
422 407
    editor.putInt("statePlay_object", mObject);
423
    editor.putInt("statePlay_size"  , mSize);
424 408

  
425 409
    if( mObjectPopup!=null )
426 410
      {
......
446 430
  public void restorePreferences(SharedPreferences preferences)
447 431
    {
448 432
    mObject= preferences.getInt("statePlay_object", DEF_OBJECT);
449
    mSize  = preferences.getInt("statePlay_size"  , DEF_SIZE  );
450

  
451
    int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
452
    int dbLevel = ObjectList.getDBLevel(mObject, sizeIndex);
433
    int dbLevel = ObjectList.getDBLevel(mObject);
453 434

  
454 435
    // This means the app has been upgraded to a new version which swapped the
455 436
    // Object for a new one with larger sizeIndex and now getMaxLevel() returns
456 437
    // 0. Reset the object to default, otherwise we'll get a crash later on.
457 438

  
458
    if( dbLevel==0 )
459
      {
460
      mObject = DEF_OBJECT;
461
      mSize   = DEF_SIZE;
462
      }
439
    if( dbLevel==0 ) mObject = DEF_OBJECT;
463 440
    }
464 441

  
465 442
///////////////////////////////////////////////////////////////////////////////////////////////////
466 443

  
467
  public boolean setObjectAndSize(RubikActivity act, ObjectList obj, int size)
444
  public boolean setObject(RubikActivity act, ObjectList obj)
468 445
    {
469
    if( mObject!=obj.ordinal() || mSize != size )
446
    if( mObject!=obj.ordinal() )
470 447
      {
471
      boolean success = false;
472

  
473
      for( int s: obj.getSizes() )
474
        if( s==size )
475
          {
476
          success = true;
477
          break;
478
          }
479

  
480
      if( success )
481
        {
482
        mObject = obj.ordinal();
483
        mSize   = size;
484

  
485
        if( mPlayLayout!=null ) adjustLevels(act);
486
        }
487

  
488
      return success;
448
      mObject = obj.ordinal();
449
      if( mPlayLayout!=null ) adjustLevels(act);
450
      return true;
489 451
      }
490 452

  
491
    return true;
453
    return false;
492 454
    }
493 455

  
494 456
///////////////////////////////////////////////////////////////////////////////////////////////////
......
497 459
  private void displayPopup(RubikActivity act, View view, PopupWindow window, int w, int h, int xoff, int yoff)
498 460
    {
499 461
    View topLayout = act.findViewById(R.id.relativeLayout);
462
    boolean isFullScreen;
500 463

  
501 464
    if( topLayout!=null )
502 465
      {
503 466
      topLayout.getLocationOnScreen(mLocation);
504
      mIsFullScreen = (mLocation[1]==0);
467
      isFullScreen = (mLocation[1]==0);
505 468
      }
506 469
    else
507 470
      {
508
      mIsFullScreen = true;
471
      isFullScreen = true;
509 472
      }
510 473

  
511 474
    // if on Android 11 or we are fullscreen
512
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || mIsFullScreen )
475
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || isFullScreen )
513 476
      {
514 477
      window.showAsDropDown(view, xoff, yoff, Gravity.CENTER);
515 478
      window.update(view, w, h);
......
531 494

  
532 495
  private void adjustLevels(final RubikActivity act)
533 496
    {
534
    int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
535
    int dbLevel = ObjectList.getDBLevel(mObject, sizeIndex);
536
    int numScrambles = ObjectList.getNumScramble(mObject, sizeIndex);
497
    int dbLevel = ObjectList.getDBLevel(mObject);
498
    int numScrambles = ObjectList.getNumScramble(mObject);
537 499
    int numLevel = Math.min(dbLevel, LEVELS_SHOWN);
538 500
    String[] levels = new String[numLevel];
539 501

  
......
580 542
      button.setText(levels[i]);
581 543
      button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
582 544

  
583
      int icon = scores.isSolved(mObject, sizeIndex, level-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
545
      int icon = scores.isSolved(mObject, level-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
584 546
      button.setCompoundDrawablesWithIntrinsicBounds(icon,0,0,0);
585 547

  
586 548
      button.setOnClickListener( new View.OnClickListener()
......
616 578
    {
617 579
    return mObject;
618 580
    }
619

  
620
///////////////////////////////////////////////////////////////////////////////////////////////////
621

  
622
  public int getSize()
623
    {
624
    return mSize;
625
    }
626 581
  }
src/main/java/org/distorted/screens/RubikScreenSolver.java
80 80
    mSolving = false;
81 81

  
82 82
    ObjectList currentObject= ImplementedSolversList.getObject(0);
83
    int currentObjectSize   = ImplementedSolversList.getObjectSize(0);
84 83

  
85
    act.setupObject(currentObject, currentObjectSize, null);
84
    act.setupObject(currentObject,null);
86 85
    RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
87
    play.setObjectAndSize(act, currentObject, currentObjectSize);
86
    play.setObject(act, currentObject);
88 87

  
89 88
    generateFaceColors();
90 89

  
src/main/java/org/distorted/screens/RubikScreenSolving.java
188 188

  
189 189
      RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
190 190
      int object  = play.getObject();
191
      int size    = play.getSize();
192 191
      int level   = play.getLevel();
193
      int realSize= ObjectList.getSizeIndex(object,size);
194

  
195
      boolean isNew = mScores.setRecord(object, realSize, level, mElapsed);
192
      boolean isNew = mScores.setRecord(object, level, mElapsed);
196 193

  
197 194
      return isNew ? mElapsed : -mElapsed;
198 195
      }
src/main/java/org/distorted/solvers/ImplementedSolversList.java
25 25

  
26 26
public enum ImplementedSolversList
27 27
{
28
  CUBE3 ( ObjectList.CUBE, 3),
28
  CUBE3 ( ObjectList.CUBE_3),
29 29
  ;
30 30

  
31 31
  public static final int NUM_OBJECTS = values().length;
32 32

  
33 33
  private final ObjectList mObject;
34
  private final int mObjectSize;
35 34

  
36 35
  private static final ImplementedSolversList[] objects;
37 36

  
......
55 54

  
56 55
///////////////////////////////////////////////////////////////////////////////////////////////////
57 56

  
58
  public static int getObjectSize(int ordinal)
57
  ImplementedSolversList(ObjectList object)
59 58
    {
60
    return objects[ordinal].mObjectSize;
61
    }
62

  
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64

  
65
  ImplementedSolversList(ObjectList object, int size)
66
    {
67
    mObject     = object;
68
    mObjectSize =  size;
59
    mObject= object;
69 60
    }
70 61
}
src/main/java/org/distorted/solvers/SolverMain.java
49 49
// If a certain cubit is locked, return the color (index into it's FACE_COLORS array) it
50 50
// must have. Otherwise return -1.
51 51

  
52
  public static int cubitIsLocked(ObjectList object, int size, int cubit)
52
  public static int cubitIsLocked(ObjectList object, int cubit)
53 53
    {
54
    if( object == ObjectList.CUBE && size == 3)
54
    if( object == ObjectList.CUBE_3 )
55 55
      {
56 56
      if( cubit==21 ) return 0; // center of the right  face
57 57
      if( cubit== 4 ) return 1; // center of the left   face
......
248 248
    {
249 249
    RubikScreenSolver solver = (RubikScreenSolver) ScreenList.SVER.getScreenClass();
250 250

  
251
    if( mObject.getObjectList()==ObjectList.CUBE && mObject.getNumLayers()==3 )
251
    if( mObject.getObjectList()==ObjectList.CUBE_3 )
252 252
      {
253 253
      solveCube3(solver);
254 254
      }
src/main/java/org/distorted/tutorials/TutorialActivity.java
63 63
    private int mCurrentApiVersion;
64 64
    private TutorialState mState;
65 65
    private String mURL;
66
    private int mObjectOrdinal, mObjectSize;
66
    private int mObjectOrdinal;
67 67
    private TutorialWebView mWebView;
68 68

  
69 69
///////////////////////////////////////////////////////////////////////////////////////////////////
......
82 82
        {
83 83
        mURL           = b.getString("url");
84 84
        mObjectOrdinal = b.getInt("obj");
85
        mObjectSize    = b.getInt("siz");
86 85
        }
87 86

  
88 87
      unlock();
......
211 210
      if( mObjectOrdinal>=0 && mObjectOrdinal< ObjectList.NUM_OBJECTS )
212 211
        {
213 212
        ObjectList obj = ObjectList.getObject(mObjectOrdinal);
214
        int[] sizes = obj.getSizes();
215
        int sizeIndex = ObjectList.getSizeIndex(mObjectOrdinal,mObjectSize);
216

  
217
        if( sizeIndex>=0 && sizeIndex<sizes.length )
218
          {
219
          view.getPreRender().changeObject(obj,mObjectSize);
220
          }
213
        view.getPreRender().changeObject(obj);
221 214
        }
222 215
      }
223 216
    
src/main/java/org/distorted/tutorials/TutorialList.java
26 26

  
27 27
public enum TutorialList
28 28
{
29
  CUBE2 ( ObjectList.CUBE, 2,
29
  CUBE2 ( ObjectList.CUBE_2,
30 30
          new String[][] {
31 31
                          {"gb","rJlh5p2wAKA","How to Solve a 2x2 Rubik's Cube","Z3"},
32 32
                          {"es","f85wqJTIDlw","Resolver cubo de Rubik 2X2","Cuby"},
......
39 39
                         }
40 40
        ),
41 41

  
42
  CUBE3 ( ObjectList.CUBE, 3,
42
  CUBE3 ( ObjectList.CUBE_3,
43 43
          new String[][] {
44 44
                          {"gb","-8ohoCKN0Zw","How to Solve a Rubik's Cube","Z3"},
45 45
                          {"es","GyY0OxDk5lI","Resolver cubo de Rubik 3x3","Cuby"},
......
54 54
                         }
55 55
        ),
56 56

  
57
  CUBE4 ( ObjectList.CUBE, 4,
57
  CUBE4 ( ObjectList.CUBE_4,
58 58
          new String[][] {
59 59
                          {"gb","RR77Md71Ymc","How to Solve the 4x4 Rubik's Cube","Z3"},
60 60
                          {"es","d_4xk1r9hxU","Resolver cubo de Rubik 4x4","Cuby"},
......
71 71
                         }
72 72
        ),
73 73

  
74
  CUBE5 ( ObjectList.CUBE, 5,
74
  CUBE5 ( ObjectList.CUBE_5,
75 75
          new String[][] {
76 76
                          {"gb","zMkNkXHzQts","How to Solve the 5x5 Rubik's Cube","Z3"},
77 77
                          {"es","6uaq-xfFs98","Resolver cubo de Rubik 5x5","Cuby"},
......
83 83
                         }
84 84
        ),
85 85

  
86
  JING  ( ObjectList.JING, 2,
86
  JING  ( ObjectList.JING_2,
87 87
          new String[][] {
88 88
                          {"gb","0T8Iw6aI2gA","Jing's Pyraminx Tutorial","SuperAntoniovivaldi"},
89 89
                          {"es","Na27_GUIzqY","Resolver Jing Pyraminx","Cuby"},
......
94 94
                         }
95 95
        ),
96 96

  
97
  PYRA3 ( ObjectList.PYRA, 3,
97
  PYRA3 ( ObjectList.PYRA_3,
98 98
          new String[][] {
99 99
                          {"gb","xIQtn2qazvg","Pyraminx Layer By Layer","Z3"},
100 100
                          {"es","4cJJe9RAzAU","Resolver Pyraminx","Cuby"},
......
107 107
                         }
108 108
        ),
109 109

  
110
  PYRA4 ( ObjectList.PYRA, 4,
110
  PYRA4 ( ObjectList.PYRA_4,
111 111
          new String[][] {
112 112
                          {"gb","tGQDqDcSa6U","How to Solve the Master Pyraminx","Z3"},
113 113
                          {"es","74PIPm9-uPg","Resolver Master Pyraminx 4x4","Cuby"},
......
119 119
                         }
120 120
        ),
121 121

  
122
  PYRA5 ( ObjectList.PYRA, 5,
122
  PYRA5 ( ObjectList.PYRA_5,
123 123
          new String[][] {
124 124
                          {"gb","2nsPEECDdN0","Professor Pyraminx Solve","RedKB"},
125 125
                          {"es","cSDj8OQK3TU","Tutorial del Professor Pyraminx","QBAndo"},
......
129 129
                         }
130 130
        ),
131 131

  
132
  KILO3( ObjectList.KILO, 3,
132
  KILO3( ObjectList.KILO_3,
133 133
          new String[][] {
134 134
                          {"gb","grgGgUSxiQg","How to Solve the Kilominx","Z3"},
135 135
                          {"es","g6WMYjkCLok","Resolver Kilominx","Cuby"},
......
141 141
                         }
142 142
       ),
143 143

  
144
  KILO5( ObjectList.KILO, 5,
144
  KILO5( ObjectList.KILO_5,
145 145
          new String[][] {
146 146
                          {"gb","VAnzC2SYVc4","How To Solve A Master Kilominx","Grizz Media"},
147 147
                          {"es","ozINTg-61Fs","Tutorial Master Kilominx","RubikArt"},
......
156 156
                         }
157 157
       ),
158 158

  
159
  MEGA3( ObjectList.MEGA, 3,
159
  MEGA3( ObjectList.MEGA_3,
160 160
          new String[][] {
161 161
                          {"gb","j4x61L5Onzk","How to Solve the Megaminx","Z3"},
162 162
                          {"es","xuKbT6Il0Ko","Resolver Megaminx","Cuby"},
......
168 168
                         }
169 169
       ),
170 170

  
171
  MEGA5( ObjectList.MEGA, 5,
171
  MEGA5( ObjectList.MEGA_5,
172 172
          new String[][] {
173 173
                          {"gb","MNBMm8BnHtQ","Solve the Gigaminx Part 1","BeardedCubing"},
174 174
                          {"gb","QrrP4GwqVMw","Solve the Gigaminx Part 2","BeardedCubing"},
......
186 186
                         }
187 187
       ),
188 188

  
189
  ULTI ( ObjectList.ULTI, 2,
189
  ULTI ( ObjectList.ULTI_2,
190 190
          new String[][] {
191 191
                          {"gb","n1ikPKZxGEo","Ultimate Skewb Tutorial","BeardedCubing"},
192 192
                          {"es","wNL1WJ_sCfs","Resolver Skewb ULTIMATE","Cuby"},
......
198 198
                         }
199 199
        ),
200 200

  
201
  DIAM2 ( ObjectList.DIAM, 2,
201
  DIAM2 ( ObjectList.DIAM_2,
202 202
          new String[][] {
203 203
                          {"gb","R2wrbJJ3izM","How to Solve a Skewb Diamond","Dr. Penguin^3"},
204 204
                          {"es","2RCusYQdYYE","Como resolver Skewb Diamond","Tutoriales Rubik"},
......
210 210
                         }
211 211
       ),
212 212

  
213
  DIAM3 ( ObjectList.DIAM, 3,
213
  DIAM3 ( ObjectList.DIAM_3,
214 214
          new String[][] {
215 215
                          {"gb","n_mBSUDLUZw","Face Turning Octahedron Tutorial","SuperAntoniovivaldi"},
216 216
                          {"es","ogf0t6fGxZI","FTO - Tutorial en espaƱol","Gadi Rubik"},
......
220 220
                         }
221 221
       ),
222 222

  
223
  DIAM4 ( ObjectList.DIAM, 4,
223
  DIAM4 ( ObjectList.DIAM_4,
224 224
          new String[][] {
225 225
                          {"gb","3GJkySk5zeQ","Master Face Turning Octahedron","SuperAntoniovivaldi"},
226 226
                          {"gb","zW_1htxy52k","Master FTO Tutorial","Michele Regano"},
......
229 229
                         }
230 230
       ),
231 231

  
232
  DINO3 ( ObjectList.DINO, 3,
232
  DINO3 ( ObjectList.DINO_3,
233 233
          new String[][] {
234 234
                          {"gb","puTJZqFBQwo","Dino Skewb Cube Tutorial","Bearded Cubing"},
235 235
                          {"es","6o1Yo5iCxvI","Resolver Cubo Dino","Cuby"},
......
241 241
                         }
242 242
        ),
243 243

  
244
  REDI3 ( ObjectList.REDI, 3,
244
  REDI3 ( ObjectList.REDI_3,
245 245
          new String[][] {
246 246
                          {"gb","Qn7TJED6O-4","How to Solve the MoYu Redi Cube","Z3"},
247 247
                          {"es","g0M38Aotgac","Resolver Redi Cube","Cuby"},
......
253 253
                         }
254 254
        ),
255 255

  
256
  HELI3 ( ObjectList.HELI, 3,
256
  HELI3 ( ObjectList.HELI_3,
257 257
          new String[][] {
258 258
                          {"gb","-suwJpd_PO8","Helicopter Cube Tutorial","Bearded Cubing"},
259 259
                          {"es","DWG9n_YyGPA","Resolver Helicopter Cube","Cuby"},
......
265 265
                         }
266 266
        ),
267 267

  
268
  SKEW2 ( ObjectList.SKEW, 2,
268
  SKEW2 ( ObjectList.SKEW_2,
269 269
          new String[][] {
270 270
                          {"gb","I6132yshkeU","How to Solve the Skewb","Z3"},
271 271
                          {"es","wxQX3HhPgds","Resolver Skewb (Principiantes)","Cuby"},
......
278 278
                         }
279 279
        ),
280 280

  
281
  SKEW3 ( ObjectList.SKEW, 3,
281
  SKEW3 ( ObjectList.SKEW_3,
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff