|
|
@ -36,6 +36,7 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
public class ActivityMain extends ActivityBase implements FragmentManager.OnBackStackChangedListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
|
|
|
public class ActivityMain extends ActivityBase implements FragmentManager.OnBackStackChangedListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
|
|
|
private static final long SPLASH_DELAY = 1500L; // milliseconds
|
|
|
|
private static final long SPLASH_DELAY = 1500L; // milliseconds
|
|
|
|
|
|
|
|
private static final long RESTORE_STATE_INTERVAL = 3 * 60 * 1000L; // milliseconds
|
|
|
|
private static final long SERVICE_START_DELAY = 5 * 1000L; // milliseconds
|
|
|
|
private static final long SERVICE_START_DELAY = 5 * 1000L; // milliseconds
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -165,8 +166,16 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
|
|
|
|
Intent view = new Intent(ActivityMain.this, ActivityView.class)
|
|
|
|
Intent view = new Intent(ActivityMain.this, ActivityView.class)
|
|
|
|
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// VX-N3
|
|
|
|
|
|
|
|
// https://developer.android.com/docs/quality-guidelines/core-app-quality
|
|
|
|
|
|
|
|
long now = new Date().getTime();
|
|
|
|
|
|
|
|
long last = prefs.getLong("last_launched", 0L);
|
|
|
|
|
|
|
|
if (now - last > RESTORE_STATE_INTERVAL)
|
|
|
|
|
|
|
|
view.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
|
|
|
|
|
|
|
|
|
|
|
Intent saved = args.getParcelable("intent");
|
|
|
|
Intent saved = args.getParcelable("intent");
|
|
|
|
if (saved == null) {
|
|
|
|
if (saved == null) {
|
|
|
|
|
|
|
|
prefs.edit().putLong("last_launched", now).apply();
|
|
|
|
startActivity(view, options);
|
|
|
|
startActivity(view, options);
|
|
|
|
if (sync_on_launch)
|
|
|
|
if (sync_on_launch)
|
|
|
|
ServiceUI.sync(ActivityMain.this, null);
|
|
|
|
ServiceUI.sync(ActivityMain.this, null);
|
|
|
|