Browse Source

Prevent crash

main
M66B 6 years ago
parent
commit
d012567435
3 changed files with 9 additions and 3 deletions
  1. +3
    -1
      app/src/main/java/eu/faircode/email/ActivityCompose.java
  2. +3
    -1
      app/src/main/java/eu/faircode/email/ActivitySetup.java
  3. +3
    -1
      app/src/main/java/eu/faircode/email/ActivityView.java

+ 3
- 1
app/src/main/java/eu/faircode/email/ActivityCompose.java View File

@ -24,6 +24,7 @@ import android.view.MenuItem;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
public class ActivityCompose extends ActivityBase implements FragmentManager.OnBackStackChangedListener {
static final int REQUEST_CONTACT_TO = 1;
@ -54,7 +55,8 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
getSupportFragmentManager().popBackStack();
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getSupportFragmentManager().popBackStack();
return true;
}
return super.onOptionsItemSelected(item);


+ 3
- 1
app/src/main/java/eu/faircode/email/ActivitySetup.java View File

@ -30,6 +30,7 @@ import java.util.List;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.Observer;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@ -83,7 +84,8 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
getSupportFragmentManager().popBackStack();
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getSupportFragmentManager().popBackStack();
return true;
}
return super.onOptionsItemSelected(item);


+ 3
- 1
app/src/main/java/eu/faircode/email/ActivityView.java View File

@ -59,6 +59,7 @@ import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.Observer;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@ -347,7 +348,8 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
switch (item.getItemId()) {
case android.R.id.home:
getSupportFragmentManager().popBackStack();
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getSupportFragmentManager().popBackStack();
return true;
default:
return false;


Loading…
Cancel
Save