Revision 6142069a
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
61 | 61 |
public class RubikActivity extends AppCompatActivity |
62 | 62 |
{ |
63 | 63 |
public static final boolean SHOW_DOWNLOADED_DEBUG = false; |
64 |
public static final boolean SHOW_SOLVED_DEBUG = true; |
|
64 | 65 |
|
65 | 66 |
public static final float PADDING = 0.01f; |
66 | 67 |
public static final float SMALL_MARGIN = 0.004f; |
... | ... | |
253 | 254 |
DistortedLibrary.onResume(ACTIVITY_NUMBER); |
254 | 255 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
255 | 256 |
view.onResume(); |
256 |
restorePreferences(mJustStarted); |
|
257 | 257 |
|
258 |
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); |
|
259 |
restorePreferences(preferences,mJustStarted); |
|
258 | 260 |
ScreenList.setScreen(this); |
259 | 261 |
unblockEverything(); |
260 |
|
|
261 |
restoreMoves(); |
|
262 |
restoreMoves(preferences); |
|
262 | 263 |
|
263 | 264 |
if( mJustStarted ) |
264 | 265 |
{ |
... | ... | |
266 | 267 |
RubikScores scores = RubikScores.getInstance(); |
267 | 268 |
scores.incrementNumRuns(); |
268 | 269 |
scores.setCountry(this); |
269 |
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); |
|
270 | 270 |
RubikObjectList.restoreMeshState(preferences); |
271 | 271 |
} |
272 | 272 |
|
... | ... | |
345 | 345 |
|
346 | 346 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
347 | 347 |
|
348 |
private void restorePreferences(boolean justStarted) |
|
348 |
private void restorePreferences(SharedPreferences preferences, boolean justStarted)
|
|
349 | 349 |
{ |
350 |
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); |
|
351 |
|
|
352 | 350 |
mPolicyAccepted = preferences.getBoolean("policyAccepted", false); |
353 | 351 |
String oldVersion = preferences.getString("appVersion",""); |
354 | 352 |
|
... | ... | |
364 | 362 |
ScreenList.getScreen(i).getScreenClass().restorePreferences(preferences); |
365 | 363 |
} |
366 | 364 |
|
365 |
// this needs to be after the above ScreenList.restore as that restores the Records which we need here |
|
366 |
if( justStarted ) RubikObjectList.setObjectFreeState(); |
|
367 |
|
|
367 | 368 |
ScreenList.restorePreferences(preferences); |
368 | 369 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
369 | 370 |
|
... | ... | |
392 | 393 |
|
393 | 394 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
394 | 395 |
|
395 |
private void restoreMoves() |
|
396 |
private void restoreMoves(SharedPreferences preferences)
|
|
396 | 397 |
{ |
397 |
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); |
|
398 | 398 |
ScreenList curr = ScreenList.getCurrentScreen(); |
399 | 399 |
|
400 | 400 |
if( curr==ScreenList.PLAY ) |
Also available in: Unified diff
Progress with marking objects as free.