mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-27 08:31:03 +00:00
Ensure that crash prompt shows up when in portrait mode
- (Android lifecycle change was killing our previous Alert!)
This commit is contained in:
parent
dadf5e02a1
commit
9e9d0333cc
@ -51,6 +51,7 @@ public class Apple2Activity extends Activity {
|
||||
private ArrayList<AlertDialog> mAlertDialogs = new ArrayList<AlertDialog>();
|
||||
|
||||
private AtomicBoolean mPausing = new AtomicBoolean(false);
|
||||
private AtomicBoolean mSwitchingToPortrait = new AtomicBoolean(false);
|
||||
|
||||
// non-null if we failed to load/link the native code ... likely we are running on some bizarre 'droid variant
|
||||
private static Throwable sNativeBarfedThrowable = null;
|
||||
@ -131,14 +132,20 @@ public class Apple2Activity extends Activity {
|
||||
// NOTE: ordering here is important!
|
||||
Apple2Preferences.load(this);
|
||||
final boolean firstTime = Apple2Preferences.migrate(this);
|
||||
Apple2VideoSettingsMenu.SETTINGS.applyLandscapeMode(this);
|
||||
mSwitchingToPortrait.set(false);
|
||||
boolean switchingToPortrait = Apple2VideoSettingsMenu.SETTINGS.applyLandscapeMode(this);
|
||||
Apple2Preferences.sync(this, null);
|
||||
|
||||
Apple2DisksMenu.insertDisk((String) Apple2Preferences.getJSONPref(Apple2DisksMenu.SETTINGS.CURRENT_DISK_PATH_A), /*driveA:*/true, (boolean) Apple2Preferences.getJSONPref(Apple2DisksMenu.SETTINGS.CURRENT_DISK_PATH_A_RO));
|
||||
Apple2DisksMenu.insertDisk((String) Apple2Preferences.getJSONPref(Apple2DisksMenu.SETTINGS.CURRENT_DISK_PATH_B), /*driveA:*/false, (boolean) Apple2Preferences.getJSONPref(Apple2DisksMenu.SETTINGS.CURRENT_DISK_PATH_B_RO));
|
||||
|
||||
showSplashScreen(!firstTime);
|
||||
|
||||
// Is there a way to persist the user orientation setting such that we launch in the previously set orientation and avoid get multiple onCreate() onResume()?! ... Android lifecycle edge cases are so damn kludgishly annoying ...
|
||||
mSwitchingToPortrait.set(switchingToPortrait);
|
||||
if (!switchingToPortrait) {
|
||||
Apple2CrashHandler.getInstance().checkForCrashes(this);
|
||||
}
|
||||
|
||||
boolean extperm = true;
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
@ -223,8 +230,10 @@ public class Apple2Activity extends Activity {
|
||||
|
||||
Log.d(TAG, "onResume()");
|
||||
showSplashScreen(/*dismissable:*/true);
|
||||
if (!mSwitchingToPortrait.get()) {
|
||||
Apple2CrashHandler.getInstance().checkForCrashes(this); // NOTE : needs to be called again to clean-up
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
|
@ -224,11 +224,14 @@ public class Apple2VideoSettingsMenu extends Apple2AbstractMenu {
|
||||
return _basicView(activity, this, convertView);
|
||||
}
|
||||
|
||||
public static void applyLandscapeMode(final Apple2Activity activity) {
|
||||
public static boolean applyLandscapeMode(final Apple2Activity activity) {
|
||||
if ((boolean) Apple2Preferences.getJSONPref(SETTINGS.LANDSCAPE_MODE)) {
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||
return false;
|
||||
} else {
|
||||
int orientation = activity.getRequestedOrientation();
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
return orientation != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user