mirror of
https://codeberg.org/monocles/monocles_chat.git
synced 2025-02-19 02:15:28 +01:00
reduce forced restarts (Christian Schneppe)
This commit is contained in:
parent
3068871366
commit
8354a681ed
2 changed files with 11 additions and 17 deletions
src/main/java/eu/siacs/conversations/ui
|
@ -206,13 +206,17 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
SharedPreferences.Editor editor = FirstStart.edit();
|
||||
editor.putLong(PREF_FIRST_START, FirstStartTime);
|
||||
editor.commit();
|
||||
// restart
|
||||
Intent restartintent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
|
||||
restartintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
restartintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(restartintent);
|
||||
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
|
||||
System.exit(0);
|
||||
// restart if storage not accessable
|
||||
if (FileBackend.getDiskSize() > 0) {
|
||||
return;
|
||||
} else {
|
||||
Intent restartintent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
|
||||
restartintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
restartintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(restartintent);
|
||||
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (useInternalUpdater()) {
|
||||
|
|
|
@ -221,17 +221,7 @@ public class ImportBackupActivity extends XmppActivity implements ServiceConnect
|
|||
|
||||
@Override
|
||||
public void onBackupRestored() {
|
||||
runOnUiThread(this::restart);
|
||||
}
|
||||
|
||||
private void restart() {
|
||||
Log.d(Config.LOGTAG, "Restarting " + getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName()));
|
||||
Intent intent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue