Revision 6e3fcb91
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/screens/RubikScreenPlay.java | ||
---|---|---|
55 | 55 |
|
56 | 56 |
public class RubikScreenPlay extends RubikScreenBase |
57 | 57 |
{ |
58 |
public static final int NUM_COLUMNS = 4;
|
|
58 |
public static final int NUM_COLUMNS = 5;
|
|
59 | 59 |
public static final int LEVELS_SHOWN = 10; |
60 | 60 |
|
61 | 61 |
private static final int[] BUTTON_LABELS = { R.string.scores, |
... | ... | |
78 | 78 |
private int mColCount, mRowCount, mMaxRowCount; |
79 | 79 |
private int mUpperBarHeight; |
80 | 80 |
private boolean mShouldReactToEndOfScrambling; |
81 |
private int mBottomHeight; |
|
81 | 82 |
|
82 | 83 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
83 | 84 |
|
... | ... | |
124 | 125 |
private void setupObjectButton(final RubikActivity act, final float width) |
125 | 126 |
{ |
126 | 127 |
final int margin = (int)(width*RubikActivity.MARGIN); |
128 |
final int lMargin = (int)(width*RubikActivity.LARGE_MARGIN); |
|
127 | 129 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_menu,R.drawable.ui_medium_cube_menu, R.drawable.ui_big_cube_menu, R.drawable.ui_huge_cube_menu); |
128 | 130 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f); |
129 | 131 |
mObjButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params); |
... | ... | |
145 | 147 |
int rowCount = Math.min(mMaxRowCount,mRowCount); |
146 | 148 |
View popupView = mObjectPopup.getContentView(); |
147 | 149 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS); |
148 |
displayPopup(act,view,mObjectPopup,mObjectSize*mColCount,mObjectSize*rowCount,margin,margin); |
|
150 |
displayPopup(act,view,mObjectPopup,mObjectSize*mColCount,mObjectSize*rowCount+mBottomHeight+2*lMargin,margin,margin);
|
|
149 | 151 |
} |
150 | 152 |
} |
151 | 153 |
}); |
... | ... | |
222 | 224 |
|
223 | 225 |
private void setupObjectWindow(final RubikActivity act, final float width, final float height) |
224 | 226 |
{ |
225 |
int icon = RubikActivity.getDrawable(R.drawable.cube_2s,R.drawable.cube_2m, R.drawable.cube_2b, R.drawable.cube_2h); |
|
226 |
|
|
227 |
Resources res = act.getResources(); |
|
228 |
BitmapDrawable bd = (BitmapDrawable)res.getDrawable(icon); |
|
229 |
int cubeWidth = bd.getIntrinsicWidth(); |
|
227 |
int cubeWidth = (int)(width/9); |
|
230 | 228 |
int margin = (int)(width*RubikActivity.LARGE_MARGIN); |
231 | 229 |
mObjectSize = (int)(cubeWidth + 2*margin + 0.5f); |
232 | 230 |
mMaxRowCount = (int)((height-1.8f*mUpperBarHeight)/mObjectSize); |
... | ... | |
241 | 239 |
objectGrid.setRowCount(mRowCount); |
242 | 240 |
|
243 | 241 |
LinearLayout bottomLayout = view.findViewById(R.id.bottomLayout); |
244 |
setupBottomLayout(act,bottomLayout,2*mObjectSize);
|
|
242 |
setupBottomLayout(act,bottomLayout,(NUM_COLUMNS-2)*mObjectSize);
|
|
245 | 243 |
|
246 | 244 |
mObjectPopup = new PopupWindow(act); |
247 | 245 |
mObjectPopup.setFocusable(true); |
... | ... | |
264 | 262 |
for(int object=0; object<numObjects; object++) |
265 | 263 |
{ |
266 | 264 |
final RubikObject robject = RubikObjectList.getObject(object); |
267 |
int iconSize = RubikActivity.getDrawableSize(); |
|
268 |
int icons = robject==null ? 0 : robject.getIconID(iconSize); |
|
265 |
int icons = robject==null ? 0 : robject.getIconID(); |
|
269 | 266 |
int row = object/NUM_COLUMNS; |
270 | 267 |
final int ordinal = robject==null ? 0 : robject.getOrdinal(); |
271 | 268 |
|
... | ... | |
294 | 291 |
params.leftMargin = margin; |
295 | 292 |
params.rightMargin = margin; |
296 | 293 |
|
294 |
params.width = cubeWidth; |
|
295 |
params.height= cubeWidth; |
|
296 |
|
|
297 | 297 |
nextInRow[row]++; |
298 | 298 |
|
299 | 299 |
objectGrid.addView(button, params); |
... | ... | |
317 | 317 |
|
318 | 318 |
buttonNul.setWidth(width); |
319 | 319 |
|
320 |
Resources res = act.getResources(); |
|
321 |
BitmapDrawable bd = (BitmapDrawable)res.getDrawable(iconD); |
|
322 |
mBottomHeight = bd.getIntrinsicHeight(); |
|
323 |
|
|
320 | 324 |
TypedValue outValue = new TypedValue(); |
321 | 325 |
act.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true); |
322 | 326 |
buttonTut.setBackgroundResource(outValue.resourceId); |
Also available in: Unified diff
Remove 3 out of 4 object icons.