Revision 2604be3b
Added by Leszek Koltunski almost 3 years ago
src/main/java/org/distorted/config/ConfigScreenPane.java | ||
---|---|---|
20 | 20 |
package org.distorted.config; |
21 | 21 |
|
22 | 22 |
import android.util.TypedValue; |
23 |
import android.widget.ImageView; |
|
23 | 24 |
import android.widget.LinearLayout; |
24 | 25 |
import android.widget.RadioButton; |
25 | 26 |
import android.widget.RadioGroup; |
... | ... | |
38 | 39 |
|
39 | 40 |
public class ConfigScreenPane |
40 | 41 |
{ |
42 |
private static final int[] IMAGES = |
|
43 |
{ |
|
44 |
R.id.configDifficulty0, |
|
45 |
R.id.configDifficulty1, |
|
46 |
R.id.configDifficulty2, |
|
47 |
R.id.configDifficulty3, |
|
48 |
R.id.configDifficulty4 |
|
49 |
}; |
|
50 |
|
|
51 |
private static final int NUM_IMAGES = IMAGES.length; |
|
41 | 52 |
private static final float PADDING_RATIO = 0.015f; |
42 | 53 |
private static final float TEXT_RATIO = 0.025f; |
43 | 54 |
private static final float RADIO_RATIO = 0.900f; |
... | ... | |
74 | 85 |
view.setText(name); |
75 | 86 |
view = layout.findViewById(R.id.configDetailsAuthor2); |
76 | 87 |
view.setText(both); |
88 |
|
|
89 |
int difficulty = mReader.getComplexity(); |
|
90 |
|
|
91 |
if( difficulty<0 ) difficulty=0; |
|
92 |
if( difficulty>NUM_IMAGES ) difficulty=NUM_IMAGES; |
|
93 |
|
|
94 |
for(int i=0; i<NUM_IMAGES; i++) |
|
95 |
{ |
|
96 |
ImageView image = layout.findViewById(IMAGES[i]); |
|
97 |
image.setBackgroundResource( i==difficulty ? R.drawable.difficulty_background : 0 ); |
|
98 |
} |
|
77 | 99 |
} |
78 | 100 |
|
79 | 101 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Progress with ConfigPane.