Revision dd874ae8
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/screens/RubikScreenPattern.java | ||
---|---|---|
25 | 25 |
import android.view.Gravity; |
26 | 26 |
import android.view.LayoutInflater; |
27 | 27 |
import android.view.View; |
28 |
import android.widget.ImageButton; |
|
29 | 28 |
import android.widget.LinearLayout; |
30 | 29 |
import android.widget.TextView; |
31 | 30 |
|
... | ... | |
44 | 43 |
public class RubikScreenPattern extends RubikScreenAbstract |
45 | 44 |
{ |
46 | 45 |
private TextView mText; |
47 |
private ImageButton mPrevButton, mNextButton, mBackButton; |
|
46 |
private TransparentImageButton mPrevButton, mNextButton, mBackButton;
|
|
48 | 47 |
private TextView mMovesText; |
49 | 48 |
private int mNumMoves; |
50 | 49 |
private int mPatternOrdinal, mCategory, mPattern; |
... | ... | |
91 | 90 |
LinearLayout layoutBot = act.findViewById(R.id.lowerBar); |
92 | 91 |
layoutBot.removeAllViews(); |
93 | 92 |
|
94 |
setupPrevButton(act,width);
|
|
95 |
setupNextButton(act,width);
|
|
93 |
setupPrevButton(act); |
|
94 |
setupNextButton(act); |
|
96 | 95 |
setupTextView(act,width); |
97 | 96 |
|
98 | 97 |
setTrioState(false); |
... | ... | |
112 | 111 |
layoutLeft.addView(mMovesText); |
113 | 112 |
layoutLeft.addView(mNextButton); |
114 | 113 |
|
115 |
setupBackButton(act,width);
|
|
114 |
setupBackButton(act); |
|
116 | 115 |
|
117 | 116 |
layoutRight.addView(mBackButton); |
118 | 117 |
|
... | ... | |
142 | 141 |
|
143 | 142 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
144 | 143 |
|
145 |
private void setupBackButton(final RubikActivity act, final float width)
|
|
144 |
private void setupBackButton(final RubikActivity act) |
|
146 | 145 |
{ |
147 | 146 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back); |
148 |
mBackButton = new TransparentImageButton(act, icon, width, LinearLayout.LayoutParams.MATCH_PARENT);
|
|
147 |
mBackButton = new TransparentImageButton(act, icon, LinearLayout.LayoutParams.MATCH_PARENT, TransparentImageButton.GRAVITY_MIDDLE);
|
|
149 | 148 |
|
150 | 149 |
mBackButton.setOnClickListener( new View.OnClickListener() |
151 | 150 |
{ |
... | ... | |
161 | 160 |
|
162 | 161 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
163 | 162 |
|
164 |
private void setupPrevButton(final RubikActivity act, final float width)
|
|
163 |
private void setupPrevButton(final RubikActivity act) |
|
165 | 164 |
{ |
166 | 165 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_left,R.drawable.ui_medium_left, R.drawable.ui_big_left, R.drawable.ui_huge_left); |
167 |
mPrevButton = new TransparentImageButton(act,icon,width,0);
|
|
166 |
mPrevButton = new TransparentImageButton(act,icon,0,TransparentImageButton.GRAVITY_MIDDLE);
|
|
168 | 167 |
|
169 | 168 |
mPrevButton.setOnClickListener( new View.OnClickListener() |
170 | 169 |
{ |
... | ... | |
182 | 181 |
|
183 | 182 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
184 | 183 |
|
185 |
private void setupNextButton(final RubikActivity act, final float width)
|
|
184 |
private void setupNextButton(final RubikActivity act) |
|
186 | 185 |
{ |
187 | 186 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_right,R.drawable.ui_medium_right, R.drawable.ui_big_right, R.drawable.ui_huge_right); |
188 |
mNextButton = new TransparentImageButton(act,icon,width,0);
|
|
187 |
mNextButton = new TransparentImageButton(act,icon,0,TransparentImageButton.GRAVITY_MIDDLE);
|
|
189 | 188 |
|
190 | 189 |
mNextButton.setOnClickListener( new View.OnClickListener() |
191 | 190 |
{ |
Also available in: Unified diff
Convert the theme to be a MaterialTheme and the TransparentImageButton to be a MaterialButton - the first forced by the second, and the second because a MaterialButton gives us control over the location of the icon in top of it. We need that because of the new 'solve/scramble' split-button in the lower right of the Play screen.