Revision cb6d9c37
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/dialogs/RubikDialogTutorialView.java | ||
---|---|---|
112 | 112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
113 | 113 |
|
114 | 114 |
private View createRow(final RubikActivity act, int countryID, final String desc, final String url, |
115 |
final String auth, int width, final ObjectType obj, int colorB, int colorT)
|
|
115 |
final String auth, int size, final ObjectType obj, int colorB, int colorT)
|
|
116 | 116 |
{ |
117 |
float textSize = 0.5f*size; |
|
117 | 118 |
View row = inflate( act, R.layout.dialog_tutorial_row, null); |
118 |
Button butt = row.findViewById(R.id.tutorialButton); |
|
119 | 119 |
|
120 |
LinearLayout layout = row.findViewById(R.id.tutorialLayout); |
|
121 |
layout.setMinimumHeight(size); |
|
122 |
|
|
123 |
Button butt = row.findViewById(R.id.tutorialButton); |
|
120 | 124 |
butt.setText(R.string.view); |
121 | 125 |
butt.setTextColor(colorT); |
122 | 126 |
butt.setBackgroundColor(colorB); |
123 |
butt.setTextSize(TypedValue.COMPLEX_UNIT_PX, 0.5f*width);
|
|
124 |
butt.setHeight(width);
|
|
127 |
butt.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
|
128 |
butt.setHeight(size);
|
|
125 | 129 |
|
126 | 130 |
butt.setOnClickListener( new View.OnClickListener() |
127 | 131 |
{ |
... | ... | |
142 | 146 |
image.setImageResource(id); |
143 | 147 |
|
144 | 148 |
TextView author = row.findViewById(R.id.tutorialAuthor); |
145 |
author.setTextSize(TypedValue.COMPLEX_UNIT_PX, 0.5f*width);
|
|
149 |
author.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
|
146 | 150 |
author.setText(auth); |
147 | 151 |
|
148 | 152 |
TextView title = row.findViewById(R.id.tutorialTitle); |
149 |
title.setTextSize(TypedValue.COMPLEX_UNIT_PX, 0.5f*width);
|
|
153 |
title.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
|
150 | 154 |
title.setText(desc); |
151 | 155 |
|
152 | 156 |
return row; |
src/main/res/layout/dialog_tutorial_row.xml | ||
---|---|---|
26 | 26 |
android:layout_height="wrap_content" |
27 | 27 |
android:layout_marginLeft="10dp" |
28 | 28 |
android:layout_marginRight="10dp" |
29 |
android:paddingLeft="5dp" |
|
30 |
android:paddingRight="5dp" |
|
29 | 31 |
android:background="@color/dark_grey" |
30 |
android:gravity="center" |
|
31 | 32 |
android:orientation="horizontal"> |
32 | 33 |
|
33 |
<LinearLayout |
|
34 |
<ImageView |
|
35 |
android:id="@+id/tutorialCountry" |
|
34 | 36 |
android:layout_width="0dp" |
35 | 37 |
android:layout_height="match_parent" |
36 | 38 |
android:layout_weight="0.4" |
39 |
android:paddingBottom="6dp" |
|
40 |
android:paddingTop="6dp" |
|
37 | 41 |
android:gravity="left" |
38 |
android:orientation="horizontal"> |
|
39 |
|
|
40 |
<ImageView |
|
41 |
android:id="@+id/tutorialCountry" |
|
42 |
android:layout_width="match_parent" |
|
43 |
android:layout_height="match_parent" |
|
44 |
android:paddingBottom="3dp" |
|
45 |
android:paddingTop="3dp" |
|
46 |
android:paddingLeft="10dp"/> |
|
47 |
</LinearLayout> |
|
42 |
android:paddingLeft="0dp"/> |
|
48 | 43 |
|
49 |
<LinearLayout |
|
44 |
<TextView |
|
45 |
android:id="@+id/tutorialAuthor" |
|
50 | 46 |
android:layout_width="0dp" |
51 | 47 |
android:layout_height="match_parent" |
52 |
android:layout_weight="1.5" |
|
53 |
android:gravity="left" |
|
54 |
android:orientation="horizontal"> |
|
55 |
|
|
56 |
<TextView |
|
57 |
android:id="@+id/tutorialAuthor" |
|
58 |
android:layout_width="wrap_content" |
|
59 |
android:layout_height="wrap_content" |
|
60 |
android:paddingLeft="5dp" |
|
61 |
android:textSize="18sp" |
|
62 |
android:maxLines="1" |
|
63 |
android:layout_gravity="center_vertical|start"/> |
|
64 |
</LinearLayout> |
|
48 |
android:layout_weight="1.0" |
|
49 |
android:gravity="center_vertical|start" |
|
50 |
android:paddingLeft="5dp" |
|
51 |
android:textSize="18sp" |
|
52 |
android:singleLine="true" |
|
53 |
android:maxLines="1"/> |
|
65 | 54 |
|
66 |
<LinearLayout |
|
55 |
<Button |
|
56 |
android:id="@+id/tutorialButton" |
|
67 | 57 |
android:layout_width="0dp" |
68 | 58 |
android:layout_height="match_parent" |
69 |
android:layout_weight="1.0" |
|
70 |
android:gravity="right" |
|
71 |
android:orientation="horizontal"> |
|
72 |
|
|
73 |
<Button |
|
74 |
android:id="@+id/tutorialButton" |
|
75 |
android:layout_width="match_parent" |
|
76 |
android:layout_height="wrap_content" |
|
77 |
android:paddingRight="15dp" |
|
78 |
android:paddingLeft="15dp" |
|
79 |
android:singleLine="true" |
|
80 |
android:textAllCaps="false" |
|
81 |
android:layout_gravity="right"/> |
|
82 |
</LinearLayout> |
|
59 |
android:layout_weight="0.7" |
|
60 |
android:paddingRight="10dp" |
|
61 |
android:paddingLeft="10dp" |
|
62 |
android:singleLine="true" |
|
63 |
android:textAllCaps="false" |
|
64 |
android:gravity="center"/> |
|
83 | 65 |
|
84 | 66 |
</LinearLayout> |
85 | 67 |
</LinearLayout> |
Also available in: Unified diff
Simplify and spped up the tutorials dialog