Revision a7012218
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/effect/AppearEffect.java | ||
---|---|---|
194 | 194 |
} |
195 | 195 |
catch(NoSuchMethodException ex) |
196 | 196 |
{ |
197 |
android.util.Log.e("transitionEffect", "exception getting method: "+ex.getMessage());
|
|
197 |
android.util.Log.e("AppearEffect", "exception getting method: "+ex.getMessage());
|
|
198 | 198 |
} |
199 | 199 |
|
200 | 200 |
try |
... | ... | |
203 | 203 |
} |
204 | 204 |
catch(Exception ex) |
205 | 205 |
{ |
206 |
android.util.Log.e("transitionEffect", "exception invoking method: "+ex.getMessage());
|
|
206 |
android.util.Log.e("AppearEffect", "exception invoking method: "+ex.getMessage());
|
|
207 | 207 |
} |
208 | 208 |
} |
209 | 209 |
} |
src/main/java/org/distorted/effect/DisappearEffect.java | ||
---|---|---|
197 | 197 |
} |
198 | 198 |
catch(NoSuchMethodException ex) |
199 | 199 |
{ |
200 |
android.util.Log.e("transitionEffect", "exception getting method: "+ex.getMessage());
|
|
200 |
android.util.Log.e("DisappearEffect", "exception getting method: "+ex.getMessage());
|
|
201 | 201 |
} |
202 | 202 |
|
203 | 203 |
try |
... | ... | |
206 | 206 |
} |
207 | 207 |
catch(Exception ex) |
208 | 208 |
{ |
209 |
android.util.Log.e("transitionEffect", "exception invoking method: "+ex.getMessage());
|
|
209 |
android.util.Log.e("DisappearEffect", "exception invoking method: "+ex.getMessage());
|
|
210 | 210 |
} |
211 | 211 |
} |
212 | 212 |
} |
src/main/java/org/distorted/effect/UnscrambleEffect.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2019 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Distorted. // |
|
5 |
// // |
|
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
7 |
// it under the terms of the GNU General Public License as published by // |
|
8 |
// the Free Software Foundation, either version 2 of the License, or // |
|
9 |
// (at your option) any later version. // |
|
10 |
// // |
|
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
14 |
// GNU General Public License for more details. // |
|
15 |
// // |
|
16 |
// You should have received a copy of the GNU General Public License // |
|
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.effect; |
|
21 |
|
|
22 |
import java.lang.reflect.Method; |
|
23 |
|
|
24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
25 |
|
|
26 |
public class UnscrambleEffect |
|
27 |
{ |
|
28 |
public enum Type |
|
29 |
{ |
|
30 |
NONE (UnscrambleEffectNone.class ), |
|
31 |
SPIN (UnscrambleEffectSpin.class ), |
|
32 |
; |
|
33 |
|
|
34 |
private final Class<? extends UnscrambleEffect> effectClass; |
|
35 |
|
|
36 |
Type(Class<? extends UnscrambleEffect> effectClass) |
|
37 |
{ |
|
38 |
this.effectClass = effectClass; |
|
39 |
} |
|
40 |
} |
|
41 |
|
|
42 |
public static final int NUM_EFFECTS = Type.values().length; |
|
43 |
private static final Type[] types; |
|
44 |
|
|
45 |
static |
|
46 |
{ |
|
47 |
int i=0; |
|
48 |
|
|
49 |
types = new Type[NUM_EFFECTS]; |
|
50 |
|
|
51 |
for(Type type: Type.values()) |
|
52 |
{ |
|
53 |
types[i] = type; |
|
54 |
i++; |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
59 |
|
|
60 |
public static UnscrambleEffect.Type getType(int ordinal) |
|
61 |
{ |
|
62 |
return types[ordinal]; |
|
63 |
} |
|
64 |
|
|
65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
66 |
|
|
67 |
public static UnscrambleEffect create(Type type) throws InstantiationException, IllegalAccessException |
|
68 |
{ |
|
69 |
return type.effectClass.newInstance(); |
|
70 |
} |
|
71 |
|
|
72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
73 |
|
|
74 |
public static void enableEffects() |
|
75 |
{ |
|
76 |
Method method=null; |
|
77 |
|
|
78 |
for(Type type: Type.values()) |
|
79 |
{ |
|
80 |
Class<? extends UnscrambleEffect> cls = type.effectClass; |
|
81 |
|
|
82 |
try |
|
83 |
{ |
|
84 |
method = cls.getMethod("enable"); |
|
85 |
} |
|
86 |
catch(NoSuchMethodException ex) |
|
87 |
{ |
|
88 |
android.util.Log.e("UnscrambleEffect", "exception getting method: "+ex.getMessage()); |
|
89 |
} |
|
90 |
|
|
91 |
try |
|
92 |
{ |
|
93 |
method.invoke(null); |
|
94 |
} |
|
95 |
catch(Exception ex) |
|
96 |
{ |
|
97 |
android.util.Log.e("UnscrambleEffect", "exception invoking method: "+ex.getMessage()); |
|
98 |
} |
|
99 |
} |
|
100 |
} |
|
101 |
} |
src/main/java/org/distorted/effect/UnscrambleEffectNone.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2019 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Distorted. // |
|
5 |
// // |
|
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
7 |
// it under the terms of the GNU General Public License as published by // |
|
8 |
// the Free Software Foundation, either version 2 of the License, or // |
|
9 |
// (at your option) any later version. // |
|
10 |
// // |
|
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
14 |
// GNU General Public License for more details. // |
|
15 |
// // |
|
16 |
// You should have received a copy of the GNU General Public License // |
|
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.effect; |
|
21 |
|
|
22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
23 |
|
|
24 |
public class UnscrambleEffectNone extends UnscrambleEffect |
|
25 |
{ |
|
26 |
|
|
27 |
} |
src/main/java/org/distorted/effect/UnscrambleEffectSpin.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2019 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Distorted. // |
|
5 |
// // |
|
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
7 |
// it under the terms of the GNU General Public License as published by // |
|
8 |
// the Free Software Foundation, either version 2 of the License, or // |
|
9 |
// (at your option) any later version. // |
|
10 |
// // |
|
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
14 |
// GNU General Public License for more details. // |
|
15 |
// // |
|
16 |
// You should have received a copy of the GNU General Public License // |
|
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.effect; |
|
21 |
|
|
22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
23 |
|
|
24 |
public class UnscrambleEffectSpin extends UnscrambleEffect |
|
25 |
{ |
|
26 |
|
|
27 |
} |
src/main/java/org/distorted/magic/RubikActivity.java | ||
---|---|---|
32 | 32 |
import org.distorted.component.HorizontalNumberPicker; |
33 | 33 |
import org.distorted.effect.AppearEffect; |
34 | 34 |
import org.distorted.effect.DisappearEffect; |
35 |
import org.distorted.effect.UnscrambleEffect; |
|
35 | 36 |
import org.distorted.library.main.DistortedLibrary; |
36 | 37 |
|
37 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
42 | 43 |
private static final int SMALLEST_SIZE = 2; |
43 | 44 |
private static final int[] button_ids = {R.id.rubikSize2, R.id.rubikSize3, R.id.rubikSize4}; |
44 | 45 |
|
45 |
public static final int DEFAULT_APPEAR_POS = 10; |
|
46 |
public static final int DEFAULT_DISAPPEAR_POS = 10; |
|
46 |
public static final int DEFAULT_APPEAR_POS = 20; |
|
47 |
public static final int DEFAULT_DISAPPEAR_POS = 20; |
|
48 |
public static final int DEFAULT_UNSCRAMBLE_POS = 20; |
|
47 | 49 |
public static final int DEFAULT_APPEAR_TYPE = 1; |
48 | 50 |
public static final int DEFAULT_DISAPPEAR_TYPE = 1; |
51 |
public static final int DEFAULT_UNSCRAMBLE_TYPE= 1; |
|
49 | 52 |
|
50 | 53 |
public static final int MIN_SCRAMBLE = 1; |
51 | 54 |
public static final int MAX_SCRAMBLE = 10; |
52 | 55 |
|
53 | 56 |
private static int mSize = DEFAULT_SIZE; |
54 | 57 |
|
55 |
private int mAppearPos, mDisappearPos; |
|
56 |
private int mAppearType, mDisappearType; |
|
58 |
private int mAppearPos, mDisappearPos, mUnscramblePos;
|
|
59 |
private int mAppearType, mDisappearType, mUnscrambleType;
|
|
57 | 60 |
|
58 | 61 |
private HorizontalNumberPicker mPicker; |
59 | 62 |
|
... | ... | |
119 | 122 |
{ |
120 | 123 |
Bundle args = new Bundle(); |
121 | 124 |
|
122 |
args.putInt("appearPos" , mAppearPos ); |
|
123 |
args.putInt("disappearPos" , mDisappearPos ); |
|
124 |
args.putInt("appearType" , mAppearType ); |
|
125 |
args.putInt("disappearType", mDisappearType); |
|
125 |
args.putInt("appearPos" , mAppearPos ); |
|
126 |
args.putInt("disappearPos" , mDisappearPos ); |
|
127 |
args.putInt("unscramblePos" , mUnscramblePos ); |
|
128 |
args.putInt("appearType" , mAppearType ); |
|
129 |
args.putInt("disappearType" , mDisappearType ); |
|
130 |
args.putInt("unscrambleType", mUnscrambleType); |
|
126 | 131 |
|
127 | 132 |
RubikSettings settings = new RubikSettings(); |
128 | 133 |
settings.setArguments(args); |
... | ... | |
157 | 162 |
|
158 | 163 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
159 | 164 |
|
160 |
public void onComplete(int aP, int dP, int aT, int dT)
|
|
165 |
public void onComplete(int aP, int dP, int uP, int aT, int dT, int uT )
|
|
161 | 166 |
{ |
162 |
mAppearPos = aP; |
|
163 |
mDisappearPos = dP; |
|
164 |
mAppearType = aT; |
|
165 |
mDisappearType= dT; |
|
167 |
mAppearPos = aP; |
|
168 |
mDisappearPos = dP; |
|
169 |
mUnscramblePos = uP; |
|
170 |
mAppearType = aT; |
|
171 |
mDisappearType = dT; |
|
172 |
mUnscrambleType= uT; |
|
166 | 173 |
|
167 | 174 |
applyPreferences(); |
168 | 175 |
} |
... | ... | |
217 | 224 |
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); |
218 | 225 |
SharedPreferences.Editor editor = preferences.edit(); |
219 | 226 |
|
220 |
editor.putInt("appearPos" , mAppearPos ); |
|
221 |
editor.putInt("disappearPos" , mDisappearPos ); |
|
222 |
editor.putInt("appearType" , mAppearType ); |
|
223 |
editor.putInt("disappearType", mDisappearType); |
|
227 |
editor.putInt("appearPos" , mAppearPos ); |
|
228 |
editor.putInt("disappearPos" , mDisappearPos ); |
|
229 |
editor.putInt("unscramblePos" , mUnscramblePos ); |
|
230 |
editor.putInt("appearType" , mAppearType ); |
|
231 |
editor.putInt("disappearType" , mDisappearType ); |
|
232 |
editor.putInt("unscrambleType", mUnscrambleType); |
|
224 | 233 |
editor.putInt("scramble" , mPicker.getValue() ); |
225 | 234 |
|
226 | 235 |
editor.apply(); |
... | ... | |
232 | 241 |
{ |
233 | 242 |
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); |
234 | 243 |
|
235 |
mAppearPos = preferences.getInt("appearPos" , DEFAULT_APPEAR_POS ); |
|
236 |
mDisappearPos = preferences.getInt("disappearPos" , DEFAULT_DISAPPEAR_POS ); |
|
237 |
mAppearType = preferences.getInt("appearType" , DEFAULT_APPEAR_TYPE ); |
|
238 |
mDisappearType = preferences.getInt("disappearType", DEFAULT_DISAPPEAR_TYPE); |
|
239 |
int scramble = preferences.getInt("scramble" , MIN_SCRAMBLE ); |
|
244 |
mAppearPos = preferences.getInt("appearPos" , DEFAULT_APPEAR_POS ); |
|
245 |
mDisappearPos = preferences.getInt("disappearPos" , DEFAULT_DISAPPEAR_POS ); |
|
246 |
mUnscramblePos = preferences.getInt("unscramblePos" , DEFAULT_UNSCRAMBLE_POS ); |
|
247 |
mAppearType = preferences.getInt("appearType" , DEFAULT_APPEAR_TYPE ); |
|
248 |
mDisappearType = preferences.getInt("disappearType" , DEFAULT_DISAPPEAR_TYPE ); |
|
249 |
mUnscrambleType= preferences.getInt("unscrambleType", DEFAULT_UNSCRAMBLE_TYPE); |
|
250 |
int scramble = preferences.getInt("scramble" , MIN_SCRAMBLE ); |
|
240 | 251 |
|
241 | 252 |
mPicker.setValue(scramble); |
242 | 253 |
} |
... | ... | |
250 | 261 |
|
251 | 262 |
renderer.setAppearDuration(translateDuration(mAppearPos)+1); |
252 | 263 |
renderer.setDisappearDuration(translateDuration(mDisappearPos) +1); |
264 |
renderer.setUnscrambleDuration(translateDuration(mUnscramblePos) +1); |
|
253 | 265 |
renderer.setAppearType(AppearEffect.getType(mAppearType)); |
254 | 266 |
renderer.setDisappearType(DisappearEffect.getType(mDisappearType)); |
267 |
renderer.setUnscrambleType(UnscrambleEffect.getType(mUnscrambleType)); |
|
255 | 268 |
} |
256 | 269 |
|
257 | 270 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/magic/RubikRenderer.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import org.distorted.effect.AppearEffect; |
25 | 25 |
import org.distorted.effect.DisappearEffect; |
26 |
import org.distorted.effect.UnscrambleEffect; |
|
26 | 27 |
import org.distorted.library.effect.VertexEffectSink; |
27 | 28 |
import org.distorted.library.main.DistortedEffects; |
28 | 29 |
import org.distorted.library.main.DistortedLibrary; |
... | ... | |
57 | 58 |
private MeshFlat mMesh; |
58 | 59 |
private AppearEffect.Type mAppearType; |
59 | 60 |
private DisappearEffect.Type mDisappearType; |
60 |
private int mAppearDuration, mDisappearDuration; |
|
61 |
private UnscrambleEffect.Type mUnscrambleType; |
|
62 |
private int mAppearDuration, mDisappearDuration, mUnscrambleDuration; |
|
61 | 63 |
|
62 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
63 | 65 |
|
... | ... | |
171 | 173 |
VertexEffectSink.enable(); |
172 | 174 |
AppearEffect.enableEffects(); |
173 | 175 |
DisappearEffect.enableEffects(); |
176 |
UnscrambleEffect.enableEffects(); |
|
174 | 177 |
|
175 | 178 |
try |
176 | 179 |
{ |
... | ... | |
265 | 268 |
mDisappearDuration = duration; |
266 | 269 |
} |
267 | 270 |
|
271 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
272 |
|
|
273 |
void setUnscrambleDuration(int duration) |
|
274 |
{ |
|
275 |
mUnscrambleDuration = duration; |
|
276 |
} |
|
277 |
|
|
268 | 278 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
269 | 279 |
|
270 | 280 |
void setAppearType(AppearEffect.Type type) |
... | ... | |
279 | 289 |
mDisappearType = type; |
280 | 290 |
} |
281 | 291 |
|
292 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
293 |
|
|
294 |
void setUnscrambleType(UnscrambleEffect.Type type) |
|
295 |
{ |
|
296 |
mUnscrambleType = type; |
|
297 |
} |
|
298 |
|
|
282 | 299 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
283 | 300 |
|
284 | 301 |
boolean createCube(int newSize) |
src/main/java/org/distorted/magic/RubikSettings.java | ||
---|---|---|
38 | 38 |
|
39 | 39 |
import org.distorted.effect.AppearEffect; |
40 | 40 |
import org.distorted.effect.DisappearEffect; |
41 |
import org.distorted.effect.UnscrambleEffect; |
|
41 | 42 |
|
42 | 43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
43 | 44 |
|
... | ... | |
45 | 46 |
{ |
46 | 47 |
public interface OnCompleteListener |
47 | 48 |
{ |
48 |
void onComplete(int aP, int dP, int aT, int dT);
|
|
49 |
void onComplete(int aP, int dP, int uP, int aT, int dT, int uT);
|
|
49 | 50 |
} |
50 | 51 |
|
51 | 52 |
private OnCompleteListener mListener; |
52 | 53 |
|
53 |
private int mAppearPos, mDisappearPos; |
|
54 |
private int mAppearType, mDisappearType; |
|
54 |
private int mAppearPos, mDisappearPos, mUnscramblePos;
|
|
55 |
private int mAppearType, mDisappearType, mUnscrambleType;
|
|
55 | 56 |
|
56 |
private TextView mAppearDuration, mDisappearDuration; |
|
57 |
private TextView mAppearDuration, mDisappearDuration, mUnscrambleDuration;
|
|
57 | 58 |
|
58 | 59 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
59 | 60 |
|
... | ... | |
85 | 86 |
{ |
86 | 87 |
mAppearPos = args.getInt("appearPos"); |
87 | 88 |
mDisappearPos = args.getInt("disappearPos"); |
89 |
mUnscramblePos = args.getInt("unscramblePos"); |
|
88 | 90 |
mAppearType = args.getInt("appearType"); |
89 | 91 |
mDisappearType = args.getInt("disappearType"); |
92 |
mUnscrambleType= args.getInt("unscrambleType"); |
|
90 | 93 |
} |
91 | 94 |
catch(NullPointerException ex) |
92 | 95 |
{ |
93 | 96 |
mAppearPos = RubikActivity.DEFAULT_APPEAR_POS; |
94 | 97 |
mDisappearPos = RubikActivity.DEFAULT_DISAPPEAR_POS; |
98 |
mUnscramblePos = RubikActivity.DEFAULT_UNSCRAMBLE_POS; |
|
95 | 99 |
mAppearType = RubikActivity.DEFAULT_APPEAR_TYPE; |
96 | 100 |
mDisappearType = RubikActivity.DEFAULT_DISAPPEAR_TYPE; |
101 |
mUnscrambleType= RubikActivity.DEFAULT_UNSCRAMBLE_TYPE; |
|
97 | 102 |
} |
98 | 103 |
} |
99 | 104 |
|
... | ... | |
122 | 127 |
|
123 | 128 |
mAppearDuration = view.findViewById(R.id.appearDurationText); |
124 | 129 |
mDisappearDuration = view.findViewById(R.id.disappearDurationText); |
130 |
mUnscrambleDuration = view.findViewById(R.id.unscrambleDurationText); |
|
125 | 131 |
|
126 | 132 |
Spinner appearTypeSpinner = view.findViewById(R.id.appearType); |
127 | 133 |
|
... | ... | |
171 | 177 |
disappearBar.setOnSeekBarChangeListener(this); |
172 | 178 |
disappearBar.setProgress(mDisappearPos); |
173 | 179 |
|
180 |
Spinner unscrambleTypeSpinner = view.findViewById(R.id.unscrambleType); |
|
181 |
|
|
182 |
if( unscrambleTypeSpinner!=null ) |
|
183 |
{ |
|
184 |
unscrambleTypeSpinner.setOnItemSelectedListener(this); |
|
185 |
String[] unscramble = getUnscrambleEffectNames(); |
|
186 |
ArrayAdapter<String> adapterType = new ArrayAdapter<>(act,android.R.layout.simple_spinner_item, unscramble); |
|
187 |
adapterType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
188 |
unscrambleTypeSpinner.setAdapter(adapterType); |
|
189 |
|
|
190 |
if(mUnscrambleType>=0 && mUnscrambleType<unscramble.length) |
|
191 |
{ |
|
192 |
unscrambleTypeSpinner.setSelection(mUnscrambleType); |
|
193 |
} |
|
194 |
} |
|
195 |
else |
|
196 |
{ |
|
197 |
android.util.Log.e("dialog", "UNSCRAMBLE TYPE SPINNER NULL!!"); |
|
198 |
} |
|
199 |
|
|
200 |
SeekBar unscrambleBar = view.findViewById(R.id.unscrambleDuration); |
|
201 |
unscrambleBar.setOnSeekBarChangeListener(this); |
|
202 |
unscrambleBar.setProgress(mUnscramblePos); |
|
203 |
|
|
174 | 204 |
return builder.create(); |
175 | 205 |
} |
176 | 206 |
|
... | ... | |
206 | 236 |
return names; |
207 | 237 |
} |
208 | 238 |
|
239 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
240 |
|
|
241 |
private String[] getUnscrambleEffectNames() |
|
242 |
{ |
|
243 |
int length = UnscrambleEffect.NUM_EFFECTS; |
|
244 |
UnscrambleEffect.Type[] types = UnscrambleEffect.Type.values(); |
|
245 |
String[] names = new String[length]; |
|
246 |
|
|
247 |
for( int i=0; i<length; i++) |
|
248 |
{ |
|
249 |
names[i] = types[i].name(); |
|
250 |
} |
|
251 |
|
|
252 |
return names; |
|
253 |
} |
|
254 |
|
|
209 | 255 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
210 | 256 |
|
211 | 257 |
private void saveOptions() |
212 | 258 |
{ |
213 |
mListener.onComplete(mAppearPos, mDisappearPos, mAppearType, mDisappearType);
|
|
259 |
mListener.onComplete(mAppearPos, mDisappearPos, mUnscramblePos, mAppearType, mDisappearType, mUnscrambleType);
|
|
214 | 260 |
} |
215 | 261 |
|
216 | 262 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
219 | 265 |
{ |
220 | 266 |
switch(parent.getId()) |
221 | 267 |
{ |
222 |
case R.id.appearType : mAppearType = pos; break; |
|
223 |
case R.id.disappearType: mDisappearType= pos; break; |
|
268 |
case R.id.appearType : mAppearType = pos; break; |
|
269 |
case R.id.disappearType : mDisappearType = pos; break; |
|
270 |
case R.id.unscrambleType: mUnscrambleType= pos; break; |
|
224 | 271 |
} |
225 | 272 |
} |
226 | 273 |
|
... | ... | |
230 | 277 |
{ |
231 | 278 |
switch (bar.getId()) |
232 | 279 |
{ |
233 |
case R.id.appearDuration : mAppearPos = progress; |
|
234 |
int appear_ms= RubikActivity.translateDuration(mAppearPos); |
|
235 |
mAppearDuration.setText(getString(R.string.ms_placeholder,appear_ms)); |
|
236 |
break; |
|
237 |
case R.id.disappearDuration: mDisappearPos= progress; |
|
238 |
int disappear_ms= RubikActivity.translateDuration(mDisappearPos); |
|
239 |
mDisappearDuration.setText(getString(R.string.ms_placeholder,disappear_ms)); |
|
240 |
break; |
|
280 |
case R.id.appearDuration : mAppearPos = progress; |
|
281 |
int appear_ms= RubikActivity.translateDuration(mAppearPos); |
|
282 |
mAppearDuration.setText(getString(R.string.ms_placeholder,appear_ms)); |
|
283 |
break; |
|
284 |
case R.id.disappearDuration : mDisappearPos= progress; |
|
285 |
int disappear_ms= RubikActivity.translateDuration(mDisappearPos); |
|
286 |
mDisappearDuration.setText(getString(R.string.ms_placeholder,disappear_ms)); |
|
287 |
break; |
|
288 |
case R.id.unscrambleDuration: mUnscramblePos= progress; |
|
289 |
int unscramble_ms= RubikActivity.translateDuration(mUnscramblePos); |
|
290 |
mUnscrambleDuration.setText(getString(R.string.ms_placeholder,unscramble_ms)); |
|
291 |
break; |
|
241 | 292 |
} |
242 | 293 |
} |
243 | 294 |
|
src/main/res/layout/settings.xml | ||
---|---|---|
11 | 11 |
android:paddingStart="15dp" |
12 | 12 |
android:paddingEnd="15dp" |
13 | 13 |
android:gravity="start|center" |
14 |
android:text="@string/disappear" |
|
14 |
android:text="@string/disappear_effect"
|
|
15 | 15 |
android:textAppearance="?android:attr/textAppearanceMedium" /> |
16 | 16 |
|
17 | 17 |
<LinearLayout |
... | ... | |
94 | 94 |
android:paddingStart="15dp" |
95 | 95 |
android:paddingEnd="15dp" |
96 | 96 |
android:gravity="start|center" |
97 |
android:text="@string/appear" |
|
97 |
android:text="@string/appear_effect"
|
|
98 | 98 |
android:textAppearance="?android:attr/textAppearanceMedium" /> |
99 | 99 |
|
100 | 100 |
<LinearLayout |
... | ... | |
172 | 172 |
</LinearLayout> |
173 | 173 |
</LinearLayout> |
174 | 174 |
|
175 |
<TextView |
|
176 |
android:layout_width="fill_parent" |
|
177 |
android:layout_height="48dp" |
|
178 |
android:paddingStart="15dp" |
|
179 |
android:paddingEnd="15dp" |
|
180 |
android:gravity="start|center" |
|
181 |
android:text="@string/unscramble_effect" |
|
182 |
android:textAppearance="?android:attr/textAppearanceMedium" /> |
|
183 |
|
|
184 |
<LinearLayout |
|
185 |
android:layout_width="fill_parent" |
|
186 |
android:layout_height="fill_parent" |
|
187 |
android:layout_weight="0.5" |
|
188 |
android:gravity="center|fill_horizontal" |
|
189 |
android:layout_marginLeft="10dp" |
|
190 |
android:layout_marginRight="10dp" |
|
191 |
android:background="@color/grey" |
|
192 |
android:orientation="vertical"> |
|
193 |
|
|
194 |
<LinearLayout |
|
195 |
android:layout_width="fill_parent" |
|
196 |
android:layout_height="36dp" |
|
197 |
android:gravity="center|fill_horizontal" |
|
198 |
android:orientation="horizontal"> |
|
199 |
|
|
200 |
<TextView |
|
201 |
android:layout_weight="0.2" |
|
202 |
android:layout_width="0dp" |
|
203 |
android:layout_height="fill_parent" |
|
204 |
android:paddingStart="5dp" |
|
205 |
android:paddingEnd="5dp" |
|
206 |
android:gravity="start|center" |
|
207 |
android:text="@string/duration" |
|
208 |
android:textAppearance="?android:attr/textAppearanceSmall" /> |
|
209 |
|
|
210 |
<TextView |
|
211 |
android:id="@+id/unscrambleDurationText" |
|
212 |
android:layout_weight="0.2" |
|
213 |
android:layout_width="0dp" |
|
214 |
android:layout_height="fill_parent" |
|
215 |
android:paddingStart="5dp" |
|
216 |
android:paddingEnd="5dp" |
|
217 |
android:gravity="end|center" |
|
218 |
android:textAppearance="?android:attr/textAppearanceSmall" /> |
|
219 |
|
|
220 |
<SeekBar |
|
221 |
android:id="@+id/unscrambleDuration" |
|
222 |
android:layout_weight="0.6" |
|
223 |
android:layout_width="0dp" |
|
224 |
android:layout_height="fill_parent" |
|
225 |
android:paddingLeft="10dp" |
|
226 |
android:paddingRight="10dp" /> |
|
227 |
|
|
228 |
</LinearLayout> |
|
229 |
|
|
230 |
<LinearLayout |
|
231 |
android:layout_width="fill_parent" |
|
232 |
android:layout_height="36dp" |
|
233 |
android:gravity="center|fill_horizontal" |
|
234 |
android:orientation="horizontal"> |
|
235 |
|
|
236 |
<TextView |
|
237 |
android:layout_weight="0.4" |
|
238 |
android:layout_width="0dp" |
|
239 |
android:layout_height="fill_parent" |
|
240 |
android:paddingStart="5dp" |
|
241 |
android:paddingEnd="5dp" |
|
242 |
android:gravity="start|center" |
|
243 |
android:text="@string/type" |
|
244 |
android:textAppearance="?android:attr/textAppearanceSmall" /> |
|
245 |
|
|
246 |
<Spinner |
|
247 |
android:id="@+id/unscrambleType" |
|
248 |
android:layout_weight="0.6" |
|
249 |
android:layout_width="0dp" |
|
250 |
android:layout_height="fill_parent" |
|
251 |
android:textAlignment="center" |
|
252 |
android:paddingLeft="10dp" |
|
253 |
android:paddingRight="10dp" /> |
|
254 |
|
|
255 |
</LinearLayout> |
|
256 |
</LinearLayout> |
|
257 |
|
|
175 | 258 |
</LinearLayout> |
src/main/res/values/strings.xml | ||
---|---|---|
8 | 8 |
<string name="about">About</string> |
9 | 9 |
<string name="save">SAVE</string> |
10 | 10 |
<string name="ok">OK</string> |
11 |
<string name="appear">New Cube Appear Effect:</string> |
|
12 |
<string name="disappear">Old Cube Disappear Effect:</string> |
|
11 |
<string name="appear_effect">New Cube Appear Effect:</string> |
|
12 |
<string name="disappear_effect">Old Cube Disappear Effect:</string> |
|
13 |
<string name="unscramble_effect">Cube Unscramble Effect:</string> |
|
13 | 14 |
<string name="duration">Duration:</string> |
14 | 15 |
<string name="type">Type:</string> |
15 | 16 |
<string name="credits1">Open Source app developed using the Distorted graphics library. </string> |
Also available in: Unified diff
Add Unscramble Effects to the UI.