Revision 804293f0
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/config/ConfigScreenPane.java | ||
---|---|---|
55 | 55 |
private static final float TEXT_RATIO = 0.042f; |
56 | 56 |
private static final float RADIO_RATIO = 0.900f; |
57 | 57 |
|
58 |
private JsonReader mReader; |
|
59 | 58 |
private int mObjectOrdinal; |
60 | 59 |
private boolean mProgramatic; |
61 | 60 |
|
... | ... | |
72 | 71 |
|
73 | 72 |
void updatePane(ConfigActivity act, int objectOrdinal) |
74 | 73 |
{ |
75 |
if( mReader==null ) mReader = new JsonReader();
|
|
74 |
JsonReader reader = JsonReader.getInstance();
|
|
76 | 75 |
|
77 | 76 |
mObjectOrdinal = objectOrdinal; |
78 | 77 |
|
79 | 78 |
RubikObject object = RubikObjectList.getObject(objectOrdinal); |
80 | 79 |
int jsonID = object.getJsonID(); |
81 |
InputStream stream = ObjectJson.getStream(jsonID,act); |
|
82 |
mReader.parseJsonFileMetadata(stream);
|
|
80 |
InputStream stream = ObjectJson.getObjectStream(jsonID,act);
|
|
81 |
reader.parseJsonFileMetadata(stream);
|
|
83 | 82 |
|
84 |
String name = mReader.getObjectName();
|
|
85 |
String author = mReader.getInventor();
|
|
86 |
int year = mReader.getYearOfInvention();
|
|
83 |
String name = reader.getObjectName();
|
|
84 |
String author = reader.getInventor();
|
|
85 |
int year = reader.getYearOfInvention();
|
|
87 | 86 |
String both = year>0 ? author+" "+year : author; |
88 | 87 |
|
89 | 88 |
LinearLayout layout = act.findViewById(R.id.configLayout); |
... | ... | |
92 | 91 |
view = layout.findViewById(R.id.configDetailsAuthor2); |
93 | 92 |
view.setText(both); |
94 | 93 |
|
95 |
int difficulty = mReader.getComplexity();
|
|
94 |
int difficulty = reader.getComplexity();
|
|
96 | 95 |
|
97 | 96 |
if( difficulty<0 ) difficulty=0; |
98 | 97 |
if( difficulty>NUM_IMAGES ) difficulty=NUM_IMAGES; |
Also available in: Unified diff
Re-organize tutorial list so that we can pull this one from JSON files.