Revision 57ba16f3
Added by Leszek Koltunski about 8 years ago
src/main/java/org/distorted/examples/cubes/CubesActivity.java | ||
---|---|---|
63 | 63 |
mColsPicker = (NumberPicker)findViewById(R.id.cubespicker_cols); |
64 | 64 |
mRowsPicker = (NumberPicker)findViewById(R.id.cubespicker_rows); |
65 | 65 |
|
66 |
mColsPicker.setMaxValue(10);
|
|
66 |
mColsPicker.setMaxValue(40);
|
|
67 | 67 |
mColsPicker.setMinValue( 0); |
68 |
mRowsPicker.setMaxValue(10);
|
|
68 |
mRowsPicker.setMaxValue(40);
|
|
69 | 69 |
mRowsPicker.setMinValue( 0); |
70 | 70 |
|
71 | 71 |
mColsPicker.setOnValueChangedListener(new OnValueChangeListener() |
... | ... | |
96 | 96 |
|
97 | 97 |
int width = mLay.getWidth(); |
98 | 98 |
int height= mLay.getHeight(); |
99 |
int w = mNumCols>0 ? (width / mNumCols) -10 : 0;
|
|
100 |
int h = mNumRows>0 ? (height/ mNumRows) -10 : 0;
|
|
99 |
int w = mNumCols>0 ? (int)( 0.9f*width / mNumCols) : 0;
|
|
100 |
int h = mNumRows>0 ? (int)( 0.9f*height/ mNumRows) : 0;
|
|
101 | 101 |
int size= w<h ? w:h; |
102 |
int pad = size/20; |
|
102 |
int pad = size<20 ? 1 : size/20;
|
|
103 | 103 |
|
104 | 104 |
mLay.removeAllViews(); |
105 | 105 |
|
... | ... | |
125 | 125 |
b.setOnClickListener(this); |
126 | 126 |
b.setId(rows*mNumCols+cols); |
127 | 127 |
b.setLayoutParams(p); |
128 |
b.setBackgroundColor(COLOR_OFF);
|
|
128 |
b.setBackgroundColor(COLOR_ON);
|
|
129 | 129 |
tr.addView(b, p); |
130 |
mShape[rows*mNumCols+cols] = false;
|
|
130 |
mShape[rows*mNumCols+cols] = true;
|
|
131 | 131 |
} |
132 | 132 |
|
133 | 133 |
mLay.addView(tr); |
src/main/java/org/distorted/examples/effects3d/Effects3DActivity.java | ||
---|---|---|
174 | 174 |
|
175 | 175 |
int width = lay.getWidth(); |
176 | 176 |
int height= lay.getHeight(); |
177 |
int w = mNumCols>0 ? (width / mNumCols) -10 : 0;
|
|
178 |
int h = mNumRows>0 ? (height/ mNumRows) -10 : 0;
|
|
177 |
int w = mNumCols>0 ? (int)( 0.9f*width / mNumCols) : 0;
|
|
178 |
int h = mNumRows>0 ? (int)( 0.9f*height/ mNumRows) : 0;
|
|
179 | 179 |
int size= w<h ? w:h; |
180 |
int pad = size/20; |
|
180 |
int pad = size<20 ? 1 : size/20;
|
|
181 | 181 |
|
182 | 182 |
lay.removeAllViews(); |
183 | 183 |
|
Also available in: Unified diff
Minor