Project

General

Profile

« Previous | Next » 

Revision d433b50e

Added by Leszek Koltunski over 2 years ago

In the 'magic' app, ObjectType is now only used in RubikObject and RubikObjectList classes and nowhere else.
This is a major step towards being able to download objects from an online repository.

View differences:

src/main/java/org/distorted/config/ConfigActivity.java
37 37
import org.distorted.library.main.DistortedLibrary;
38 38
import org.distorted.main.R;
39 39
import org.distorted.objectlib.main.ObjectControl;
40
import org.distorted.objectlib.main.ObjectType;
40
import org.distorted.objects.RubikObject;
41
import org.distorted.objects.RubikObjectList;
41 42

  
42 43
import java.io.InputStream;
43 44

  
......
188 189
      ConfigSurfaceView view = findViewById(R.id.configSurfaceView);
189 190
      view.onResume();
190 191

  
191
      if( mObjectOrdinal>=0 && mObjectOrdinal< ObjectType.NUM_OBJECTS )
192
      if( mObjectOrdinal>=0 && mObjectOrdinal< RubikObjectList.getNumObjects() )
192 193
        {
193
        ObjectType obj = ObjectType.getObject(mObjectOrdinal);
194
        changeIfDifferent(obj,view.getObjectControl());
194
        RubikObject object = RubikObjectList.getObject(mObjectOrdinal);
195
        changeIfDifferent(object,view.getObjectControl());
195 196
        }
196 197
      }
197 198

  
......
214 215

  
215 216
///////////////////////////////////////////////////////////////////////////////////////////////////
216 217

  
217
    private void changeIfDifferent(ObjectType type,ObjectControl control)
218
    private void changeIfDifferent(RubikObject object,ObjectControl control)
218 219
      {
219
      InputStream jsonStream = ObjectJson.getStream(type,this);
220
      InputStream meshStream = ObjectMesh.getStream(type,this);
221
      control.changeIfDifferent(type.ordinal(),jsonStream,meshStream);
220
      if( object!=null )
221
        {
222
        int jsonID = object.getJsonID();
223
        int meshID = object.getMeshID();
224

  
225
        InputStream jsonStream = ObjectJson.getStream(jsonID,this);
226
        InputStream meshStream = ObjectMesh.getStream(meshID,this);
227
        control.changeIfDifferent(object.getOrdinal(),jsonStream,meshStream);
228
        }
222 229
      }
223 230

  
224 231
///////////////////////////////////////////////////////////////////////////////////////////////////
......
304 311

  
305 312
///////////////////////////////////////////////////////////////////////////////////////////////////
306 313

  
307
    public void changeObject(ObjectType newObject)
314
    public void changeObject(RubikObject object)
308 315
      {
309 316
      ConfigSurfaceView view = findViewById(R.id.configSurfaceView);
310 317
      ObjectControl control = view.getObjectControl();
311
      changeIfDifferent(newObject,control);
318
      changeIfDifferent(object,control);
312 319
      }
313 320
}
src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java
38 38
import org.distorted.main.R;
39 39
import org.distorted.main.RubikActivity;
40 40
import org.distorted.network.RubikScores;
41
import org.distorted.objectlib.main.ObjectType;
42 41
import org.distorted.screens.ScreenList;
43 42
import org.distorted.screens.RubikScreenPlay;
44 43

  
......
80 79
        if( name.length()>0 )
