Revision 34747dd1
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/magic/RubikActivity.java | ||
---|---|---|
37 | 37 |
private static final int SMALLEST_SIZE = 2; |
38 | 38 |
private static final int[] button_ids = {R.id.rubikSize2, R.id.rubikSize3, R.id.rubikSize4}; |
39 | 39 |
|
40 |
static int mSize = DEFAULT_SIZE; |
|
41 |
|
|
40 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 43 |
|
42 | 44 |
@Override |
43 |
protected void onCreate(Bundle icicle)
|
|
45 |
protected void onCreate(Bundle savedState)
|
|
44 | 46 |
{ |
45 |
super.onCreate(icicle);
|
|
47 |
super.onCreate(savedState);
|
|
46 | 48 |
setContentView(R.layout.layout); |
47 | 49 |
|
48 |
markButton(DEFAULT_SIZE); |
|
50 |
if( savedState==null ) |
|
51 |
{ |
|
52 |
markButton(DEFAULT_SIZE); |
|
53 |
} |
|
49 | 54 |
} |
50 | 55 |
|
51 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
78 | 83 |
super.onDestroy(); |
79 | 84 |
} |
80 | 85 |
|
86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
87 |
|
|
88 |
@Override |
|
89 |
public void onSaveInstanceState(Bundle savedInstanceState) |
|
90 |
{ |
|
91 |
super.onSaveInstanceState(savedInstanceState); |
|
92 |
savedInstanceState.putInt("size", mSize ); |
|
93 |
} |
|
94 |
|
|
95 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
96 |
|
|
97 |
@Override |
|
98 |
public void onRestoreInstanceState(Bundle savedInstanceState) |
|
99 |
{ |
|
100 |
super.onRestoreInstanceState(savedInstanceState); |
|
101 |
|
|
102 |
int size = savedInstanceState.getInt("size"); |
|
103 |
markButton(size); |
|
104 |
} |
|
105 |
|
|
106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
107 |
|
|
108 |
static int getSize() |
|
109 |
{ |
|
110 |
return mSize; |
|
111 |
} |
|
112 |
|
|
81 | 113 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
82 | 114 |
|
83 | 115 |
public void Scramble(View v) |
... | ... | |
119 | 151 |
|
120 | 152 |
private void markButton(int size) |
121 | 153 |
{ |
154 |
mSize = size; |
|
155 |
|
|
122 | 156 |
for(int b=0; b<button_ids.length; b++) |
123 | 157 |
{ |
124 | 158 |
Drawable d = findViewById(button_ids[b]).getBackground(); |
Also available in: Unified diff
Major progress with DistortedCube:
- split transition effect into separate 'appear' and 'disappear' effects
- apply the 'appear' effects to a new cube being displayed at the start of the app
- remember cube size across activity restarts