Project

General

Profile

« Previous | Next » 

Revision 69b66386

Added by Leszek Koltunski over 2 years ago

Mark the 'Free Play' with green or red dot.

View differences:

src/main/java/org/distorted/objects/RubikObjectList.java
415 415
    return mObject;
416 416
    }
417 417

  
418
///////////////////////////////////////////////////////////////////////////////////////////////////
419

  
420
  public static String getCurrentName()
421
    {
422
    RubikObject object = mObjects.get(mObject);
423
    return object==null ? "" : object.getUpperName();
424
    }
425

  
418 426
///////////////////////////////////////////////////////////////////////////////////////////////////
419 427

  
420 428
  public static RubikObject getObject(int ordinal)
src/main/java/org/distorted/screens/RubikScreenPlay.java
91 91
  private int mBottomHeight;
92 92
  private float mScreenWidth;
93 93
  private WeakReference<RubikActivity> mWeakAct;
94
  private String mObjectsPlayed;
94 95

  
95 96
///////////////////////////////////////////////////////////////////////////////////////////////////
96 97

  
......
492 493
  public void savePreferences(SharedPreferences.Editor editor)
493 494
    {
494 495
    editor.putInt("play_LevelValue", mLevelValue );
496
    editor.putString("play_objectsPlayed", mObjectsPlayed );
495 497

  
496 498
    if( mObjectPopup!=null )
497 499
      {
......
512 514
      }
513 515
    }
514 516

  
517
///////////////////////////////////////////////////////////////////////////////////////////////////
518

  
519
  private void addToPlayedObjects()
520
    {
521
    String name = RubikObjectList.getCurrentName();
522
    if( !mObjectsPlayed.contains(name) ) mObjectsPlayed += (" "+name);
523
    }
524

  
525
///////////////////////////////////////////////////////////////////////////////////////////////////
526

  
527
  private boolean hasBeenPlayed()
528
    {
529
    String name = RubikObjectList.getCurrentName();
530
    return mObjectsPlayed.contains(name);
531
    }
532

  
515 533
///////////////////////////////////////////////////////////////////////////////////////////////////
516 534

  
517 535
  public void restorePreferences(SharedPreferences preferences)
518 536
    {
519
    mLevelValue = preferences.getInt("play_LevelValue", 0);
537
    mLevelValue    = preferences.getInt("play_LevelValue", 0);
538
    mObjectsPlayed = preferences.getString("play_objectsPlayed", "");
520 539
    }
521 540

  
522 541
///////////////////////////////////////////////////////////////////////////////////////////////////
......
586 605
        {
587 606
        int level = i<numLevel-1 ? i : dbLevel;
588 607
        Button button = (Button)mPlayLayout.getChildAt(i);
589
        int icon = scores.isSolved(currObject, level-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
608
        boolean isSolved = i>0 ? scores.isSolved(currObject, level-1) : hasBeenPlayed();
609
        int icon = isSolved ? R.drawable.ui_solved : R.drawable.ui_notsolved;
590 610
        button.setCompoundDrawablesWithIntrinsicBounds(icon,0,0,0);
591 611
        }
592 612
      }
......
650 670
              mShouldReactToEndOfScrambling = true;
651 671
              control.scrambleObject(scrambles);
652 672
              }
653
             else
673
            else
654 674
              {
675
              addToPlayedObjects();
655 676
              ScreenList.switchScreen(act, ScreenList.FREE);
656 677
              }
657 678
            }

Also available in: Unified diff