Revision 318c0a7d
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/screens/RubikScreenPlay.java | ||
---|---|---|
35 | 35 |
import android.widget.PopupWindow; |
36 | 36 |
import android.widget.ScrollView; |
37 | 37 |
|
38 |
import org.distorted.objectlib.main.ObjectList;
|
|
38 |
import org.distorted.objectlib.main.ObjectType;
|
|
39 | 39 |
|
40 | 40 |
import org.distorted.main.R; |
41 | 41 |
import org.distorted.main.RubikActivity; |
... | ... | |
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_3.ordinal();
|
|
56 |
public static final int DEF_OBJECT= ObjectType.CUBE_3.ordinal();
|
|
57 | 57 |
|
58 | 58 |
private static final int[] BUTTON_LABELS = { R.string.scores, |
59 | 59 |
R.string.patterns, |
... | ... | |
96 | 96 |
mButtonSize = width*RubikActivity.BUTTON_TEXT_SIZE; |
97 | 97 |
mMenuItemSize = width*RubikActivity.MENU_ITEM_SIZE; |
98 | 98 |
|
99 |
mRowCount = ObjectList.getRowCount();
|
|
100 |
mColCount = ObjectList.getColumnCount();
|
|
99 |
mRowCount = ObjectType.getRowCount();
|
|
100 |
mColCount = ObjectType.getColumnCount();
|
|
101 | 101 |
|
102 | 102 |
// TOP //////////////////////////// |
103 | 103 |
LinearLayout layoutTop = act.findViewById(R.id.upperBar); |
... | ... | |
162 | 162 |
{ |
163 | 163 |
View popupView = mPlayPopup.getContentView(); |
164 | 164 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS); |
165 |
final int dbLevel = ObjectList.getDBLevel(mObject);
|
|
165 |
final int dbLevel = ObjectType.getDBLevel(mObject);
|
|
166 | 166 |
final int levelsShown = Math.min(dbLevel,LEVELS_SHOWN); |
167 | 167 |
final int popupHeight = (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f)); |
168 | 168 |
final int realHeight = Math.min(popupHeight,maxHeight); |
... | ... | |
222 | 222 |
mObjectPopup.setContentView(objectGrid); |
223 | 223 |
} |
224 | 224 |
|
225 |
int[] indices = ObjectList.getIndices();
|
|
225 |
int[] indices = ObjectType.getIndices();
|
|
226 | 226 |
|
227 | 227 |
GridLayout.Spec[] rowSpecs = new GridLayout.Spec[mRowCount]; |
228 | 228 |
GridLayout.Spec[] colSpecs = new GridLayout.Spec[mColCount]; |
... | ... | |
242 | 242 |
colSpecs[col] = GridLayout.spec(col); |
243 | 243 |
} |
244 | 244 |
|
245 |
for(int object=0; object< ObjectList.NUM_OBJECTS; object++)
|
|
245 |
for(int object = 0; object< ObjectType.NUM_OBJECTS; object++)
|
|
246 | 246 |
{ |
247 |
final ObjectList list = ObjectList.getObject(object);
|
|
247 |
final ObjectType list = ObjectType.getObject(object);
|
|
248 | 248 |
int iconSize = RubikActivity.getDrawableSize(); |
249 | 249 |
int icons = list.getIconID(iconSize); |
250 | 250 |
final int obj = object; |
... | ... | |
430 | 430 |
public void restorePreferences(SharedPreferences preferences) |
431 | 431 |
{ |
432 | 432 |
mObject= preferences.getInt("statePlay_object", DEF_OBJECT); |
433 |
int dbLevel = ObjectList.getDBLevel(mObject);
|
|
433 |
int dbLevel = ObjectType.getDBLevel(mObject);
|
|
434 | 434 |
|
435 | 435 |
// This means the app has been upgraded to a new version which swapped the |
436 | 436 |
// Object for a new one with larger sizeIndex and now getMaxLevel() returns |
... | ... | |
441 | 441 |
|
442 | 442 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
443 | 443 |
|
444 |
public boolean setObject(RubikActivity act, ObjectList obj)
|
|
444 |
public boolean setObject(RubikActivity act, ObjectType obj)
|
|
445 | 445 |
{ |
446 | 446 |
if( mObject!=obj.ordinal() ) |
447 | 447 |
{ |
... | ... | |
494 | 494 |
|
495 | 495 |
private void adjustLevels(final RubikActivity act) |
496 | 496 |
{ |
497 |
int dbLevel = ObjectList.getDBLevel(mObject);
|
|
498 |
int numScrambles = ObjectList.getNumScramble(mObject);
|
|
497 |
int dbLevel = ObjectType.getDBLevel(mObject);
|
|
498 |
int numScrambles = ObjectType.getNumScramble(mObject);
|
|
499 | 499 |
int numLevel = Math.min(dbLevel, LEVELS_SHOWN); |
500 | 500 |
String[] levels = new String[numLevel]; |
501 | 501 |
|
Also available in: Unified diff
Reename ObjectList to a more logical ObjectType.