Fixes switching between the two user interfaces without user having to exit app and re-start it. Fixes #138
This commit is contained in:
@@ -1087,6 +1087,25 @@ public class MainActivity extends AppCompatActivity {
|
||||
super.onResume();
|
||||
Log.i(TAG, "onResume()");
|
||||
mUtil.writeToSysLogFile("MainActivity.onResume()");
|
||||
|
||||
// Check to see if the user has asked for the new user interface to be used instead of this one
|
||||
// and start that if necessary.
|
||||
try {
|
||||
SharedPreferences SP = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
boolean useNewUi = SP.getBoolean("UseNewUi", false);
|
||||
if (useNewUi) {
|
||||
Log.i(TAG,"onResume() - launching new User Interface");
|
||||
Intent intent = new Intent(
|
||||
getApplicationContext(),
|
||||
MainActivity2.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Log.e(TAG, "exception starting main activity " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -136,6 +136,24 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
.add(R.id.fragment_common_container_view, FragmentCommon.class, null)
|
||||
.commit();
|
||||
|
||||
// Check to see if the user has asked for the original user interface to be used instead of this one
|
||||
// and start that if necessary.
|
||||
try {
|
||||
SharedPreferences SP = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
boolean useNewUi = SP.getBoolean("UseNewUi", false);
|
||||
if (!useNewUi) {
|
||||
Log.i(TAG,"onResume() - launching original User Interface");
|
||||
Intent intent = new Intent(
|
||||
getApplicationContext(),
|
||||
MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Log.e(TAG, "exception starting main activity " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
<string name="app_name">OpenSeizureDetector</string>
|
||||
<string name="changelog">
|
||||
"\n
|
||||
\nV4.2.1 - Added Machine Learning Model Manager so models can be updated easily.
|
||||
\nV4.2.1 - Added support for PineTime Watches using Bluetooth data source.
|
||||
\n - Added new, swipeable user interface to simplify the main screen..
|
||||
"</string>
|
||||
<string name="UpgradeMsg">
|
||||
Please enable the new <b>Data Sharing</b> feature to help improve OpenSeizureDetector!<br/>
|
||||
|
||||
Reference in New Issue
Block a user