Added option to use the new or the old user interface
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:versionCode="128"
|
||||
android:versionName="4.2.1e">
|
||||
android:versionName="4.2.1f">
|
||||
<!-- android:allowBackup="false" -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
|
||||
@@ -157,6 +157,7 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
private final IBinder mBinder = new SdBinder();
|
||||
|
||||
public LogManager mLm;
|
||||
private boolean mUseNewUi;
|
||||
|
||||
/**
|
||||
* class to handle binding the MainApp activity to this service
|
||||
@@ -517,7 +518,12 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
soundUri = null;
|
||||
}
|
||||
|
||||
Intent i = new Intent(getApplicationContext(), MainActivity2.class);
|
||||
Intent i;
|
||||
if (mUseNewUi) {
|
||||
i = new Intent(getApplicationContext(), MainActivity2.class);
|
||||
} else {
|
||||
i = new Intent(getApplicationContext(), MainActivity.class);
|
||||
}
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
PendingIntent contentIntent =
|
||||
PendingIntent.getActivity(this,
|
||||
@@ -569,7 +575,12 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
mUtil.writeToSysLogFile("SdServer.showMainActivity - Activity is already shown on top, not doing anything");
|
||||
} else {
|
||||
Log.i(TAG, "showMainActivity(): Showing Main Activity");
|
||||
Intent i = new Intent(getApplicationContext(), MainActivity2.class);
|
||||
Intent i;
|
||||
if (mUseNewUi) {
|
||||
i = new Intent(getApplicationContext(), MainActivity2.class);
|
||||
} else {
|
||||
i = new Intent(getApplicationContext(), MainActivity.class);
|
||||
}
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
this.startActivity(i);
|
||||
}
|
||||
@@ -1285,6 +1296,8 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
mOSDUrl = SP.getString("OSDUrl", "http://openseizuredetector.org.uk/webApi");
|
||||
Log.v(TAG, "updatePrefs() - mOSDUrl = " + mOSDUrl);
|
||||
mUtil.writeToSysLogFile("updatePrefs() - mOSDUrl = " + mOSDUrl);
|
||||
|
||||
mUseNewUi = SP.getBoolean("UseNewUi", false);
|
||||
} catch (Exception ex) {
|
||||
Log.v(TAG, "updatePrefs() - Problem parsing preferences!");
|
||||
mUtil.writeToSysLogFile("SdServer.updatePrefs() - Error " + ex.toString());
|
||||
@@ -1733,7 +1746,12 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
iconId = R.drawable.datasharing_fault_24x24;
|
||||
titleStr = getString(R.string.datasharing_notification_title);
|
||||
|
||||
Intent i = new Intent(getApplicationContext(), MainActivity2.class);
|
||||
Intent i;
|
||||
if (mUseNewUi) {
|
||||
i = new Intent(getApplicationContext(), MainActivity2.class);
|
||||
} else {
|
||||
i = new Intent(getApplicationContext(), MainActivity.class);
|
||||
}
|
||||
i.putExtra("action", "showDataSharingDialog");
|
||||
i.setAction("showDataSharingDialog");
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
@@ -181,6 +181,7 @@ public class StartupActivity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
mConnection = new SdServiceConnection(getApplicationContext());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -428,9 +429,17 @@ public class StartupActivity extends AppCompatActivity {
|
||||
Log.i(TAG, "serverStatusRunnable() - starting main activity...");
|
||||
mUtil.writeToSysLogFile("StartupActivity.serverStatusRunnable - all checks ok - starting main activity.");
|
||||
try {
|
||||
Intent intent = new Intent(
|
||||
Boolean useNewUi = SP.getBoolean("UseNewUi", false);
|
||||
Intent intent;
|
||||
if (useNewUi) {
|
||||
intent = new Intent(
|
||||
getApplicationContext(),
|
||||
MainActivity2.class);
|
||||
} else {
|
||||
intent = new Intent(
|
||||
getApplicationContext(),
|
||||
MainActivity.class);
|
||||
}
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
startActivity(intent);
|
||||
mStartedMainActivity = true;
|
||||
|
||||
@@ -560,4 +560,6 @@
|
||||
<string name="tab_text_2">Tab 2</string>
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="use_new_ui_summary">Use new swipeable user interface</string>
|
||||
<string name="use_new_ui_title">Use New User Interface</string>
|
||||
</resources>
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
android:entryValues="@array/datasource_list_values"
|
||||
android:defaultValue="Phone"
|
||||
android:dialogTitle="@string/select_datasource_title" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="UseNewUi"
|
||||
android:summary="@string/use_new_ui_summary"
|
||||
android:title="@string/use_new_ui_title" />
|
||||
<!--
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
|
||||
Reference in New Issue
Block a user