Revision dd874ae8
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/screens/RubikScreenSolution.java | ||
---|---|---|
24 | 24 |
import android.view.Gravity; |
25 | 25 |
import android.view.LayoutInflater; |
26 | 26 |
import android.view.View; |
27 |
import android.widget.ImageButton; |
|
28 | 27 |
import android.widget.LinearLayout; |
29 | 28 |
import android.widget.TextView; |
30 | 29 |
|
... | ... | |
42 | 41 |
{ |
43 | 42 |
private static final int MILLIS_PER_DEGREE = 6; |
44 | 43 |
|
45 |
private ImageButton mPrevButton, mNextButton, mBackButton; |
|
44 |
private TransparentImageButton mPrevButton, mNextButton, mBackButton;
|
|
46 | 45 |
private TextView mMovesText; |
47 | 46 |
private int[][] mMoves; |
48 | 47 |
private int mCurrMove, mNumMoves; |
... | ... | |
91 | 90 |
LinearLayout layoutRight = new LinearLayout(act); |
92 | 91 |
layoutRight.setLayoutParams(paramsR); |
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 |
layoutLeft.addView(mPrevButton); |
99 | 98 |
layoutLeft.addView(mMovesText); |
100 | 99 |
layoutLeft.addView(mNextButton); |
101 | 100 |
|
102 |
setupBackButton(act,width);
|
|
101 |
setupBackButton(act); |
|
103 | 102 |
|
104 | 103 |
layoutRight.addView(mBackButton); |
105 | 104 |
|
... | ... | |
110 | 109 |
|
111 | 110 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
112 | 111 |
|
113 |
private void setupPrevButton(final RubikActivity act, final float width)
|
|
112 |
private void setupPrevButton(final RubikActivity act) |
|
114 | 113 |
{ |
115 | 114 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_left,R.drawable.ui_medium_left, R.drawable.ui_big_left, R.drawable.ui_huge_left); |
116 |
mPrevButton = new TransparentImageButton(act,icon,width,0);
|
|
115 |
mPrevButton = new TransparentImageButton(act,icon,0,TransparentImageButton.GRAVITY_MIDDLE);
|
|
117 | 116 |
|
118 | 117 |
mPrevButton.setOnClickListener( new View.OnClickListener() |
119 | 118 |
{ |
... | ... | |
129 | 128 |
|
130 | 129 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
131 | 130 |
|
132 |
private void setupNextButton(final RubikActivity act, final float width)
|
|
131 |
private void setupNextButton(final RubikActivity act) |
|
133 | 132 |
{ |
134 | 133 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_right,R.drawable.ui_medium_right, R.drawable.ui_big_right, R.drawable.ui_huge_right); |
135 |
mNextButton = new TransparentImageButton(act,icon,width,0);
|
|
134 |
mNextButton = new TransparentImageButton(act,icon,0,TransparentImageButton.GRAVITY_MIDDLE);
|
|
136 | 135 |
|
137 | 136 |
mNextButton.setOnClickListener( new View.OnClickListener() |
138 | 137 |
{ |
... | ... | |
169 | 168 |
|
170 | 169 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
171 | 170 |
|
172 |
private void setupBackButton(final RubikActivity act, final float width)
|
|
171 |
private void setupBackButton(final RubikActivity act) |
|
173 | 172 |
{ |
174 | 173 |
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); |
175 |
mBackButton = new TransparentImageButton(act, icon, width, LinearLayout.LayoutParams.MATCH_PARENT);
|
|
174 |
mBackButton = new TransparentImageButton(act, icon, LinearLayout.LayoutParams.MATCH_PARENT, TransparentImageButton.GRAVITY_MIDDLE);
|
|
176 | 175 |
|
177 | 176 |
mBackButton.setOnClickListener( new View.OnClickListener() |
178 | 177 |
{ |
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.