M66B 2021-08-23 11:46:46 +02:00
parent 6cc8fbd1e3
commit 5231f8eea5
1 changed files with 9 additions and 0 deletions

View File

@ -36,6 +36,7 @@ import java.util.List;
public class ActivityMain extends ActivityBase implements FragmentManager.OnBackStackChangedListener, SharedPreferences.OnSharedPreferenceChangeListener {
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
@Override
@ -165,8 +166,16 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
Intent view = new Intent(ActivityMain.this, ActivityView.class)
.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");
if (saved == null) {
prefs.edit().putLong("last_launched", now).apply();
startActivity(view, options);
if (sync_on_launch)
ServiceUI.sync(ActivityMain.this, null);