Fixes switching between the two user interfaces without user having to exit app and re-start it. Fixes #138

This commit is contained in:
Graham Jones
2024-01-27 21:44:42 +00:00
parent b2a5fef2ff
commit c89d02e397
3 changed files with 39 additions and 1 deletions

View File

@@ -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());
}
}

View File

@@ -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());
}
}

View File

@@ -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 &lt;b>Data Sharing&lt;/b> feature to help improve OpenSeizureDetector!&lt;br/>