Revision 1cbcc6bf
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/magic/RubikActivity.java | ||
---|---|---|
41 | 41 |
private static final int SMALLEST_SIZE = 2; |
42 | 42 |
private static final int[] button_ids = {R.id.rubikSize2, R.id.rubikSize3, R.id.rubikSize4}; |
43 | 43 |
|
44 |
private static final int DEFAULT_APPEAR_POS = 10;
|
|
45 |
private static final int DEFAULT_DISAPPEAR_POS = 10;
|
|
46 |
private static final int DEFAULT_APPEAR_TYPE = 1;
|
|
47 |
private static final int DEFAULT_DISAPPEAR_TYPE = 1;
|
|
44 |
public static final int DEFAULT_APPEAR_POS = 10;
|
|
45 |
public static final int DEFAULT_DISAPPEAR_POS = 10;
|
|
46 |
public static final int DEFAULT_APPEAR_TYPE = 1;
|
|
47 |
public static final int DEFAULT_DISAPPEAR_TYPE = 1;
|
|
48 | 48 |
|
49 | 49 |
private static int mSize = DEFAULT_SIZE; |
50 | 50 |
|
... | ... | |
58 | 58 |
{ |
59 | 59 |
super.onCreate(savedState); |
60 | 60 |
setTheme(R.style.CustomActivityThemeNoActionBar); |
61 |
setContentView(R.layout.layout);
|
|
61 |
setContentView(R.layout.main);
|
|
62 | 62 |
markButton(mSize); |
63 | 63 |
|
64 | 64 |
restorePreferences(); |
... | ... | |
103 | 103 |
return mSize; |
104 | 104 |
} |
105 | 105 |
|
106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
107 |
|
|
108 |
public void Scramble(View v) |
|
109 |
{ |
|
110 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
111 |
view.getRenderer().scrambleCube(); |
|
112 |
} |
|
113 |
|
|
114 | 106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
115 | 107 |
|
116 | 108 |
public void Settings(View v) |
... | ... | |
127 | 119 |
settings.show(getSupportFragmentManager(), null); |
128 | 120 |
} |
129 | 121 |
|
122 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
123 |
|
|
124 |
public void Credits(View v) |
|
125 |
{ |
|
126 |
RubikCredits credits = new RubikCredits(); |
|
127 |
credits.show(getSupportFragmentManager(), null); |
|
128 |
} |
|
129 |
|
|
130 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
131 |
|
|
132 |
public void Scramble(View v) |
|
133 |
{ |
|
134 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
135 |
view.getRenderer().scrambleCube(); |
|
136 |
} |
|
137 |
|
|
138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
139 |
|
|
140 |
public void Solve(View v) |
|
141 |
{ |
|
142 |
|
|
143 |
} |
|
144 |
|
|
130 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
131 | 146 |
|
132 | 147 |
public void onComplete(int aP, int dP, int aT, int dT) |
... | ... | |
216 | 231 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
217 | 232 |
RubikRenderer renderer = view.getRenderer(); |
218 | 233 |
|
219 |
renderer.setAppearDuration(mAppearPos*100 +1);
|
|
220 |
renderer.setDisappearDuration(mDisappearPos*100 +1);
|
|
234 |
renderer.setAppearDuration(translateDuration(mAppearPos)+1);
|
|
235 |
renderer.setDisappearDuration(translateDuration(mDisappearPos) +1);
|
|
221 | 236 |
renderer.setAppearType(AppearEffect.getType(mAppearType)); |
222 | 237 |
renderer.setDisappearType(DisappearEffect.getType(mDisappearType)); |
223 | 238 |
} |
239 |
|
|
240 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
241 |
|
|
242 |
public static int translateDuration(int pos) |
|
243 |
{ |
|
244 |
return (pos/2)*100; |
|
245 |
} |
|
224 | 246 |
} |
Also available in: Unified diff
Progress with Credits and Settings.