Revision 6e3fcb91
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/config/ConfigScreen.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
package org.distorted.config; |
21 | 21 |
|
22 |
import android.content.res.Resources; |
|
23 |
import android.graphics.drawable.BitmapDrawable; |
|
24 | 22 |
import android.os.Build; |
25 | 23 |
import android.util.TypedValue; |
26 | 24 |
import android.view.Gravity; |
... | ... | |
46 | 44 |
|
47 | 45 |
public class ConfigScreen |
48 | 46 |
{ |
49 |
private static final int NUM_COLUMNS = 4;
|
|
47 |
private static final int NUM_COLUMNS = 5;
|
|
50 | 48 |
private static final int[] mLocation = new int[2]; |
51 | 49 |
|
52 | 50 |
private TransparentImageButton mBackButton, mObjectButton, mPrevButton, mNextButton; |
... | ... | |
63 | 61 |
|
64 | 62 |
private void setupObjectWindow(final ConfigActivity act, final float width, final float height) |
65 | 63 |
{ |
66 |
int icon = RubikActivity.getDrawable(R.drawable.cube_2s,R.drawable.cube_2m, R.drawable.cube_2b, R.drawable.cube_2h); |
|
67 |
|
|
68 |
Resources res = act.getResources(); |
|
69 |
BitmapDrawable bd = (BitmapDrawable)res.getDrawable(icon); |
|
70 |
int cubeWidth = bd.getIntrinsicWidth(); |
|
64 |
int cubeWidth = (int)(width/9); |
|
71 | 65 |
int margin = (int)(width*RubikActivity.LARGE_MARGIN); |
72 | 66 |
mObjectSize = (int)(cubeWidth + 2*margin + 0.5f); |
73 | 67 |
mMaxRowCount = (int)((height-mBarHeight)/mObjectSize); |
... | ... | |
103 | 97 |
{ |
104 | 98 |
final int ordinal = object; |
105 | 99 |
RubikObject rubikObject = RubikObjectList.getObject(ordinal); |
106 |
int iconSize = RubikActivity.getDrawableSize(); |
|
107 |
int icons = rubikObject.getIconID(iconSize); |
|
100 |
int icons = rubikObject.getIconID(); |
|
108 | 101 |
int row = object/NUM_COLUMNS; |
109 | 102 |
|
110 | 103 |
ImageButton button = new ImageButton(act); |
... | ... | |
132 | 125 |
params.leftMargin = margin; |
133 | 126 |
params.rightMargin = margin; |
134 | 127 |
|
128 |
params.width = cubeWidth; |
|
129 |
params.height= cubeWidth; |
|
130 |
|
|
135 | 131 |
nextInRow[row]++; |
136 | 132 |
|
137 | 133 |
objectGrid.addView(button, params); |
... | ... | |
183 | 179 |
int rowCount = Math.min(mMaxRowCount,mRowCount); |
184 | 180 |
View popupView = mObjectPopup.getContentView(); |
185 | 181 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS); |
186 |
displayPopup(act,view,mObjectPopup,mObjectSize*mColCount,mObjectSize*rowCount,margin,margin); |
|
182 |
displayPopup(act,view,mObjectPopup,mObjectSize*mColCount,mObjectSize*rowCount+4*margin,margin,margin);
|
|
187 | 183 |
} |
188 | 184 |
} |
189 | 185 |
}); |
Also available in: Unified diff
Remove 3 out of 4 object icons.