81 80
          {
82 81
          RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
83
          ObjectType object = play.getObject();
82
          int object = play.getObject();
84 83

  
85
          bundle.putInt("tab", object.ordinal() );
84
          bundle.putInt("tab", object );
86 85
          bundle.putBoolean("submitting", true);
87 86

  
88 87
          RubikDialogScores scoresDiag = new RubikDialogScores();
src/main/java/org/distorted/dialogs/RubikDialogPattern.java
39 39
import android.widget.ImageView;
40 40
import android.widget.TextView;
41 41

  
42
import org.distorted.objectlib.main.ObjectType;
43

  
44 42
import org.distorted.main.R;
45 43
import org.distorted.main.RubikActivity;
44
import org.distorted.objects.RubikObject;
45
import org.distorted.objects.RubikObjectList;
46 46
import org.distorted.patterns.RubikPatternList;
47 47
import org.distorted.screens.RubikScreenPlay;
48 48
import org.distorted.screens.ScreenList;
......
94 94

  
95 95
    for(int i=0; i< RubikPatternList.NUM_OBJECTS; i++)
96 96
      {
97
      ObjectType type = RubikPatternList.getObject(i);
98
      int iconSize    = RubikActivity.getDrawableSize();
99
      int iconID      = type.getIconID(iconSize);
97
      int ordinal  = RubikPatternList.getObject(i);
98
      RubikObject object = RubikObjectList.getObject(ordinal);
99
      int iconSize= RubikActivity.getDrawableSize();
100
      int iconID  = object==null ? 0 : object.getIconID(iconSize);
100 101

  
101 102
      ImageView imageView = new ImageView(act);
102 103
      imageView.setImageResource(iconID);
......
131 132
  private int getPatternOrdinal()
132 133
    {
133 134
    RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
134
    ObjectType obj  = play.getObject();
135
    int obj  = play.getObject();
135 136
    int ret = RubikPatternList.getOrdinal(obj);
136 137

  
137 138
    if( ret<0 )
src/main/java/org/distorted/dialogs/RubikDialogPatternView.java
27 27
import android.widget.FrameLayout;
28 28

  
29 29
import org.distorted.objectlib.main.ObjectControl;
30
import org.distorted.objectlib.main.ObjectType;
31 30

  
32 31
import org.distorted.main.R;
33 32
import org.distorted.main.RubikActivity;
......
96 95
        {
97 96
        RubikPattern pattern = RubikPattern.getInstance();
98 97
        int[][] moves   = pattern.reInitialize(mTab, groupPosition, childPosition);
99
        ObjectType object = RubikPatternList.getObject(mTab);
98
        int object = RubikPatternList.getObject(mTab);
100 99
        ract.changeIfDifferent(object,control);
101 100
        control.initializeObject(moves);
102 101

  
src/main/java/org/distorted/dialogs/RubikDialogScores.java
38 38
import android.widget.ImageView;
39 39
import android.widget.TextView;
40 40

  
41
import org.distorted.objectlib.main.ObjectType;
42

  
43 41
import org.distorted.main.R;
44 42
import org.distorted.main.RubikActivity;
43
import org.distorted.objects.RubikObject;
44
import org.distorted.objects.RubikObjectList;
45 45

  
46 46
///////////////////////////////////////////////////////////////////////////////////////////////////
47 47

  
......
104 104
    tabLayout.setupWithViewPager(viewPager);
105 105

  
106 106
    viewPager.setCurrentItem(curTab);
107
    ObjectType type;
108 107
    int iconSize = RubikActivity.getDrawableSize();
108
    int numObjects = RubikObjectList.getNumObjects();
109 109

  
110
    for (int object = 0; object< ObjectType.NUM_OBJECTS; object++)
110
    for (int object=0; object<numObjects; object++)
111 111
      {
112
      type = ObjectType.getObject(object);
113
      int iconID = type.getIconID(iconSize);
112
      RubikObject robject = RubikObjectList.getObject(object);
113
      int iconID = robject==null ? 0 : robject.getIconID(iconSize);
114 114
      ImageView imageView = new ImageView(act);
115 115
      imageView.setImageResource(iconID);
116 116
      TabLayout.Tab tab = tabLayout.getTabAt(object);
src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java
30 30
import android.view.ViewGroup;
31 31
import android.widget.LinearLayout;
32 32

  
33
import org.distorted.objectlib.main.ObjectType;
34

  
35 33
import org.distorted.main.R;
36 34
import org.distorted.network.RubikScores;
37 35
import org.distorted.network.RubikNetwork;
36
import org.distorted.objects.RubikObjectList;
38 37
import org.distorted.screens.RubikScreenPlay;
39 38

  
40 39
///////////////////////////////////////////////////////////////////////////////////////////////////
......
109 108
    {
110 109
    prepareView();
111 110

  
112
    ObjectType[] types = ObjectType.values();
113 111
    int MAX = RubikScreenPlay.LEVELS_SHOWN;
114 112
    int toDo=0;
115 113
    int[] toDoTab = new int[mNumTabs];
......
118 116

  
119 117
    for(int i=0; i<mNumTabs; i++)
120 118
      {
121
      lastTab[i]= RubikScreenPlay.getDBLevel(types[i]);
119
      lastTab[i]= RubikObjectList.getDBLevel(i);
122 120
      maxTab[i] = Math.min(lastTab[i],MAX);
123 121
      toDoTab[i]= 0;
124 122

  
......
209 207
    {
210 208
    mAct = act;
211 209
    mDialog = diag;
212
    mNumTabs = ObjectType.NUM_OBJECTS;
210
    mNumTabs = RubikObjectList.getNumObjects();
213 211
    mViews = new RubikDialogScoresView[mNumTabs];
214 212
    mViewPager = viewPager;
215 213
    mIsSubmitting = isSubmitting;
src/main/java/org/distorted/dialogs/RubikDialogSetName.java
148 148
          RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
149 149

  
150 150
          Bundle bundle = new Bundle();
151
          bundle.putInt("tab", play.getObject().ordinal() );
151
          bundle.putInt("tab", play.getObject() );
152 152
          bundle.putBoolean("submitting", true);
153 153

  
154 154
          RubikDialogScores scores = new RubikDialogScores();
src/main/java/org/distorted/dialogs/RubikDialogTutorial.java
43 43

  
44 44
import org.distorted.main.R;
45 45
import org.distorted.main.RubikActivity;
46
import org.distorted.objectlib.main.ObjectType;
47 46
import org.distorted.screens.RubikScreenPlay;
48 47
import org.distorted.screens.ScreenList;
49 48
import org.distorted.tutorials.TutorialList;
......
130 129
  private int getTutorialOrdinal()
131 130
    {
132 131
    RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
133
    ObjectType obj  = play.getObject();
132
    int obj = play.getObject();
134 133

  
135 134
    int ret = TutorialList.getOrdinal(obj);
136 135

  
src/main/java/org/distorted/dialogs/RubikDialogTutorialView.java
35 35

  
36 36
import com.google.firebase.analytics.FirebaseAnalytics;
37 37

  
38
import org.distorted.objectlib.main.ObjectType;
39

  
40 38
import org.distorted.main.BuildConfig;
41 39
import org.distorted.main.R;
42 40
import org.distorted.main.RubikActivity;
41
import org.distorted.objects.RubikObject;
42
import org.distorted.objects.RubikObjectList;
43 43
import org.distorted.tutorials.TutorialList;
44 44

  
45 45
///////////////////////////////////////////////////////////////////////////////////////////////////
......
76 76
    String packageName = act.getPackageName();
77 77

  
78 78
    TutorialList list  = TutorialList.getObject(position);
79
    ObjectType objType = list.getObject();
79
    int object = list.getObject();
80 80

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

  
96 96
      int countryID = res.getIdentifier( coun, "drawable", packageName);
97 97

  
98
      View row = createRow(ract,countryID,desc,url,auth,widthT,objType,colorB,colorT);
98
      View row = createRow(ract,countryID,desc,url,auth,widthT,object,colorB,colorT);
99 99
      layout.addView(row);
100 100
      }
101 101

  
......
112 112
///////////////////////////////////////////////////////////////////////////////////////////////////
113 113

  
114 114
  private View createRow(final RubikActivity act, int countryID, final String desc, final String url,
115
                         final String auth, int size, final ObjectType obj, int colorB, int colorT)
115
                         final String auth, int size, final int obj, int colorB, int colorT)
116 116
    {
117 117
    float textSize = 0.5f*size;
118 118
    View row = inflate( act, R.layout.dialog_tutorial_row, null);
......
158 158

  
159 159
///////////////////////////////////////////////////////////////////////////////////////////////////
160 160

  
161
  private void analyticsReport(RubikActivity act, String desc, String author, ObjectType obj)
161
  private void analyticsReport(RubikActivity act, String desc, String author, int obj)
162 162
    {
163 163
    String message = desc+" ("+author+")";
164 164

  
......
172 172

  
173 173
      if( analytics!=null )
174 174
        {
175
        RubikObject object = RubikObjectList.getObject(obj);
176

  
175 177
        Bundle bundle = new Bundle();
176 178
        bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, message);
177
        bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, obj.name());
179
        bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, object==null ? "NULL" : object.getName() );
178 180
        analytics.logEvent(FirebaseAnalytics.Event.TUTORIAL_BEGIN, bundle);
179 181
        }
180 182
      }
src/main/java/org/distorted/main/RubikActivity.java
49 49

  
50 50
import org.distorted.objectlib.main.ObjectControl;
51 51
import org.distorted.objectlib.main.TwistyObject;
52
import org.distorted.objectlib.main.ObjectType;
53 52
import org.distorted.objectlib.effects.BaseEffect;
54 53

  
55 54
import org.distorted.dialogs.RubikDialogError;
56 55
import org.distorted.dialogs.RubikDialogPrivacy;
57 56
import org.distorted.network.RubikScores;
58 57
import org.distorted.network.RubikNetwork;
58
import org.distorted.objects.RubikObject;
59
import org.distorted.objects.RubikObjectList;
59 60
import org.distorted.screens.ScreenList;
60 61
import org.distorted.screens.RubikScreenPlay;
61 62
import org.distorted.tutorials.TutorialActivity;
......
256 257
        }
257 258

  
258 259
      RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
259
      ObjectType object = play.getObject();
260
      int object = play.getObject();
260 261
      changeIfDifferent(object,view.getObjectControl());
261 262

  
262 263
      if( mIsChinese && !mPolicyAccepted ) PrivacyPolicy();
......
438 439

  
439 440
///////////////////////////////////////////////////////////////////////////////////////////////////
440 441

  
441
    public void changeObject(ObjectType newObject, boolean reportChange)
442
    public void changeObject(int newObject, boolean reportChange)
442 443
      {
443 444
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
444 445
      ObjectControl control = view.getObjectControl();
......
447 448

  
448 449
      if( reportChange && oldObject!=null )
449 450
        {
451
        RubikObject robject = RubikObjectList.getObject(newObject);
452
        String newName = robject==null ? "NULL" : robject.getName();
450 453
        float fps = view.getRenderer().getFPS();
451 454
        fps = (int)(fps+0.5f);
452 455
        StringBuilder name = new StringBuilder();
......
454 457
        name.append(' ');
455 458
        name.append(fps);
456 459
        name.append(" --> ");
457
        name.append(newObject.name());
460
        name.append(newName);
458 461

  
459 462
        if( BuildConfig.DEBUG )
460 463
          {
......
476 479

  
477 480
///////////////////////////////////////////////////////////////////////////////////////////////////
478 481

  
479
    public void changeIfDifferent(ObjectType type,ObjectControl control)
482
    public void changeIfDifferent(int ordinal, ObjectControl control)
480 483
      {
481
      InputStream jsonStream = ObjectJson.getStream(type,this);
482
      InputStream meshStream = ObjectMesh.getStream(type,this);
483
      control.changeIfDifferent(type.ordinal(),jsonStream,meshStream);
484
      InputStream jsonStream = ObjectJson.getStream(this,ordinal);
485
      InputStream meshStream = ObjectMesh.getStream(this,ordinal);
486
      control.changeIfDifferent(ordinal,jsonStream,meshStream);
484 487
      }
485 488

  
486 489
///////////////////////////////////////////////////////////////////////////////////////////////////
......
584 587

  
585 588
///////////////////////////////////////////////////////////////////////////////////////////////////
586 589

  
587
    public void switchTutorial(String url, ObjectType object)
590
    public void switchTutorial(String url, int objectOrdinal)
588 591
      {
589 592
      Intent myIntent = new Intent(this, TutorialActivity.class);
590 593
      myIntent.putExtra("url", url);
591
      myIntent.putExtra("obj", object.ordinal());
594
      myIntent.putExtra("obj", objectOrdinal);
592 595
      startActivity(myIntent);
593 596
      }
594 597

  
595 598
///////////////////////////////////////////////////////////////////////////////////////////////////
596 599

  
597
    public void switchConfig(ObjectType object)
600
    public void switchConfig(int objectOrdinal)
598 601
      {
599 602
      Intent myIntent = new Intent(this, ConfigActivity.class);
600
      myIntent.putExtra("obj", object.ordinal());
603
      myIntent.putExtra("obj", objectOrdinal);
601 604
      startActivity(myIntent);
602 605
      }
603 606
}
src/main/java/org/distorted/main/RubikObjectLibInterface.java
38 38
import org.distorted.objectlib.helpers.BlockController;
39 39
import org.distorted.objectlib.helpers.ObjectLibInterface;
40 40
import org.distorted.objectlib.main.ObjectControl;
41
import org.distorted.objectlib.main.ObjectType;
42 41

  
43 42
import org.distorted.dialogs.RubikDialogNewRecord;
44 43
import org.distorted.dialogs.RubikDialogSolved;
45 44
import org.distorted.network.RubikScores;
45
import org.distorted.objects.RubikObject;
46
import org.distorted.objects.RubikObjectList;
46 47
import org.distorted.screens.RubikScreenPlay;
47 48
import org.distorted.screens.RubikScreenReady;
48 49
import org.distorted.screens.RubikScreenSolver;
......
99 100
    {
100 101
    RubikScreenPlay play= (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
101 102
    RubikScores scores  = RubikScores.getInstance();
102
    ObjectType object   = play.getObject();
103
    int level           = play.getLevel();
104
    String name         = scores.getName();
105 103

  
106
    String record = object.name()+" level "+level+" time "+mNewRecord+" isNew: "+mIsNewRecord+" scrambleNum: "+scrambleNum;
104
    int object  = play.getObject();
105
    int level   = play.getLevel();
106
    String name = scores.getName();
107
    RubikObject obj = RubikObjectList.getObject(object);
108

  
109
    String record = obj+" level "+level+" time "+mNewRecord+" isNew: "+mIsNewRecord+" scrambleNum: "+scrambleNum;
107 110

  
108 111
    if( BuildConfig.DEBUG )
109 112
       {
......
431 434
    RubikScreenSolver solver = (RubikScreenSolver) ScreenList.SVER.getScreenClass();
432 435
    int color = solver.getCurrentColor();
433 436
    RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
434
    ObjectType currObject = play.getObject();
437
    int currObject = play.getObject();
435 438
    mLastCubitColor = SolverMain.cubitIsLocked(currObject,cubit);
436 439
    mLastCubit = cubit;
437 440
    mLastCubitFace = face;
src/main/java/org/distorted/network/RubikNetwork.java
37 37
import org.distorted.objects.RubikObject;
38 38
import org.distorted.objects.RubikObjectList;
39 39

  
40
import static org.distorted.screens.RubikScreenPlay.MAX_LEVEL;
40
import static org.distorted.objects.RubikObjectList.MAX_LEVEL;
41 41

  
42 42
///////////////////////////////////////////////////////////////////////////////////////////////////
43 43

  
src/main/java/org/distorted/network/RubikScores.java
28 28

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

  
31
import static org.distorted.screens.RubikScreenPlay.MAX_LEVEL;
32 31
import org.distorted.main.BuildConfig;
33 32
import org.distorted.objects.RubikObject;
34 33
import org.distorted.objects.RubikObjectList;
35 34

  
35
import static org.distorted.objects.RubikObjectList.MAX_LEVEL;
36

  
36 37
///////////////////////////////////////////////////////////////////////////////////////////////////
37 38
// hold my own scores, and some other statistics.
38 39

  
src/main/java/org/distorted/objects/RubikObject.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24 22
import org.distorted.dmesh.ObjectMesh;
25 23
import org.distorted.jsons.ObjectJson;
26 24
import org.distorted.objectlib.main.ObjectType;
27 25
import org.distorted.patterns.RubikPatternList;
28 26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29 29
public class RubikObject
30 30
{
31 31
  private static final int NUM = 4;
......
39 39

  
40 40
///////////////////////////////////////////////////////////////////////////////////////////////////
41 41

  
42
  RubikObject(int ordinal, ObjectType type)
42
  RubikObject(ObjectType type)
43 43
    {
44 44
    mIconID = new int[NUM];
45 45
    for(int i=0; i<NUM; i++) mIconID[i] = type.getIconID(i);
46 46

  
47 47
    mName        = type.name();
48 48
    mNumScramble = type.getNumScramble();
49
    mOrdinal     = ordinal;
50
    mJsonID      = ObjectJson.getJsonID(type);
51
    mMeshID      = ObjectMesh.getMeshID(type);
49
    mOrdinal     = type.ordinal();
50
    mJsonID      = ObjectJson.getJsonID(mOrdinal);
51
    mMeshID      = ObjectMesh.getMeshID(mOrdinal);
52 52

  
53
    int patternOrdinal  = RubikPatternList.getOrdinal(type);
53
    int patternOrdinal  = RubikPatternList.getOrdinal(mOrdinal);
54 54
    mPatterns = RubikPatternList.getPatterns(patternOrdinal);
55 55
    }
56 56

  
src/main/java/org/distorted/objects/RubikObjectList.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import org.distorted.objectlib.main.ObjectConstants;
22 23
import org.distorted.objectlib.main.ObjectType;
23 24

  
24 25
import java.util.ArrayList;
......
28 29

  
29 30
public class RubikObjectList
30 31
{
32
  public static int MAX_LEVEL;
33

  
31 34
  private static RubikObjectList mType;
32 35
  private static int mNumObjects;
33 36
  private static ArrayList<RubikObject> mObjects;
34 37

  
38
  static
39
    {
40
    int max = Integer.MIN_VALUE;
41

  
42
    for (int i=0; i<NUM_OBJECTS; i++)
43
      {
44
      int cur = getDBLevel(i);
45
      if( cur>max ) max = cur;
46
      }
47

  
48
    MAX_LEVEL = max;
49
    }
50

  
35 51
///////////////////////////////////////////////////////////////////////////////////////////////////
36 52

  
37 53
  private RubikObjectList()
......
49 65
    for(int i=0; i<NUM_OBJECTS; i++)
50 66
      {
51 67
      ObjectType type = ObjectType.getObject(i);
52
      RubikObject obj = new RubikObject(i,type);
68
      RubikObject obj = new RubikObject(type);
53 69
      mObjects.add(obj);
54 70
      mNumObjects++;
55 71
      }
......
57 73

  
58 74
///////////////////////////////////////////////////////////////////////////////////////////////////
59 75
// PUBLIC API
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77
// historically older versions of the app had lower 'maxScrambles' in case of several objects and
78
// those got remembered in the server-side DB already, so we need to keep using them. This function
79
// provides a map between 'maxScramble' of an object and its 'dbLevel'. All new objects will have
80
// those two values the same.
81

  
82
  public static int getDBLevel(int ordinal)
83
    {
84
    if( ordinal==ObjectConstants.CUBE_3 ) return 16;
85
    if( ordinal==ObjectConstants.CUBE_4 ) return 20;
86
    if( ordinal==ObjectConstants.CUBE_5 ) return 24;
87
    if( ordinal==ObjectConstants.PYRA_4 ) return 15;
88
    if( ordinal==ObjectConstants.PYRA_5 ) return 20;
89
    if( ordinal==ObjectConstants.MEGA_5 ) return 35;
90
    if( ordinal==ObjectConstants.DIAM_2 ) return 10;
91
    if( ordinal==ObjectConstants.DIAM_3 ) return 18;
92
    if( ordinal==ObjectConstants.REDI_3 ) return 14;
93
    if( ordinal==ObjectConstants.HELI_3 ) return 18;
94
    if( ordinal==ObjectConstants.SKEW_3 ) return 17;
95
    if( ordinal==ObjectConstants.REX_3  ) return 16;
96
    if( ordinal==ObjectConstants.MIRR_3 ) return 16;
97

  
98
    ObjectType type = ObjectType.getObject(ordinal);
99
    return type.getNumScramble();
100
    }
101

  
102
///////////////////////////////////////////////////////////////////////////////////////////////////
60 103

  
61 104
  public static RubikObject getObject(int ordinal)
62 105
    {
src/main/java/org/distorted/patterns/RubikPatternList.java
19 19

  
20 20
package org.distorted.patterns;
21 21

  
22
import org.distorted.objectlib.main.ObjectType;
22
import org.distorted.objectlib.main.ObjectConstants;
23 23

  
24 24
///////////////////////////////////////////////////////////////////////////////////////////////////
25 25

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

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

  
43 43
  private static final RubikPatternList[] objects;
......
55 55

  
56 56
///////////////////////////////////////////////////////////////////////////////////////////////////
57 57

  
58
  public static String[][] getPatterns(int ordinal)
58
  RubikPatternList(int object, String[][] patterns)
59 59
    {
60
    return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal].mPatterns : null;
60
    mObject   = object;
61
    mPatterns = patterns;
61 62
    }
62 63

  
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65
// PUBLIC API
63 66
///////////////////////////////////////////////////////////////////////////////////////////////////
64 67

  
65
  RubikPatternList(ObjectType object, String[][] patterns)
68
  public static String[][] getPatterns(int ordinal)
66 69
    {
67
    mObject   = object;
68
    mPatterns = patterns;
70
    return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal].mPatterns : null;
69 71
    }
70 72

  
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72
// PUBLIC API
73 73
///////////////////////////////////////////////////////////////////////////////////////////////////
74 74

  
75
  public static int getOrdinal(ObjectType object)
75
  public static int getOrdinal(int objectOrdinal)
76 76
    {
77 77
    for(int i=0; i<NUM_OBJECTS; i++)
78 78
      {
79
      if( objects[i].mObject == object )
79
      if( objects[i].mObject == objectOrdinal )
80 80
        {
81 81
        return i;
82 82
        }
......
87 87

  
88 88
///////////////////////////////////////////////////////////////////////////////////////////////////
89 89

  
90
  public static ObjectType getObject(int ordinal)
90
  public static int getObject(int ordinal)
91 91
    {
92 92
    return objects[ordinal].mObject;
93 93
    }
src/main/java/org/distorted/screens/RubikScreenPattern.java
29 29
import android.widget.TextView;
30 30

  
31 31
import org.distorted.objectlib.main.ObjectControl;
32
import org.distorted.objectlib.main.ObjectType;
33 32

  
34 33
import org.distorted.main.R;
35 34
import org.distorted.dialogs.RubikDialogPattern;
......
61 60
  void leaveScreen(RubikActivity act)
62 61
    {
63 62
    RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
64
    ObjectType object = RubikPatternList.getObject(mPatternOrdinal);
63
    int object = RubikPatternList.getObject(mPatternOrdinal);
65 64

  
66 65
    if( !play.setObject(act,object) )
67 66
      {
68
      act.changeObject(play.getObject(),false);
67
      act.changeObject(object,false);
69 68
      }
70 69
    }
71 70

  
src/main/java/org/distorted/screens/RubikScreenPlay.java
35 35
import android.widget.LinearLayout;
36 36
import android.widget.PopupWindow;
37 37

  
38
import org.distorted.objectlib.main.ObjectConstants;
38 39
import org.distorted.objectlib.main.ObjectControl;
39
import org.distorted.objectlib.main.ObjectType;
40 40

  
41 41
import org.distorted.main.R;
42 42
import org.distorted.main.RubikActivity;
......
47 47
import org.distorted.helpers.TransparentButton;
48 48
import org.distorted.helpers.TransparentImageButton;
49 49
import org.distorted.network.RubikScores;
50
import org.distorted.objects.RubikObject;
51
import org.distorted.objects.RubikObjectList;
50 52

  
51 53
import static android.view.View.inflate;
52
import static org.distorted.objectlib.main.ObjectType.NUM_OBJECTS;
53 54

  
54 55
///////////////////////////////////////////////////////////////////////////////////////////////////
55 56

  
......
57 58
  {
58 59
  public static final int NUM_COLUMNS  = 4;
59 60
  public static final int LEVELS_SHOWN = 10;
60
  public static int MAX_LEVEL;
61
  public static final ObjectType DEF_OBJECT= ObjectType.CUBE_3;
61
  public static final int DEF_OBJECT= ObjectConstants.CUBE_3;
62 62

  
63 63
  private static final int[] BUTTON_LABELS = { R.string.scores,
64 64
                                               R.string.patterns,
......
73 73
  private TransparentImageButton mObjButton, mMenuButton, mSolveButton, mScrambleButton;
74 74
  private TransparentButton mPlayButton;
75 75
  private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup;
76
  private ObjectType mObject = DEF_OBJECT;
76
  private int mObject = DEF_OBJECT;
77 77
  private int mObjectSize, mMenuLayoutWidth, mMenuLayoutHeight, mPlayLayoutWidth;
78 78
  private int mLevelValue;
79 79
  private float mButtonSize, mMenuItemSize, mMenuTextSize;
......
82 82
  private int mUpperBarHeight;
83 83
  private boolean mShouldReactToEndOfScrambling;
84 84

  
85
  static
86
    {
87
    ObjectType[] types = ObjectType.values();
88
    int max = Integer.MIN_VALUE;
89

  
90
    for (ObjectType type : types)
91
      {
92
      int cur = getDBLevel(type);
93
      if( cur>max ) max = cur;
94
      }
95

  
96
    MAX_LEVEL = max;
97
    }
98

  
99 85
///////////////////////////////////////////////////////////////////////////////////////////////////
100 86

  
101 87
  void leaveScreen(RubikActivity act)
......
107 93

  
108 94
  void enterScreen(final RubikActivity act)
109 95
    {
96
    int numObjects = RubikObjectList.getNumObjects();
110 97
    float width = act.getScreenWidthInPixels();
111 98
    mUpperBarHeight = act.getHeightUpperBar();
112 99

  
......
114 101
    mButtonSize   = width*RubikActivity.BUTTON_TEXT_SIZE;
115 102
    mMenuItemSize = width*RubikActivity.MENU_ITEM_SIZE;
116 103

  
117
    mRowCount = (NUM_OBJECTS + NUM_COLUMNS-1) / NUM_COLUMNS;
104
    mRowCount = (numObjects + NUM_COLUMNS-1) / NUM_COLUMNS;
118 105
    mColCount = NUM_COLUMNS;
119 106

  
120 107
    // TOP ////////////////////////////
......
192 179
          final int maxHeight= (int)(0.9f*(height-mUpperBarHeight) );
193 180
          View popupView = mPlayPopup.getContentView();
194 181
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
195
          final int dbLevel = getDBLevel(mObject);
182
          final int dbLevel = RubikObjectList.getDBLevel(mObject);
196 183
          final int levelsShown = Math.min(dbLevel,LEVELS_SHOWN);
197 184
          final int popupHeight = (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f));
198 185
          final int realHeight = Math.min(popupHeight,maxHeight);
......
255 242
    objectGrid.setRowCount(mRowCount);
256 243

  
257 244
    LinearLayout bottomLayout = view.findViewById(R.id.bottomLayout);
258
    setupBottomLayout(act,bottomLayout,2*mObjectSize,mObjectSize);
245
    setupBottomLayout(act,bottomLayout,2*mObjectSize);
259 246

  
260 247
    mObjectPopup = new PopupWindow(act);
261 248
    mObjectPopup.setFocusable(true);
......
273 260
      colSpecs[col] = GridLayout.spec(col);
274 261
      }
275 262

  
276
    for(int object = 0; object< NUM_OBJECTS; object++)
263
    int numObjects = RubikObjectList.getNumObjects();
264

  
265
    for(int object=0; object<numObjects; object++)
277 266
      {
278
      final ObjectType type = ObjectType.getObject(object);
267
      final RubikObject robject = RubikObjectList.getObject(object);
279 268
      int iconSize = RubikActivity.getDrawableSize();
280
      int icons = type.getIconID(iconSize);
269
      int icons = robject==null ? 0 : robject.getIconID(iconSize);
281 270
      int row = object/NUM_COLUMNS;
282 271

  
283 272
      ImageButton button = new ImageButton(act);
......
289 278
          {
290 279
          if( act.getControl().isUINotBlocked() && ScreenList.getCurrentScreen()== ScreenList.PLAY )
291 280
            {
292
            mObject = type;
293
            act.changeObject(type, true);
281
            mObject = robject==null ? 0 : robject.getOrdinal();
282
            act.changeObject(mObject, true);
294 283
            if( mPlayLayout!=null ) adjustLevels(act);
295 284
            mMovesController.clearMoves(act);
296 285
            }
......
313 302

  
314 303
///////////////////////////////////////////////////////////////////////////////////////////////////
315 304

  
316
  private void setupBottomLayout(final RubikActivity act, final LinearLayout layout, int width, int height)
305
  private void setupBottomLayout(final RubikActivity act, final LinearLayout layout, int width)
317 306
    {
318 307
    int iconD = RubikActivity.getDrawable(R.drawable.ui_small_info,R.drawable.ui_medium_info, R.drawable.ui_big_info, R.drawable.ui_huge_info);
319 308
    int iconT = RubikActivity.getDrawable(R.drawable.ui_small_tutorial,R.drawable.ui_medium_tutorial, R.drawable.ui_big_tutorial, R.drawable.ui_huge_tutorial);
......
419 408
    switch(button)
420 409
      {
421 410
      case 0: Bundle sBundle = new Bundle();
422
              sBundle.putInt("tab", mObject.ordinal() );
411
              sBundle.putInt("tab", mObject );
423 412
              sBundle.putBoolean("submitting", false);
424 413
              RubikDialogScores scores = new RubikDialogScores();
425 414
              scores.setArguments(sBundle);
......
471 460
      @Override
472 461
      public void onClick(View v)
473 462
        {
474
        RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
475
        int numScrambles = play.getObject().getNumScramble();
463
        RubikObject object = RubikObjectList.getObject(mObject);
464
        int numScrambles = object==null ? 0 : object.getNumScramble();
476 465
        mShouldReactToEndOfScrambling = false;
477 466
        act.getControl().scrambleObject(numScrambles);
478 467
        }
......
483 472

  
484 473
  public void savePreferences(SharedPreferences.Editor editor)
485 474
    {
486
    editor.putString("statePlay_objName", mObject.name() );
475
    RubikObject object = RubikObjectList.getObject(mObject);
476

  
477
    if( object!=null )
478
      {
479
      editor.putString("statePlay_objName", object.getName() );
480
      }
487 481

  
488 482
    if( mObjectPopup!=null )
489 483
      {
......
508 502

  
509 503
  public void restorePreferences(SharedPreferences preferences)
510 504
    {
511
    String objName= preferences.getString("statePlay_objName", DEF_OBJECT.name() );
512
    int ordinal = ObjectType.getOrdinal(objName);
513
    mObject = ordinal>=0 && ordinal<NUM_OBJECTS ? ObjectType.values()[ordinal] : DEF_OBJECT;
505
    RubikObject object = RubikObjectList.getObject(DEF_OBJECT);
506
    String defName = object==null ? "CUBE_3" : object.getName();
507
    String objName= preferences.getString("statePlay_objName",defName);
508
    mObject = RubikObjectList.getOrdinal(objName);
509

  
510
    if( mObject<0 || mObject>=RubikObjectList.getNumObjects() ) mObject = DEF_OBJECT;
514 511
    }
515 512

  
516 513
///////////////////////////////////////////////////////////////////////////////////////////////////
517 514

  
518
  public boolean setObject(RubikActivity act, ObjectType obj)
515
  public boolean setObject(RubikActivity act, int ordinal)
519 516
    {
520
    if( mObject!=obj )
517
    if( mObject!=ordinal )
521 518
      {
522
      mObject = obj;
519
      mObject = ordinal;
523 520
      if( mPlayLayout!=null ) adjustLevels(act);
524 521
      return true;
525 522
      }
......
576 573

  
577 574
  public void adjustSolvedIcons()
578 575
    {
579
    int dbLevel = getDBLevel(mObject);
580
    int numLevel = Math.min(dbLevel, LEVELS_SHOWN);
576
    int dbLevel = RubikObjectList.getDBLevel(mObject);
577
    int numLevel= Math.min(dbLevel, LEVELS_SHOWN);
581 578
    RubikScores scores = RubikScores.getInstance();
582 579

  
583 580
    for(int i=0; i<numLevel; i++)
584 581
      {
585 582
      int level = i<numLevel-1 ? i+1 : dbLevel;
586 583
      Button button = (Button)mPlayLayout.getChildAt(i);
587
      int icon = scores.isSolved(mObject.ordinal(), level-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
584
      int icon = scores.isSolved(mObject, level-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
588 585
      button.setCompoundDrawablesWithIntrinsicBounds(icon,0,0,0);
589 586
      }
590 587
    }
......
593 590

  
594 591
  private void adjustLevels(final RubikActivity act)
595 592
    {
596
    int dbLevel = getDBLevel(mObject);
597
    int numScrambles = mObject.getNumScramble();
593
    int dbLevel = RubikObjectList.getDBLevel(mObject);
594
    RubikObject object = RubikObjectList.getObject(mObject);
595
    int numScrambles = object==null ? 0 : object.getNumScramble();
598 596
    int numLevel = Math.min(dbLevel, LEVELS_SHOWN);
599 597
    String[] levels = new String[numLevel];
600 598

  
......
641 639
      button.setText(levels[i]);
642 640
      button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
643 641

  
644
      int icon = scores.isSolved(mObject.ordinal(), level-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
642
      int icon = scores.isSolved(mObject, level-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
645 643
      button.setCompoundDrawablesWithIntrinsicBounds(icon,0,0,0);
646 644

  
647 645
      button.setOnClickListener( new View.OnClickListener()
......
665 663
      }
666 664
    }
667 665

  
668
///////////////////////////////////////////////////////////////////////////////////////////////////
669
// historically older versions of the app had lower 'maxScrambles' in case of several objects and
670
// those got remembered in the server-side DB already, so we need to keep using them. This function
671
// provides a map between 'maxScramble' of an object and its 'dbLevel'. All new objects will have
672
// those two values the same.
673

  
674
  public static int getDBLevel(ObjectType object)
675
    {
676
    switch(object)
677
      {
678
      case CUBE_3: return 16;
679
      case CUBE_4: return 20;
680
      case CUBE_5: return 24;
681
      case PYRA_4: return 15;
682
      case PYRA_5: return 20;
683
      case MEGA_5: return 35;
684
      case DIAM_2: return 10;
685
      case DIAM_3: return 18;
686
      case REDI_3: return 14;
687
      case HELI_3: return 18;
688
      case SKEW_3: return 17;
689
      case REX_3 : return 16;
690
      case MIRR_3: return 16;
691
      default    : return object.getNumScramble();
692
      }
693
    }
694

  
695 666
///////////////////////////////////////////////////////////////////////////////////////////////////
696 667

  
697 668
  public int getLevel()
......
708 679

  
709 680
///////////////////////////////////////////////////////////////////////////////////////////////////
710 681

  
711
  public ObjectType getObject()
682
  public int getObject()
712 683
    {
713 684
    return mObject;
714 685
    }
src/main/java/org/distorted/screens/RubikScreenSolver.java
35 35

  
36 36
import org.distorted.objectlib.main.ObjectControl;
37 37
import org.distorted.objectlib.main.TwistyObject;
38
import org.distorted.objectlib.main.ObjectType;
39 38

  
40 39
import org.distorted.dialogs.RubikDialogSolverError;
41 40
import org.distorted.helpers.TransparentImageButton;
......
83 82
    mWeakAct = new WeakReference<>(act);
84 83
    mSolving = false;
85 84

  
86
    ObjectType currentObject= ImplementedSolversList.getObject(0);
85
    int currentObject= ImplementedSolversList.getObject(0);
87 86
    act.changeIfDifferent(currentObject,control);
88 87
    control.solveOnly();
89 88

  
src/main/java/org/distorted/screens/RubikScreenSolving.java
34 34
import org.distorted.main.R;
35 35
import org.distorted.main.RubikActivity;
36 36
import org.distorted.network.RubikScores;
37
import org.distorted.objectlib.main.ObjectType;
38 37

  
39 38
///////////////////////////////////////////////////////////////////////////////////////////////////
40 39

  
......
186 185
      mElapsed = System.currentTimeMillis()-mStartTime;
187 186

  
188 187
      RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
189
      ObjectType object = play.getObject();
188
      int object = play.getObject();
190 189
      int level = play.getLevel();
191
      boolean isNew = mScores.setRecord(object.ordinal(), level, mElapsed);
190
      boolean isNew = mScores.setRecord(object, level, mElapsed);
192 191

  
193 192
      return isNew ? mElapsed : -mElapsed;
194 193
      }
src/main/java/org/distorted/solvers/ImplementedSolversList.java
19 19

  
20 20
package org.distorted.solvers;
21 21

  
22
import org.distorted.objectlib.main.ObjectType;
22
import org.distorted.objectlib.main.ObjectConstants;
23 23

  
24 24
///////////////////////////////////////////////////////////////////////////////////////////////////
25 25

  
26 26
public enum ImplementedSolversList
27 27
{
28
  CUBE3 ( ObjectType.CUBE_3),
28
  CUBE3 (ObjectConstants.CUBE_3),
29 29
  ;
30 30

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

  
33
  private final ObjectType mObject;
33
  private final int mObject;
34 34

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

  
......
47 47

  
48 48
///////////////////////////////////////////////////////////////////////////////////////////////////
49 49

  
50
  public static ObjectType getObject(int ordinal)
50
  public static int getObject(int ordinal)
51 51
    {
52 52
    return objects[ordinal].mObject;
53 53
    }
54 54

  
55 55
///////////////////////////////////////////////////////////////////////////////////////////////////
56 56

  
57
  ImplementedSolversList(ObjectType object)
57
  ImplementedSolversList(int object)
58 58
    {
59 59
    mObject= object;
60 60
    }
src/main/java/org/distorted/solvers/SolverMain.java
21 21

  
22 22
import android.content.res.Resources;
23 23

  
24
import org.distorted.objectlib.main.ObjectType;
24
import org.distorted.objectlib.main.ObjectConstants;
25 25
import org.distorted.objectlib.main.TwistyObject;
26 26

  
27 27
import org.distorted.main.R;
......
34 34
{
35 35
  private final Resources mRes;
36 36
  private final TwistyObject mObject;
37
  private final int mOrdinal;
37 38

  
38 39
///////////////////////////////////////////////////////////////////////////////////////////////////
39 40

  
......
41 42
    {
42 43
    mRes   = res;
43 44
    mObject= object;
45
    mOrdinal = object.getObjectType().ordinal();
44 46
    }
45 47

  
46 48
///////////////////////////////////////////////////////////////////////////////////////////////////
......
49 51
// If a certain cubit is locked, return the color (index into it's FACE_COLORS array) it
50 52
// must have. Otherwise return -1.
51 53

  
52
  public static int cubitIsLocked(ObjectType object, int cubit)
54
  public static int cubitIsLocked(int object, int cubit)
53 55
    {
54
    if( object == ObjectType.CUBE_3 )
56
    if( object == ObjectConstants.CUBE_3 )
55 57
      {
56 58
      if( cubit==20 ) return 0; // center of the right  face
57 59
      if( cubit==21 ) return 1; // center of the left   face
......
209 211
    {
210 212
    RubikScreenSolver solver = (RubikScreenSolver) ScreenList.SVER.getScreenClass();
211 213

  
212
    if( mObject!=null && mObject.getObjectType()==ObjectType.CUBE_3 )
214
    if( mOrdinal==ObjectConstants.CUBE_3 )
213 215
      {
214 216
      solveCube3(solver);
215 217
      }
src/main/java/org/distorted/tutorials/TutorialActivity.java
39 39
import org.distorted.library.main.DistortedLibrary;
40 40

  
41 41
import org.distorted.objectlib.main.ObjectControl;
42
import org.distorted.objectlib.main.ObjectType;
43 42

  
44 43
import org.distorted.main.R;
45 44
import org.distorted.dialogs.RubikDialogError;
45
import org.distorted.objects.RubikObjectList;
46 46

  
47 47
///////////////////////////////////////////////////////////////////////////////////////////////////
48 48

  
......
197 197

  
198 198
      if( mWebView!=null ) mWebView.onResume();
199 199

  
200
      if( mObjectOrdinal>=0 && mObjectOrdinal< ObjectType.NUM_OBJECTS )
200
      if( mObjectOrdinal>=0 && mObjectOrdinal< RubikObjectList.getNumObjects() )
201 201
        {
202
        ObjectType obj = ObjectType.getObject(mObjectOrdinal);
203
        changeIfDifferent(obj,view.getObjectControl());
202
        changeIfDifferent(mObjectOrdinal,view.getObjectControl());
204 203
        }
205 204
      }
206 205

  
......
223 222

  
224 223
///////////////////////////////////////////////////////////////////////////////////////////////////
225 224

  
226
    private void changeIfDifferent(ObjectType type,ObjectControl control)
225
    private void changeIfDifferent(int objectOrdinal,ObjectControl control)
227 226
      {
228
      InputStream jsonStream = ObjectJson.getStream(type,this);
229
      InputStream meshStream = ObjectMesh.getStream(type,this);
230
      control.changeIfDifferent(type.ordinal(),jsonStream,meshStream);
227
      InputStream jsonStream = ObjectJson.getStream(this,objectOrdinal);
228
      InputStream meshStream = ObjectMesh.getStream(this,objectOrdinal);
229
      control.changeIfDifferent(objectOrdinal,jsonStream,meshStream);
231 230
      }
232 231

  
233 232
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/tutorials/TutorialList.java
19 19

  
20 20
package org.distorted.tutorials;
21 21

  
22
import org.distorted.objectlib.main.ObjectType;
23 22
import org.distorted.main.RubikActivity;
23
import org.distorted.objectlib.main.ObjectConstants;
24
import org.distorted.objects.RubikObject;
25
import org.distorted.objects.RubikObjectList;
24 26

  
25 27
///////////////////////////////////////////////////////////////////////////////////////////////////
26 28

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

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

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

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

  
86
  CUBE6 ( ObjectType.CUBE_6,
88
  CUBE6 ( ObjectConstants.CUBE_6,
87 89
          new String[][] {
88 90
                          {"gb","SkZ9UadAOvQ","How to Solve the 6x6 Rubik's Cube","JPerm"},
89 91
                          {"es","9X-mW6wbnQQ","Resolver cubo de Rubik 6x6","Cuby"},
......
95 97
                         }
96 98
        ),
97 99

  
98
  CUBE7 ( ObjectType.CUBE_7,
100
  CUBE7 ( ObjectConstants.CUBE_7,
99 101
          new String[][] {
100 102
                          {"gb","xpI7jKs4bWQ","7x7 Centers (1/2)","CubeSkills"},
101 103
                          {"gb","xpI7jKs4bWQ","7x7 Edges & 3x3 Stage (2/2)","CubeSkills"},
......
108 110
                         }
109 111
        ),
110 112

  
111
  MIRR2 ( ObjectType.MIRR_2,
113
  MIRR2 ( ObjectConstants.MIRR_2,
112 114
          new String[][] {
113 115
                          {"gb","rSH-ZEqTmxs","Solve 2x2 Mirror Blocks","King of Cubing"},
114 116
                          {"es","Ipz-Ajpd4Fg","Como resolver el mirror 2x2","RUBI CUBI"},
......
119 121
                         }
120 122
       ),
121 123

  
122
  MIRR3 ( ObjectType.MIRR_3,
124
  MIRR3 ( ObjectConstants.MIRR_3,
123 125
          new String[][] {
124 126
                          {"gb","YkzXIWnqbSw","How to Solve the Mirror Cube","Z3"},
125 127
                          {"es","ZTkunMo51l0","Resolver cubo de Rubik MIRROR","Cuby"},
......
131 133
                         }
132 134
       ),
133 135

  
134
  JING  ( ObjectType.JING_2,
136
  JING  ( ObjectConstants.JING_2,
135 137
          new String[][] {
136 138
                          {"gb","0T8Iw6aI2gA","Jing's Pyraminx Tutorial","SuperAntoniovivaldi"},
137 139
                          {"es","Na27_GUIzqY","Resolver Jing Pyraminx","Cuby"},
......
142 144
                         }
143 145
        ),
144 146

  
145
  PYRA3 ( ObjectType.PYRA_3,
147
  PYRA3 ( ObjectConstants.PYRA_3,
146 148
          new String[][] {
147 149
                          {"gb","xIQtn2qazvg","Pyraminx Layer By Layer","Z3"},
148 150
                          {"es","4cJJe9RAzAU","Resolver Pyraminx","Cuby"},
......
155 157
                         }
156 158
        ),
157 159

  
158
  PYRA4 ( ObjectType.PYRA_4,
160
  PYRA4 ( ObjectConstants.PYRA_4,
159 161
          new String[][] {
160 162
                          {"gb","tGQDqDcSa6U","How to Solve the Master Pyraminx","Z3"},
161 163
                          {"es","74PIPm9-uPg","Resolver Master Pyraminx 4x4","Cuby"},
......
167 169
                         }
168 170
        ),
169 171

  
170
  PYRA5 ( ObjectType.PYRA_5,
172
  PYRA5 ( ObjectConstants.PYRA_5,
171 173
          new String[][] {
172 174
                          {"gb","2nsPEECDdN0","Professor Pyraminx Solve","RedKB"},
173 175
                          {"es","cSDj8OQK3TU","Tutorial del Professor Pyraminx","QBAndo"},
......
177 179
                         }
178 180
        ),
179 181

  
180
  KILO3( ObjectType.KILO_3,
182
  KILO3( ObjectConstants.KILO_3,
181 183
          new String[][] {
182 184
                          {"gb","grgGgUSxiQg","How to Solve the Kilominx","Z3"},
183 185
                          {"es","g6WMYjkCLok","Resolver Kilominx","Cuby"},
......
189 191
                         }
190 192
       ),
191 193

  
192
  KILO5( ObjectType.KILO_5,
194
  KILO5( ObjectConstants.KILO_5,
193 195
          new String[][] {
194 196
                          {"gb","VAnzC2SYVc4","How To Solve A Master Kilominx","Grizz Media"},
195 197
                          {"es","ozINTg-61Fs","Tutorial Master Kilominx","RubikArt"},
......
204 206
                         }
205 207
       ),
206 208

  
207
  MEGA3( ObjectType.MEGA_3,
209
  MEGA3( ObjectConstants.MEGA_3,
208 210
          new String[][] {
209 211
                          {"gb","j4x61L5Onzk","How to Solve the Megaminx","Z3"},
210 212
                          {"es","xuKbT6Il0Ko","Resolver Megaminx","Cuby"},
......
216 218
                         }
217 219
       ),
218 220

  
219
  MEGA5( ObjectType.MEGA_5,
221
  MEGA5( ObjectConstants.MEGA_5,
220 222
          new String[][] {
221 223
                          {"gb","MNBMm8BnHtQ","Solve the Gigaminx Part 1","BeardedCubing"},
222 224
                          {"gb","QrrP4GwqVMw","Solve the Gigaminx Part 2","BeardedCubing"},
......
234 236
                         }
235 237
       ),
236 238

  
237
  ULTI ( ObjectType.ULTI_2,
239
  ULTI ( ObjectConstants.ULTI_2,
238 240
          new String[][] {
239 241
                          {"gb","n1ikPKZxGEo","Ultimate Skewb Tutorial","BeardedCubing"},
240 242
                          {"es","wNL1WJ_sCfs","Resolver Skewb ULTIMATE","Cuby"},
......
246 248
                         }
247 249
        ),
248 250

  
249
  DIAM2 ( ObjectType.DIAM_2,
251
  DIAM2 ( ObjectConstants.DIAM_2,
250 252
          new String[][] {
251 253
                          {"gb","R2wrbJJ3izM","How to Solve a Skewb Diamond","Dr. Penguin^3"},
252 254
                          {"es","2RCusYQdYYE","Como resolver Skewb Diamond","Tutoriales Rubik"},
......
258 260
                         }
259 261
       ),
260 262

  
261
  DIAM3 ( ObjectType.DIAM_3,
263
  DIAM3 ( ObjectConstants.DIAM_3,
262 264
          new String[][] {
263 265
                          {"gb","n_mBSUDLUZw","Face Turning Octahedron Tutorial","SuperAntoniovivaldi"},
264 266
                          {"es","ogf0t6fGxZI","FTO - Tutorial en español","Gadi Rubik"},
......
268 270
                         }
269 271
       ),
270 272

  
271
  DIAM4 ( ObjectType.DIAM_4,
273
  DIAM4 ( ObjectConstants.DIAM_4,
272 274
          new String[][] {
273 275
                          {"gb","3GJkySk5zeQ","Master Face Turning Octahedron","SuperAntoniovivaldi"},
274 276
                          {"gb","zW_1htxy52k","Master FTO Tutorial","Michele Regano"},
......
277 279
                         }
278 280
       ),
279 281

  
280
  DINO3 ( ObjectType.DINO_3,
282
  DINO3 ( ObjectConstants.DINO_3,
281 283
          new String[][] {
282 284
                          {"gb","puTJZqFBQwo","Dino Skewb Cube Tutorial","Bearded Cubing"},
283 285
                          {"es","6o1Yo5iCxvI","Resolver Cubo Dino","Cuby"},
......
289 291
                         }
290 292
        ),
291 293

  
292
  REDI3 ( ObjectType.REDI_3,
294
  REDI3 ( ObjectConstants.REDI_3,
293 295
          new String[][] {
294 296
                          {"gb","Qn7TJED6O-4","How to Solve the MoYu Redi Cube","Z3"},
295 297
                          {"es","g0M38Aotgac","Resolver Redi Cube","Cuby"},
......
301 303
                         }
302 304
        ),
303 305

  
304
  HELI3 ( ObjectType.HELI_3,
306
  HELI3 ( ObjectConstants.HELI_3,
305 307
          new String[][] {
306 308
                          {"gb","-suwJpd_PO8","Helicopter Cube Tutorial","Bearded Cubing"},
307 309
                          {"es","DWG9n_YyGPA","Resolver Helicopter Cube","Cuby"},
......
313 315
                         }
314 316
        ),
315 317

  
316
  SKEW2 ( ObjectType.SKEW_2,
318
  SKEW2 ( ObjectConstants.SKEW_2,
317 319
          new String[][] {
318 320
                          {"gb","I6132yshkeU","How to Solve the Skewb","Z3"},
319 321
                          {"es","wxQX3HhPgds","Resolver Skewb (Principiantes)","Cuby"},
......
326 328
                         }
327 329
        ),
328 330

  
329
  SKEW3 ( ObjectType.SKEW_3,
331
  SKEW3 ( ObjectConstants.SKEW_3,
330 332
          new String[][] {
331 333
                          {"gb","Jiuf7zQyPYI","Master Skewb Cube Tutorial","Bearded Cubing"},
332 334
                          {"es","8TP6p63KQCA","Master Skewb en Español","jorlozCubes"},
......
341 343
                         }
342 344
        ),
343 345

  
344
  IVY2 ( ObjectType.IVY_2,
346
  IVY2 ( ObjectConstants.IVY_2,
345 347
          new String[][] {
346 348
                          {"gb","QMzeJobSu1M","How to Solve the Ivy Cube","Z3"},
347 349
                          {"es","2-Gf2cmEJDs","Resolver Ivy Cube","Cuby"},
......
353 355
                         }
354 356
        ),
355 357

  
356
  REX3 ( ObjectType.REX_3,
358
  REX3 ( ObjectConstants.REX_3,
357 359
          new String[][] {
358 360
                          {"gb","noAQfWqlMbk","Rex Cube Tutorial","CrazyBadCuber"},
359 361
                          {"es","Q90x9rjLJzw","Resolver Cubo Rex","Cuby"},
......
365 367
                         }
366 368
        ),
367 369

  
368
  BAN1( ObjectType.BAN1_3,
370
  BAN1( ObjectConstants.BAN1_3,
369 371
          new String[][] {
370 372
                          {"gb","F_iJk_IvpVo","Bandaged Cube","CanChrisSolve"},
371 373
                          {"es","_lTgw5aEFOg","Tutorial 3x3 Fuse Cube","QBAndo"},
......
376 378
                         }
377 379
       ),
378 380

  
379
  BAN2( ObjectType.BAN2_3,
381
  BAN2( ObjectConstants.BAN2_3,
380 382
          new String[][] {
381 383
                          {"ru","lS_EK0PMWI8","Как собрать 2-bar Cube","Алексей Ярыгин"},
382 384
                          {"pl","tX8ubTLh6p8","Bandaged 3x3 (Two bar)","MrUK"},
......
384 386
                         }
385 387
       ),
386 388

  
387
  BAN3( ObjectType.BAN3_3,
389
  BAN3( ObjectConstants.BAN3_3,
388 390
          new String[][] {
389 391
                          {"gb","7UiCVGygUT4","Bandage Cube C Tutorial","PolyakB"},
390 392
                          {"ru","gXenRA92Wdc","Как собрать Bandaged 3x3 Type C","YG Cuber"},
......
393 395
                         }
394 396
       ),
395 397

  
396
  BAN4( ObjectType.BAN4_3,
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff