Project

General

Profile

« Previous | Next » 

Revision a8c8b933

Added by Leszek Koltunski over 5 years ago

Save the Settings across screen rotations.

View differences:

src/main/java/org/distorted/magic/RubikActivity.java
54 54
      setContentView(R.layout.layout);
55 55
      markButton(mSize);
56 56

  
57
      onComplete(10, 10, 1, 1);
57
      if( savedState==null )
58
        {
59
        onComplete(10,10,1,1);
60
        }
58 61
      }
59 62

  
60 63
///////////////////////////////////////////////////////////////////////////////////////////////////
......
87 90
      super.onDestroy();
88 91
      }
89 92

  
93
///////////////////////////////////////////////////////////////////////////////////////////////////
94

  
95
    @Override
96
    public void onSaveInstanceState(Bundle savedInstanceState)
97
      {
98
      super.onSaveInstanceState(savedInstanceState);
99

  
100
      savedInstanceState.putInt("appearPos"    , mAppearPos    );
101
      savedInstanceState.putInt("disappearPos" , mDisappearPos );
102
      savedInstanceState.putInt("appearType"   , mAppearType   );
103
      savedInstanceState.putInt("disappearType", mDisappearType);
104
      }
105

  
106
///////////////////////////////////////////////////////////////////////////////////////////////////
107

  
108
    @Override
109
    public void onRestoreInstanceState(Bundle savedInstanceState)
110
      {
111
      super.onRestoreInstanceState(savedInstanceState);
112

  
113
      mAppearPos     = savedInstanceState.getInt("appearPos"    );
114
      mDisappearPos  = savedInstanceState.getInt("disappearPos" );
115
      mAppearType    = savedInstanceState.getInt("appearType"   );
116
      mDisappearType = savedInstanceState.getInt("disappearType");
117
      }
118

  
90 119
///////////////////////////////////////////////////////////////////////////////////////////////////
91 120

  
92 121
    static int getSize()

Also available in: Unified diff