Revision 9211042f
Added by Leszek Koltunski 2 months ago
src/main/java/org/distorted/config/ConfigActivity.java | ||
---|---|---|
155 | 155 |
DistortedLibrary.onResume(ACTIVITY_NUMBER); |
156 | 156 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
157 | 157 |
view.onResume(); |
158 |
|
|
159 |
if( mScreen==null ) mScreen = new ConfigScreen(); |
|
160 |
mScreen.onAttachedToWindow(this,mObjectOrdinal); |
|
161 |
mPane = new ConfigScreenPane(this,mObjectOrdinal); |
|
158 |
String key =""; |
|
162 | 159 |
|
163 | 160 |
if( mObjectOrdinal>=0 && mObjectOrdinal< RubikObjectList.getNumObjects() ) |
164 | 161 |
{ |
165 | 162 |
RubikObject object = RubikObjectList.getObject(mObjectOrdinal); |
166 | 163 |
changeIfDifferent(object,mObjectOrdinal,view.getObjectControl()); |
164 |
if( object!=null ) key = object.getUpperName(); |
|
167 | 165 |
} |
166 |
|
|
167 |
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); |
|
168 |
restorePreferences(preferences); |
|
169 |
|
|
170 |
if( mScreen==null ) mScreen = new ConfigScreen(); |
|
171 |
mScreen.onAttachedToWindow(this,mObjectOrdinal); |
|
172 |
|
|
173 |
ObjectControl control = view.getObjectControl(); |
|
174 |
OSInterface os = view.getInterface(); |
|
175 |
TwistyObject obj = control.getObject(); |
|
176 |
|
|
177 |
mPane = new ConfigScreenPane(this,key,os); |
|
168 | 178 |
} |
169 | 179 |
|
170 | 180 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
227 | 237 |
editor.apply(); |
228 | 238 |
} |
229 | 239 |
|
240 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
241 |
|
|
242 |
private void restorePreferences(SharedPreferences preferences) |
|
243 |
{ |
|
244 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
|
245 |
OSInterface os = view.getInterface(); |
|
246 |
os.setPreferences(preferences); |
|
247 |
view.getObjectControl().restorePreferences(); |
|
248 |
} |
|
249 |
|
|
230 | 250 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
231 | 251 |
// PUBLIC API |
232 | 252 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Restore the colors and sticker properties from Preferences.