Revision eb49fa90
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/tutorials/TutorialActivity.java | ||
---|---|---|
41 | 41 |
import org.distorted.main.R; |
42 | 42 |
import org.distorted.dialogs.RubikDialogError; |
43 | 43 |
|
44 |
import static org.distorted.main.RubikRenderer.BRIGHTNESS; |
|
45 |
|
|
46 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
47 | 45 |
|
48 | 46 |
public class TutorialActivity extends AppCompatActivity |
49 | 47 |
{ |
50 | 48 |
private static final String URL = "https://www.youtube.com/embed/"; |
51 | 49 |
|
50 |
public static final float BAR_RATIO = 0.15f; |
|
52 | 51 |
public static final float DIALOG_BUTTON_SIZE = 0.06f; |
53 | 52 |
public static final float MENU_BIG_TEXT_SIZE = 0.05f; |
54 | 53 |
|
... | ... | |
128 | 127 |
{ |
129 | 128 |
super.onAttachedToWindow(); |
130 | 129 |
|
131 |
final float RATIO = 0.15f; |
|
132 | 130 |
float width = getScreenWidthInPixels(); |
133 | 131 |
|
134 |
TutorialSurfaceView viewL = findViewById(R.id.tutorialSurfaceView); |
|
135 |
ViewGroup.LayoutParams paramsL = viewL.getLayoutParams(); |
|
136 |
paramsL.width = (int)(width*(1.0f-RATIO)); |
|
137 |
viewL.setLayoutParams(paramsL); |
|
138 |
|
|
139 | 132 |
LinearLayout viewR = findViewById(R.id.tutorialRightBar); |
140 | 133 |
ViewGroup.LayoutParams paramsR = viewR.getLayoutParams(); |
141 |
paramsR.width = (int)(width*RATIO); |
|
134 |
paramsR.width = (int)(width*BAR_RATIO);
|
|
142 | 135 |
viewR.setLayoutParams(paramsR); |
143 | 136 |
|
144 |
final int color = (int)(BRIGHTNESS*255); |
|
145 |
viewR.setBackgroundColor( (0xFF<<24)+(color<<16)+(color<<8)+color); |
|
146 |
|
|
147 | 137 |
if( mState==null ) mState = new TutorialScreen(); |
148 | 138 |
|
149 | 139 |
mState.createRightPane(this,width); |
src/main/java/org/distorted/tutorials/TutorialSurfaceView.java | ||
---|---|---|
48 | 48 |
mScreenWidth = width; |
49 | 49 |
mScreenHeight= height; |
50 | 50 |
mObjectController.setScreenSize(width,height); |
51 |
mObjectController.setMove( (int)(-0.5f*width*TutorialActivity.BAR_RATIO), 0); |
|
51 | 52 |
} |
52 | 53 |
|
53 | 54 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/res/layout/main.xml | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="utf-8"?> |
2 | 2 |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | 3 |
android:id="@+id/relativeLayout" |
4 |
android:layout_width="fill_parent"
|
|
5 |
android:layout_height="fill_parent" >
|
|
4 |
android:layout_width="match_parent"
|
|
5 |
android:layout_height="match_parent" >
|
|
6 | 6 |
|
7 | 7 |
<org.distorted.main.RubikSurfaceView |
8 | 8 |
android:id="@+id/rubikSurfaceView" |
9 |
android:layout_width="fill_parent"
|
|
10 |
android:layout_height="fill_parent"
|
|
9 |
android:layout_width="match_parent"
|
|
10 |
android:layout_height="match_parent"
|
|
11 | 11 |
android:layout_alignParentStart="true" |
12 | 12 |
android:layout_alignParentTop="true"/> |
13 | 13 |
|
14 | 14 |
<LinearLayout |
15 | 15 |
android:id="@+id/hiddenBar" |
16 | 16 |
android:layout_alignParentTop="true" |
17 |
android:layout_width="fill_parent"
|
|
17 |
android:layout_width="match_parent"
|
|
18 | 18 |
android:layout_height="0dp" |
19 | 19 |
android:gravity="center" |
20 | 20 |
android:orientation="horizontal" |
src/main/res/layout/tutorial.xml | ||
---|---|---|
13 | 13 |
android:layout_height="0dp" |
14 | 14 |
android:layout_weight="1"/> |
15 | 15 |
|
16 |
<LinearLayout
|
|
16 |
<RelativeLayout
|
|
17 | 17 |
android:id="@+id/tutorialLowerPart" |
18 | 18 |
android:layout_width="match_parent" |
19 | 19 |
android:layout_height="0dp" |
20 |
android:layout_weight="1.2" |
|
21 |
android:orientation="horizontal" |
|
22 |
android:background="@android:color/transparent"> |
|
20 |
android:layout_weight="1.2"> |
|
23 | 21 |
|
24 | 22 |
<org.distorted.tutorials.TutorialSurfaceView |
25 | 23 |
android:id="@+id/tutorialSurfaceView" |
26 |
android:layout_width="0dp" |
|
27 |
android:layout_height="match_parent"/> |
|
24 |
android:layout_width="match_parent" |
|
25 |
android:layout_height="match_parent" |
|
26 |
android:layout_alignParentStart="true"/> |
|
28 | 27 |
|
29 | 28 |
<LinearLayout |
30 | 29 |
android:id="@+id/tutorialRightBar" |
30 |
android:layout_alignParentRight="true" |
|
31 | 31 |
android:layout_width="0dp" |
32 | 32 |
android:layout_height="match_parent" |
33 |
|
|
34 | 33 |
android:orientation="vertical" |
35 | 34 |
android:background="@android:color/transparent"> |
35 |
</LinearLayout> |
|
36 | 36 |
|
37 |
</RelativeLayout> |
|
38 |
</LinearLayout> |
|
37 | 39 |
|
38 |
</LinearLayout> |
|
39 |
</LinearLayout> |
|
40 |
</LinearLayout> |
Also available in: Unified diff
Use the off-center objects to display the object in Tutorial mode properly.
Now it is not covered by the right bar!