Revision 36b9ee93
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
41 | 41 |
import org.distorted.effects.BaseEffect; |
42 | 42 |
import org.distorted.library.main.DistortedLibrary; |
43 | 43 |
|
44 |
import org.distorted.library.message.EffectListener; |
|
44 | 45 |
import org.distorted.objects.TwistyObject; |
45 | 46 |
import org.distorted.scores.RubikScores; |
46 | 47 |
import org.distorted.scores.RubikScoresDownloader; |
... | ... | |
48 | 49 |
import org.distorted.states.StateList; |
49 | 50 |
import org.distorted.states.RubikStatePlay; |
50 | 51 |
import org.distorted.tutorial.TutorialActivity; |
52 |
import org.distorted.tutorial.TutorialList; |
|
51 | 53 |
|
52 | 54 |
import java.util.Locale; |
53 | 55 |
|
54 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
55 | 57 |
|
56 |
public class RubikActivity extends AppCompatActivity |
|
58 |
public class RubikActivity extends AppCompatActivity implements RubikDebug.ActivityChanger, EffectListener
|
|
57 | 59 |
{ |
58 | 60 |
public static final float PADDING = 0.01f; |
59 | 61 |
public static final float MARGIN = 0.004f; |
... | ... | |
89 | 91 |
private int mCurrentApiVersion; |
90 | 92 |
private boolean mIsLocked; |
91 | 93 |
|
94 |
private static int mNumTests=0; |
|
95 |
|
|
92 | 96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
93 | 97 |
|
94 | 98 |
@Override |
... | ... | |
224 | 228 |
protected void onPause() |
225 | 229 |
{ |
226 | 230 |
super.onPause(); |
231 |
|
|
232 |
RubikDebug debug = RubikDebug.getInstance(); |
|
233 |
debug.onPause(); |
|
234 |
|
|
227 | 235 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
228 | 236 |
view.onPause(); |
229 | 237 |
DistortedLibrary.onPause(0); |
... | ... | |
240 | 248 |
DistortedLibrary.onResume(0); |
241 | 249 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
242 | 250 |
view.onResume(); |
251 |
|
|
252 |
RubikDebug debug = RubikDebug.getInstance(); |
|
253 |
debug.onResume(this); |
|
254 |
|
|
243 | 255 |
view.initialize(); |
244 | 256 |
restorePreferences(); |
245 | 257 |
StateList.setState(this); |
... | ... | |
252 | 264 |
scores.setCountry(this); |
253 | 265 |
} |
254 | 266 |
|
267 |
RubikPreRender pre = view.getPreRender(); |
|
268 |
pre.destroyNewObject(); |
|
269 |
RubikDebug.addDebug("RubikActivity: onResume"); |
|
270 |
|
|
255 | 271 |
boolean success = false; |
256 | 272 |
RubikStatePlay play = (RubikStatePlay) StateList.PLAY.getStateClass(); |
257 | 273 |
int object = play.getObject(); |
... | ... | |
572 | 588 |
myIntent.putExtra("siz", size); |
573 | 589 |
startActivity(myIntent); |
574 | 590 |
} |
591 |
|
|
592 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
593 |
|
|
594 |
public void change() |
|
595 |
{ |
|
596 |
mNumTests++; |
|
597 |
|
|
598 |
if( mNumTests<100 ) |
|
599 |
{ |
|
600 |
TutorialList list = TutorialList.getObject(2); |
|
601 |
ObjectList objList = list.getObjectList(); |
|
602 |
int size = list.getSize(); |
|
603 |
String url = list.getTutorialURL(0); |
|
604 |
|
|
605 |
switchTutorial(url, objList, size); |
|
606 |
} |
|
607 |
else |
|
608 |
{ |
|
609 |
finish(); |
|
610 |
} |
|
611 |
} |
|
612 |
|
|
613 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
614 |
|
|
615 |
public void assign() |
|
616 |
{ |
|
617 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
618 |
RubikPreRender pre = view.getPreRender(); |
|
619 |
TwistyObject object = pre.getObject(); |
|
620 |
|
|
621 |
int angle = 360 / object.getBasicAngle(); |
|
622 |
|
|
623 |
object.addNewRotation(1,1,angle,1000,this); |
|
624 |
} |
|
625 |
|
|
626 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
627 |
|
|
628 |
public void effectFinished(final long effectID) |
|
629 |
{ |
|
630 |
RubikDebug debug = RubikDebug.getInstance(); |
|
631 |
debug.onReturned(); |
|
632 |
} |
|
575 | 633 |
} |
Also available in: Unified diff
Attempt to programmatically catch the 'cube is sometimes not drawn' bug and report it to my server.