Revision 7b7d65ce
Added by Leszek Koltunski over 4 years ago
build.gradle | ||
---|---|---|
15 | 15 |
applicationId "org.distorted.magic" |
16 | 16 |
minSdkVersion 21 |
17 | 17 |
targetSdkVersion 29 |
18 |
versionCode 3
|
|
19 |
versionName "1.1.1"
|
|
18 |
versionCode 4
|
|
19 |
versionName "1.1.2"
|
|
20 | 20 |
} |
21 | 21 |
|
22 | 22 |
buildTypes { |
... | ... | |
35 | 35 |
|
36 | 36 |
dependencies { |
37 | 37 |
implementation fileTree(dir: 'libs', include: ['*.jar']) |
38 |
implementation 'com.google.firebase:firebase-analytics:17.3.0'
|
|
39 |
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta04'
|
|
38 |
implementation 'com.google.firebase:firebase-analytics:17.4.0'
|
|
39 |
implementation 'com.google.firebase:firebase-crashlytics:17.0.0' |
|
40 | 40 |
|
41 | 41 |
api project(':distorted-library') |
42 | 42 |
implementation 'androidx.appcompat:appcompat:1.1.0' |
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
112 | 112 |
RubikObjectList obj = RubikObjectList.getObject(RubikStatePlay.DEF_OBJECT); |
113 | 113 |
int s = RubikStatePlay.DEF_SIZE; |
114 | 114 |
|
115 |
play.setObjectAndSize(obj,s); |
|
115 |
play.setObjectAndSize(this,obj,s);
|
|
116 | 116 |
view.getPostRender().changeObject(obj,s); |
117 | 117 |
} |
118 | 118 |
} |
src/main/java/org/distorted/states/RubikStatePattern.java | ||
---|---|---|
66 | 66 |
RubikObjectList object = RubikPatternList.getObject(mPatternOrdinal); |
67 | 67 |
int size = RubikPatternList.getSize(mPatternOrdinal); |
68 | 68 |
|
69 |
if( !play.setObjectAndSize(object,size) ) |
|
69 |
if( !play.setObjectAndSize(act,object,size) )
|
|
70 | 70 |
{ |
71 | 71 |
int objectPlay= play.getObject(); |
72 | 72 |
int sizePlay = play.getSize(); |
src/main/java/org/distorted/states/RubikStatePlay.java | ||
---|---|---|
281 | 281 |
mObject = obj; |
282 | 282 |
mSize = sizes[size]; |
283 | 283 |
act.changeObject(list,sizes[size]); |
284 |
|
|
285 |
int sizeIndex = RubikObjectList.getSizeIndex(mObject,mSize); |
|
286 |
int maxLevel = RubikObjectList.getMaxLevel(mObject, sizeIndex); |
|
287 |
String[] levels = new String[maxLevel]; |
|
288 |
|
|
289 |
for(int i=0; i<maxLevel; i++) |
|
290 |
{ |
|
291 |
levels[i] = act.getString(R.string.lv_placeholder,i+1); |
|
292 |
} |
|
293 |
|
|
294 |
mSpinnerAdapter = new ArrayAdapter<>(act,android.R.layout.simple_spinner_item, levels); |
|
295 |
mSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
296 |
mLevelSpinner.setAdapter(mSpinnerAdapter); |
|
284 |
adjustSpinner(act); |
|
297 | 285 |
} |
298 | 286 |
|
299 | 287 |
mPopup.dismiss(); |
... | ... | |
337 | 325 |
|
338 | 326 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
339 | 327 |
|
340 |
public boolean setObjectAndSize(RubikObjectList obj, int size) |
|
328 |
public boolean setObjectAndSize(RubikActivity act, RubikObjectList obj, int size)
|
|
341 | 329 |
{ |
342 |
boolean success = false; |
|
330 |
if( mObject!=obj.ordinal() || mSize != size ) |
|
331 |
{ |
|
332 |
boolean success = false; |
|
343 | 333 |
|
344 |
for( int s: obj.getSizes() ) |
|
345 |
if( s==size ) |
|
334 |
for( int s: obj.getSizes() ) |
|
335 |
if( s==size ) |
|
336 |
{ |
|
337 |
success = true; |
|
338 |
break; |
|
339 |
} |
|
340 |
|
|
341 |
if( success ) |
|
346 | 342 |
{ |
347 |
success = true; |
|
348 |
break; |
|
343 |
mObject = obj.ordinal(); |
|
344 |
mSize = size; |
|
345 |
adjustSpinner(act); |
|
349 | 346 |
} |
350 | 347 |
|
351 |
if( success ) |
|
348 |
return success; |
|
349 |
} |
|
350 |
|
|
351 |
return true; |
|
352 |
} |
|
353 |
|
|
354 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
355 |
|
|
356 |
private void adjustSpinner(RubikActivity act) |
|
357 |
{ |
|
358 |
int sizeIndex = RubikObjectList.getSizeIndex(mObject,mSize); |
|
359 |
int maxLevel = RubikObjectList.getMaxLevel(mObject, sizeIndex); |
|
360 |
String[] levels = new String[maxLevel]; |
|
361 |
|
|
362 |
for(int i=0; i<maxLevel; i++) |
|
352 | 363 |
{ |
353 |
mObject = obj.ordinal(); |
|
354 |
mSize = size; |
|
364 |
levels[i] = act.getString(R.string.lv_placeholder,i+1); |
|
355 | 365 |
} |
356 | 366 |
|
357 |
return success; |
|
367 |
mSpinnerAdapter = new ArrayAdapter<>(act,android.R.layout.simple_spinner_item, levels); |
|
368 |
mSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
369 |
mLevelSpinner.setAdapter(mSpinnerAdapter); |
|
358 | 370 |
} |
359 | 371 |
|
360 | 372 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/states/RubikStateSolver.java | ||
---|---|---|
83 | 83 |
|
84 | 84 |
act.setupObject(mCurrentObject, mCurrentObjectSize, null); |
85 | 85 |
RubikStatePlay play = (RubikStatePlay)RubikState.PLAY.getStateClass(); |
86 |
play.setObjectAndSize(mCurrentObject, mCurrentObjectSize); |
|
86 |
play.setObjectAndSize(act, mCurrentObject, mCurrentObjectSize);
|
|
87 | 87 |
|
88 | 88 |
mFaceColors = RubikObjectList.retFaceColors(mCurrentObject); |
89 | 89 |
mNumFaces = mFaceColors!=null ? mFaceColors.length : 0; |
Also available in: Unified diff
- bump version to 1.1.2
- fix one crasher observed in the field ( we need to adjust the Levels Spinner in Play state if Object changed in Pattern or Solver states )