Revision 8cf17ca7
Added by Leszek Koltunski over 1 year ago
| src/main/java/org/distorted/config/ConfigActivity.java | ||
|---|---|---|
| 9 | 9 |
|
| 10 | 10 |
package org.distorted.config; |
| 11 | 11 |
|
| 12 |
import android.content.SharedPreferences; |
|
| 12 | 13 |
import android.os.Build; |
| 13 | 14 |
import android.os.Bundle; |
| 14 | 15 |
import android.util.DisplayMetrics; |
| ... | ... | |
| 18 | 19 |
import android.widget.LinearLayout; |
| 19 | 20 |
|
| 20 | 21 |
import androidx.appcompat.app.AppCompatActivity; |
| 22 |
import androidx.preference.PreferenceManager; |
|
| 21 | 23 |
|
| 22 | 24 |
import org.distorted.dialogs.RubikDialogError; |
| 23 | 25 |
import org.distorted.library.main.DistortedLibrary; |
| ... | ... | |
| 28 | 30 |
import org.distorted.objectlib.main.TwistyObject; |
| 29 | 31 |
import org.distorted.objects.RubikObject; |
| 30 | 32 |
import org.distorted.objects.RubikObjectList; |
| 33 |
import org.distorted.os.OSInterface; |
|
| 31 | 34 |
|
| 32 | 35 |
import java.io.InputStream; |
| 33 | 36 |
|
| ... | ... | |
| 139 | 142 |
super.onPause(); |
| 140 | 143 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
| 141 | 144 |
view.onPause(); |
| 145 |
savePreferences(); |
|
| 142 | 146 |
DistortedLibrary.onPause(ACTIVITY_NUMBER); |
| 143 | 147 |
} |
| 144 | 148 |
|
| ... | ... | |
| 208 | 212 |
} |
| 209 | 213 |
} |
| 210 | 214 |
|
| 215 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 216 |
|
|
| 217 |
private void savePreferences() |
|
| 218 |
{
|
|
| 219 |
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); |
|
| 220 |
SharedPreferences.Editor editor = preferences.edit(); |
|
| 221 |
|
|
| 222 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
|
| 223 |
OSInterface os = view.getInterface(); |
|
| 224 |
os.setEditor(editor); |
|
| 225 |
view.getObjectControl().savePreferences(); |
|
| 226 |
|
|
| 227 |
editor.apply(); |
|
| 228 |
} |
|
| 229 |
|
|
| 211 | 230 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 212 | 231 |
// PUBLIC API |
| 213 | 232 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/config/ConfigSurfaceView.java | ||
|---|---|---|
| 65 | 65 |
return mRenderer; |
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 69 |
|
|
| 70 |
OSInterface getInterface() |
|
| 71 |
{
|
|
| 72 |
return mInterface; |
|
| 73 |
} |
|
| 74 |
|
|
| 68 | 75 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 69 | 76 |
|
| 70 | 77 |
void resetObject() |
Also available in: Unified diff
Save the colors and sticker properties to Preferences.