mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-27 08:01:50 +01:00
Refactoring
This commit is contained in:
@@ -161,10 +161,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
||||
public void onUserInteraction() {
|
||||
Log.i("User interaction");
|
||||
|
||||
if (!this.getClass().equals(ActivityMain.class) && Helper.shouldAuthenticate(this)) {
|
||||
finishAndRemoveTask();
|
||||
startActivity(new Intent(this, ActivityMain.class));
|
||||
}
|
||||
if (!this.getClass().equals(ActivityMain.class) && Helper.shouldAuthenticate(this))
|
||||
restart(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -205,13 +203,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
||||
}
|
||||
|
||||
private void checkAuthentication() {
|
||||
if (!this.getClass().equals(ActivityMain.class) && Helper.shouldAuthenticate(this)) {
|
||||
Intent intent = getIntent();
|
||||
finishAndRemoveTask();
|
||||
startActivity(
|
||||
new Intent(this, ActivityMain.class)
|
||||
.putExtra("intent", intent));
|
||||
}
|
||||
if (!this.getClass().equals(ActivityMain.class) && Helper.shouldAuthenticate(this))
|
||||
restart(getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -282,6 +275,15 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
||||
}
|
||||
}
|
||||
|
||||
protected void restart(Intent intent) {
|
||||
Intent main = new Intent(this, ActivityMain.class);
|
||||
if (intent != null)
|
||||
main.putExtra("intent", intent);
|
||||
main.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(main);
|
||||
finishAndRemoveTask();
|
||||
}
|
||||
|
||||
protected boolean backHandled() {
|
||||
for (IBackPressedListener listener : backPressedListeners)
|
||||
if (listener.onBackPressed())
|
||||
|
||||
Reference in New Issue
Block a user