Revision 45516ed2
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/config/ConfigActivity.java | ||
---|---|---|
218 | 218 |
errDiag.show(getSupportFragmentManager(), null); |
219 | 219 |
} |
220 | 220 |
|
221 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
222 |
|
|
223 |
private Static4D getDefaultRotation(int numFaces) |
|
224 |
{ |
|
225 |
switch(numFaces) |
|
226 |
{ |
|
227 |
case 4: return ShapeTetrahedron.DEFAULT_ROT; |
|
228 |
case 6: return ShapeHexahedron.DEFAULT_ROT; |
|
229 |
case 8: return ShapeOctahedron.DEFAULT_ROT; |
|
230 |
case 12: return ShapeDodecahedron.DEFAULT_ROT; |
|
231 |
} |
|
232 |
|
|
233 |
return null; |
|
234 |
} |
|
235 |
|
|
236 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
237 |
|
|
238 |
void rotateObject(int numFaces) |
|
239 |
{ |
|
240 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
|
241 |
ObjectControl control = view.getObjectControl(); |
|
242 |
Static4D rot = getDefaultRotation(numFaces); |
|
243 |
|
|
244 |
if( rot!=null ) control.rotateNow(rot); |
|
245 |
} |
|
246 |
|
|
247 | 221 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
248 | 222 |
|
249 | 223 |
private void changeIfDifferent(RubikObject object,ObjectControl control) |
src/main/java/org/distorted/config/ConfigScreenPane.java | ||
---|---|---|
52 | 52 |
|
53 | 53 |
private static final int NUM_IMAGES = IMAGES.length; |
54 | 54 |
public static final float PADDING_RATIO = 0.025f; |
55 |
private static final float TEXT_RATIO = 0.040f;
|
|
55 |
private static final float TEXT_RATIO = 0.042f;
|
|
56 | 56 |
private static final float RADIO_RATIO = 0.900f; |
57 | 57 |
|
58 | 58 |
private JsonReader mReader; |
... | ... | |
110 | 110 |
mProgramatic = true; |
111 | 111 |
button.setChecked(true); |
112 | 112 |
mProgramatic = false; |
113 |
|
|
114 |
int numFaces = mReader.getNumFaces(); |
|
115 |
act.rotateObject(numFaces); |
|
116 | 113 |
} |
117 | 114 |
|
118 | 115 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/config/ConfigSurfaceView.java | ||
---|---|---|
87 | 87 |
ConfigActivity act = (ConfigActivity)context; |
88 | 88 |
ConfigObjectLibInterface ref = new ConfigObjectLibInterface(); |
89 | 89 |
mObjectController = new ObjectControl(act,ref); |
90 |
mObjectController.setRotateOnCreation(true); |
|
90 | 91 |
mRenderer = new ConfigRenderer(this); |
91 | 92 |
|
92 | 93 |
final ActivityManager activityManager= (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
Also available in: Unified diff
Fix setDefaultRotation() when changing an object; do it at exactly the right time when the 'old' object has already disappeared, but the new hasn't been attached to the Nodee yet.