Revision c826d83b
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/config/ConfigScreenPane.java | ||
---|---|---|
70 | 70 |
|
71 | 71 |
void updatePane(ConfigActivity act, int objectOrdinal) |
72 | 72 |
{ |
73 |
JsonReader reader = JsonReader.getInstance();
|
|
73 |
RubikObject object = RubikObjectList.getObject(objectOrdinal);
|
|
74 | 74 |
|
75 |
mObjectOrdinal = objectOrdinal; |
|
75 |
if( object!=null ) |
|
76 |
{ |
|
77 |
InputStream stream = object.getObjectStream(act); |
|
76 | 78 |
|
77 |
RubikObject object = RubikObjectList.getObject(objectOrdinal);
|
|
78 |
InputStream stream = object.getObjectStream(act);
|
|
79 |
reader.parseJsonFileMetadata(stream); |
|
79 |
mObjectOrdinal = objectOrdinal;
|
|
80 |
JsonReader reader = JsonReader.getInstance();
|
|
81 |
reader.parseJsonFileMetadata(stream);
|
|
80 | 82 |
|
81 |
String name = reader.getObjectName(); |
|
82 |
String author = reader.getInventor(); |
|
83 |
int year = reader.getYearOfInvention(); |
|
84 |
String both = year>0 ? author+" "+year : author; |
|
83 |
String name = reader.getObjectName();
|
|
84 |
String author = reader.getInventor();
|
|
85 |
int year = reader.getYearOfInvention();
|
|
86 |
String both = year>0 ? author+" "+year : author;
|
|
85 | 87 |
|
86 |
LinearLayout layout = act.findViewById(R.id.configLayout); |
|
87 |
TextView view = layout.findViewById(R.id.configDetailsName2); |
|
88 |
view.setText(name); |
|
89 |
view = layout.findViewById(R.id.configDetailsAuthor2); |
|
90 |
view.setText(both); |
|
88 |
LinearLayout layout = act.findViewById(R.id.configLayout);
|
|
89 |
TextView view = layout.findViewById(R.id.configDetailsName2);
|
|
90 |
view.setText(name);
|
|
91 |
view = layout.findViewById(R.id.configDetailsAuthor2);
|
|
92 |
view.setText(both);
|
|
91 | 93 |
|
92 |
int difficulty = reader.getComplexity(); |
|
94 |
int difficulty = reader.getComplexity();
|
|
93 | 95 |
|
94 |
if( difficulty<0 ) difficulty=0; |
|
95 |
if( difficulty>NUM_IMAGES ) difficulty=NUM_IMAGES; |
|
96 |
if( difficulty<0 ) difficulty=0;
|
|
97 |
if( difficulty>NUM_IMAGES ) difficulty=NUM_IMAGES;
|
|
96 | 98 |
|
97 |
for(int i=0; i<NUM_IMAGES; i++) |
|
98 |
{ |
|
99 |
ImageView image = layout.findViewById(IMAGES[i]); |
|
100 |
image.setImageResource( i==difficulty ? R.drawable.ui_difficulty_checked : R.drawable.ui_difficulty_unchecked ); |
|
101 |
} |
|
99 |
for(int i=0; i<NUM_IMAGES; i++)
|
|
100 |
{
|
|
101 |
ImageView image = layout.findViewById(IMAGES[i]);
|
|
102 |
image.setImageResource( i==difficulty ? R.drawable.ui_difficulty_checked : R.drawable.ui_difficulty_unchecked );
|
|
103 |
}
|
|
102 | 104 |
|
103 |
int meshState = object.getMeshState(); |
|
104 |
int id = meshState==MESH_NICE ? R.id.meshNice : R.id.meshSimple; |
|
105 |
RadioButton button = act.findViewById(id); |
|
105 |
int meshState = object.getMeshState();
|
|
106 |
int id = meshState==MESH_NICE ? R.id.meshNice : R.id.meshSimple;
|
|
107 |
RadioButton button = act.findViewById(id);
|
|
106 | 108 |
|
107 |
mProgramatic = true; |
|
108 |
button.setChecked(true); |
|
109 |
mProgramatic = false; |
|
109 |
mProgramatic = true; |
|
110 |
button.setChecked(true); |
|
111 |
mProgramatic = false; |
|
112 |
} |
|
110 | 113 |
} |
111 | 114 |
|
112 | 115 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Fix for a crasher