Revision 55e6be1d
Added by Leszek Koltunski almost 3 years ago
src/main/java/org/distorted/tutorials/TutorialActivity.java | ||
---|---|---|
28 | 28 |
import android.webkit.WebView; |
29 | 29 |
import android.widget.LinearLayout; |
30 | 30 |
|
31 |
import androidx.appcompat.app.AppCompatActivity; |
|
32 |
|
|
33 | 31 |
import com.google.firebase.analytics.FirebaseAnalytics; |
34 | 32 |
|
35 | 33 |
import org.distorted.dialogs.RubikDialogError; |
34 |
import org.distorted.helpers.TwistyActivity; |
|
35 |
import org.distorted.helpers.TwistyPreRender; |
|
36 | 36 |
import org.distorted.library.main.DistortedLibrary; |
37 | 37 |
import org.distorted.main.R; |
38 | 38 |
import org.distorted.objects.ObjectList; |
39 | 39 |
import org.distorted.objects.TwistyObject; |
40 |
import org.distorted.screens.ScreenList; |
|
41 | 40 |
|
42 | 41 |
import static org.distorted.main.RubikRenderer.BRIGHTNESS; |
43 | 42 |
|
44 | 43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 44 |
|
46 |
public class TutorialActivity extends AppCompatActivity
|
|
45 |
public class TutorialActivity extends TwistyActivity
|
|
47 | 46 |
{ |
48 | 47 |
private static final String URL = "https://www.youtube.com/embed/"; |
49 | 48 |
|
... | ... | |
56 | 55 |
| View.SYSTEM_UI_FLAG_FULLSCREEN |
57 | 56 |
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; |
58 | 57 |
|
59 |
public static final int FLAGS2= View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
60 |
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; |
|
61 |
|
|
62 |
private boolean mIsLocked; |
|
63 | 58 |
private FirebaseAnalytics mFirebaseAnalytics; |
64 | 59 |
private static int mScreenWidth, mScreenHeight; |
65 | 60 |
private int mCurrentApiVersion; |
... | ... | |
87 | 82 |
mObjectSize = b.getInt("siz"); |
88 | 83 |
} |
89 | 84 |
|
90 |
mIsLocked = false;
|
|
85 |
unlock();
|
|
91 | 86 |
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); |
92 | 87 |
|
93 | 88 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
... | ... | |
153 | 148 |
mState.createRightPane(this,width); |
154 | 149 |
|
155 | 150 |
WebView videoView = findViewById(R.id.tutorialVideoView); |
156 |
mWebView = new TutorialWebView(this,videoView);
|
|
151 |
mWebView = new TutorialWebView(videoView); |
|
157 | 152 |
mWebView.load(URL+mURL); |
158 | 153 |
} |
159 | 154 |
|
... | ... | |
285 | 280 |
return view.getPreRender(); |
286 | 281 |
} |
287 | 282 |
|
283 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
284 |
|
|
285 |
public TwistyPreRender getTwistyPreRender() |
|
286 |
{ |
|
287 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
|
288 |
return view.getPreRender(); |
|
289 |
} |
|
290 |
|
|
288 | 291 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
289 | 292 |
|
290 | 293 |
public static int getDrawableSize() |
... | ... | |
327 | 330 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
328 | 331 |
return view.isVertical(); |
329 | 332 |
} |
330 |
|
|
331 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
332 |
|
|
333 |
public void toggleLock() |
|
334 |
{ |
|
335 |
mIsLocked = !mIsLocked; |
|
336 |
} |
|
337 |
|
|
338 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
339 |
|
|
340 |
public boolean isLocked() |
|
341 |
{ |
|
342 |
ScreenList state = ScreenList.getCurrentScreen(); |
|
343 |
|
|
344 |
if( state== ScreenList.PLAY || state== ScreenList.READ || state== ScreenList.SOLV ) |
|
345 |
{ |
|
346 |
return mIsLocked; |
|
347 |
} |
|
348 |
|
|
349 |
return false; |
|
350 |
} |
|
351 |
|
|
352 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
353 |
|
|
354 |
public boolean retLocked() |
|
355 |
{ |
|
356 |
return mIsLocked; |
|
357 |
} |
|
358 | 333 |
} |
Also available in: Unified diff
Abstract the part that controls the 'Locked' and 'Back Moves' buttons from the two activities: the main one and the tutorial one.
This code had been duplicated there.