Added option to use the new or the old user interface
This commit is contained in:
@@ -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(
|
||||
getApplicationContext(),
|
||||
MainActivity2.class);
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user