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