Revision da768c35
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/states/RubikStatePattern.java | ||
---|---|---|
47 | 47 |
private TextView mMovesText; |
48 | 48 |
private int mNumMoves; |
49 | 49 |
private int mPatternOrdinal, mCategory, mPattern; |
50 |
private float mButtonSize, mTitleSize;
|
|
50 |
private float mButtonSize; |
|
51 | 51 |
|
52 | 52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
53 | 53 |
|
... | ... | |
80 | 80 |
{ |
81 | 81 |
float width = act.getScreenWidthInPixels(); |
82 | 82 |
mButtonSize = width*RubikActivity.BUTTON_TEXT_SIZE; |
83 |
mTitleSize = width*RubikActivity.TITLE_TEXT_SIZE;
|
|
83 |
float titleSize = width*RubikActivity.TITLE_TEXT_SIZE;
|
|
84 | 84 |
|
85 | 85 |
RubikStatePlay play = (RubikStatePlay) StateList.PLAY.getStateClass(); |
86 | 86 |
int obj = play.getObject(); |
... | ... | |
104 | 104 |
LinearLayout layoutTop = act.findViewById(R.id.upperBar); |
105 | 105 |
layoutTop.removeAllViews(); |
106 | 106 |
mText = (TextView)inflater.inflate(R.layout.upper_pattern_text, null); |
107 |
mText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTitleSize);
|
|
107 |
mText.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
|
|
108 | 108 |
mText.setText(R.string.patterns); |
109 | 109 |
layoutTop.addView(mText); |
110 | 110 |
|
... | ... | |
168 | 168 |
|
169 | 169 |
private void setupBackButton(final RubikActivity act, final float width) |
170 | 170 |
{ |
171 |
int padding = (int)(width*RubikActivity.PADDING); |
|
172 |
int margin = (int)(width*RubikActivity.MARGIN); |
|
173 |
|
|
174 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT); |
|
175 |
params.topMargin = margin; |
|
176 |
params.bottomMargin = margin; |
|
177 |
params.leftMargin = margin; |
|
178 |
params.rightMargin = margin; |
|
179 |
|
|
180 | 171 |
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); |
181 |
|
|
182 |
mBackButton = new ImageButton(act); |
|
183 |
mBackButton.setLayoutParams(params); |
|
184 |
mBackButton.setPadding(padding,0,padding,0); |
|
185 |
mBackButton.setImageResource(icon); |
|
172 |
mBackButton = new TransparentImageButton(act, icon, width, LinearLayout.LayoutParams.MATCH_PARENT); |
|
186 | 173 |
|
187 | 174 |
mBackButton.setOnClickListener( new View.OnClickListener() |
188 | 175 |
{ |
... | ... | |
211 | 198 |
|
212 | 199 |
private void setupPrevButton(final RubikActivity act, final float width) |
213 | 200 |
{ |
214 |
int padding = (int)(width*RubikActivity.PADDING); |
|
215 |
int margin = (int)(width*RubikActivity.MARGIN); |
|
216 | 201 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_left,R.drawable.ui_medium_left, R.drawable.ui_big_left, R.drawable.ui_huge_left); |
217 |
|
|
218 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
|
219 |
params.topMargin = margin; |
|
220 |
params.bottomMargin = margin; |
|
221 |
params.leftMargin = margin; |
|
222 |
params.rightMargin = margin; |
|
223 |
|
|
224 |
mPrevButton = new ImageButton(act); |
|
225 |
mPrevButton.setLayoutParams(params); |
|
226 |
mPrevButton.setPadding(padding,0,padding,0); |
|
227 |
mPrevButton.setImageResource(icon); |
|
202 |
mPrevButton = new TransparentImageButton(act,icon,width,0); |
|
228 | 203 |
|
229 | 204 |
mPrevButton.setOnClickListener( new View.OnClickListener() |
230 | 205 |
{ |
... | ... | |
244 | 219 |
|
245 | 220 |
private void setupNextButton(final RubikActivity act, final float width) |
246 | 221 |
{ |
247 |
int padding = (int)(width*RubikActivity.PADDING); |
|
248 |
int margin = (int)(width*RubikActivity.MARGIN); |
|
249 | 222 |
int icon = RubikActivity.getDrawable(R.drawable.ui_small_right,R.drawable.ui_medium_right, R.drawable.ui_big_right, R.drawable.ui_huge_right); |
250 |
|
|
251 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT, 1.0f); |
|
252 |
params.topMargin = margin; |
|
253 |
params.bottomMargin = margin; |
|
254 |
params.leftMargin = margin; |
|
255 |
params.rightMargin = margin; |
|
256 |
|
|
257 |
mNextButton = new ImageButton(act); |
|
258 |
mNextButton.setLayoutParams(params); |
|
259 |
mNextButton.setPadding(padding,0,padding,0); |
|
260 |
mNextButton.setImageResource(icon); |
|
223 |
mNextButton = new TransparentImageButton(act,icon,width,0); |
|
261 | 224 |
|
262 | 225 |
mNextButton.setOnClickListener( new View.OnClickListener() |
263 | 226 |
{ |
Also available in: Unified diff
Transparent Buttons.