mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-14 03:30:53 +00:00
First cut at support for Android versioning and data migrations
This commit is contained in:
parent
d819220a07
commit
a761c11382
@ -17,6 +17,7 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -155,8 +156,12 @@ public class Apple2Activity extends Activity {
|
|||||||
String dataDir = Apple2DisksMenu.getDataDir(this);
|
String dataDir = Apple2DisksMenu.getDataDir(this);
|
||||||
nativeOnCreate(dataDir, sampleRate, monoBufferSize, stereoBufferSize);
|
nativeOnCreate(dataDir, sampleRate, monoBufferSize, stereoBufferSize);
|
||||||
|
|
||||||
final boolean firstTime = !Apple2Preferences.FIRST_TIME_CONFIGURED.booleanValue(this);
|
final boolean firstTime = (Apple2Preferences.EMULATOR_VERSION.intValue(this) != BuildConfig.VERSION_CODE);
|
||||||
Apple2Preferences.FIRST_TIME_CONFIGURED.saveBoolean(this, true);
|
if (firstTime) {
|
||||||
|
// allow for primitive migrations as needed
|
||||||
|
Apple2Preferences.EMULATOR_VERSION.saveInt(this, BuildConfig.VERSION_CODE);
|
||||||
|
Log.v(TAG, "Triggering migration to Apple2ix version : "+BuildConfig.VERSION_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
showSplashScreen(!firstTime);
|
showSplashScreen(!firstTime);
|
||||||
Apple2CrashHandler.getInstance().checkForCrashes(this);
|
Apple2CrashHandler.getInstance().checkForCrashes(this);
|
||||||
|
@ -18,18 +18,19 @@ import android.util.Log;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.deadc0de.apple2ix.basic.BuildConfig;
|
||||||
import org.deadc0de.apple2ix.basic.R;
|
import org.deadc0de.apple2ix.basic.R;
|
||||||
|
|
||||||
public enum Apple2Preferences {
|
public enum Apple2Preferences {
|
||||||
FIRST_TIME_CONFIGURED {
|
EMULATOR_VERSION {
|
||||||
@Override
|
@Override
|
||||||
public void load(Apple2Activity activity) {
|
public void load(Apple2Activity activity) {
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveBoolean(Apple2Activity activity, boolean ignored) {
|
public void saveInt(Apple2Activity activity, int version) {
|
||||||
activity.getPreferences(Context.MODE_PRIVATE).edit().putBoolean(toString(), true).apply();
|
activity.getPreferences(Context.MODE_PRIVATE).edit().putInt(toString(), version).apply();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CURRENT_DISK_PATH {
|
CURRENT_DISK_PATH {
|
||||||
@ -955,7 +956,7 @@ public enum Apple2Preferences {
|
|||||||
|
|
||||||
public static void resetPreferences(Apple2Activity activity) {
|
public static void resetPreferences(Apple2Activity activity) {
|
||||||
activity.getPreferences(Context.MODE_PRIVATE).edit().clear().commit();
|
activity.getPreferences(Context.MODE_PRIVATE).edit().clear().commit();
|
||||||
FIRST_TIME_CONFIGURED.saveBoolean(activity, true);
|
EMULATOR_VERSION.saveInt(activity, BuildConfig.VERSION_CODE);
|
||||||
KeypadPreset.IJKM_SPACE.apply(activity);
|
KeypadPreset.IJKM_SPACE.apply(activity);
|
||||||
loadPreferences(activity);
|
loadPreferences(activity);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user