fixex problem with multiple versions of MainActvity being started by StartUpActivity
This commit is contained in:
@@ -34,7 +34,9 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:icon="@drawable/star_of_life_48x48"
|
||||
android:label="@string/app_name" >
|
||||
android:label="@string/app_name"
|
||||
android:exported="true"
|
||||
>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".PrefActivity"
|
||||
|
||||
@@ -311,7 +311,9 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
}
|
||||
Intent i = new Intent(getApplicationContext(), MainActivity.class);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
PendingIntent contentIntent =
|
||||
PendingIntent.getActivity(this,
|
||||
0, i, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
|
||||
Notification notification = builder.setContentIntent(contentIntent)
|
||||
.setSmallIcon(iconId)
|
||||
|
||||
@@ -60,6 +60,7 @@ public class StartupActivity extends Activity {
|
||||
private OsdUtil mUtil;
|
||||
private Timer mUiTimer;
|
||||
private SdServiceConnection mConnection;
|
||||
private boolean mStartedMainActivity = false;
|
||||
final Handler mServerStatusHandler = new Handler(); // used to update ui from mUiTimer
|
||||
|
||||
|
||||
@@ -282,6 +283,7 @@ public class StartupActivity extends Activity {
|
||||
// If all the parameters are ok, close this activity and open the main
|
||||
// user interface activity instead.
|
||||
if (allOk) {
|
||||
if (!mStartedMainActivity) {
|
||||
Log.v(TAG, "starting main activity...");
|
||||
try {
|
||||
Intent intent = new Intent(
|
||||
@@ -289,11 +291,15 @@ public class StartupActivity extends Activity {
|
||||
MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
startActivity(intent);
|
||||
mStartedMainActivity = true;
|
||||
finish();
|
||||
} catch (Exception ex) {
|
||||
Log.v(TAG, "exception starting settings activity " + ex.toString());
|
||||
mStartedMainActivity = false;
|
||||
Log.v(TAG, "exception starting main activity " + ex.toString());
|
||||
}
|
||||
} else {
|
||||
Log.v(TAG,"allOk, but already started MainActivity so not doing anything");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user