Revision 36b9ee93
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/tutorial/TutorialActivity.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
import androidx.appcompat.app.AppCompatActivity; |
32 | 32 |
|
33 |
import com.google.firebase.analytics.FirebaseAnalytics; |
|
34 |
|
|
35 | 33 |
import org.distorted.dialogs.RubikDialogError; |
36 | 34 |
import org.distorted.library.main.DistortedLibrary; |
35 |
import org.distorted.library.message.EffectListener; |
|
37 | 36 |
import org.distorted.main.R; |
37 |
import org.distorted.main.RubikDebug; |
|
38 | 38 |
import org.distorted.objects.ObjectList; |
39 | 39 |
import org.distorted.objects.TwistyObject; |
40 | 40 |
import org.distorted.states.StateList; |
... | ... | |
43 | 43 |
|
44 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 45 |
|
46 |
public class TutorialActivity extends AppCompatActivity |
|
46 |
public class TutorialActivity extends AppCompatActivity implements RubikDebug.ActivityChanger, EffectListener
|
|
47 | 47 |
{ |
48 | 48 |
private static final String URL = "https://www.youtube.com/embed/"; |
49 | 49 |
|
... | ... | |
56 | 56 |
| View.SYSTEM_UI_FLAG_FULLSCREEN |
57 | 57 |
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; |
58 | 58 |
|
59 |
public static final int FLAGS2= View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
60 |
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; |
|
61 |
|
|
62 | 59 |
private boolean mIsLocked; |
63 |
private FirebaseAnalytics mFirebaseAnalytics; |
|
64 | 60 |
private static int mScreenWidth, mScreenHeight; |
65 | 61 |
private int mCurrentApiVersion; |
66 | 62 |
private TutorialState mState; |
... | ... | |
88 | 84 |
} |
89 | 85 |
|
90 | 86 |
mIsLocked = false; |
91 |
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); |
|
92 | 87 |
|
93 | 88 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
94 | 89 |
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
... | ... | |
189 | 184 |
super.onPause(); |
190 | 185 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
191 | 186 |
view.onPause(); |
187 |
RubikDebug debug = RubikDebug.getInstance(); |
|
188 |
debug.onPause(); |
|
192 | 189 |
|
193 | 190 |
if( mWebView!=null ) mWebView.onPause(); |
194 | 191 |
|
... | ... | |
201 | 198 |
protected void onResume() |
202 | 199 |
{ |
203 | 200 |
super.onResume(); |
201 |
RubikDebug debug = RubikDebug.getInstance(); |
|
202 |
debug.onResume(this); |
|
203 |
RubikDebug.addDebug("RubikActivity: onResume"); |
|
204 |
|
|
204 | 205 |
DistortedLibrary.onResume(1); |
205 | 206 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
206 | 207 |
view.onResume(); |
... | ... | |
247 | 248 |
|
248 | 249 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
249 | 250 |
// PUBLIC API |
250 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
251 |
|
|
252 |
public FirebaseAnalytics getAnalytics() |
|
253 |
{ |
|
254 |
return mFirebaseAnalytics; |
|
255 |
} |
|
256 |
|
|
257 | 251 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
258 | 252 |
|
259 | 253 |
public TwistyObject getObject() |
... | ... | |
270 | 264 |
return mScreenWidth; |
271 | 265 |
} |
272 | 266 |
|
273 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
274 |
|
|
275 |
public int getScreenHeightInPixels() |
|
276 |
{ |
|
277 |
return mScreenHeight; |
|
278 |
} |
|
279 |
|
|
280 | 267 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
281 | 268 |
|
282 | 269 |
public TutorialPreRender getPreRender() |
... | ... | |
355 | 342 |
{ |
356 | 343 |
return mIsLocked; |
357 | 344 |
} |
345 |
|
|
346 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
347 |
|
|
348 |
public void change() |
|
349 |
{ |
|
350 |
finish(); |
|
351 |
} |
|
352 |
|
|
353 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
354 |
|
|
355 |
public void assign() |
|
356 |
{ |
|
357 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
|
358 |
TutorialPreRender pre = view.getPreRender(); |
|
359 |
TwistyObject object = pre.getObject(); |
|
360 |
|
|
361 |
int angle = 360 / object.getBasicAngle(); |
|
362 |
|
|
363 |
object.addNewRotation(1,1,angle,1000,this); |
|
364 |
} |
|
365 |
|
|
366 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
367 |
|
|
368 |
public void effectFinished(final long effectID) |
|
369 |
{ |
|
370 |
RubikDebug debug = RubikDebug.getInstance(); |
|
371 |
debug.onReturned(); |
|
372 |
} |
|
358 | 373 |
} |
Also available in: Unified diff
Attempt to programmatically catch the 'cube is sometimes not drawn' bug and report it to my server.