Prevent crash

pull/157/head
M66B 6 years ago
parent fee604659f
commit b3c925944d

@ -1054,7 +1054,7 @@ public class FragmentAccount extends FragmentBase {
fragment.setArguments(aargs); fragment.setArguments(aargs);
fragment.setTargetFragment(FragmentAccount.this, REQUEST_SAVE); fragment.setTargetFragment(FragmentAccount.this, REQUEST_SAVE);
fragment.show(getFragmentManager(), "account:save"); fragment.show(getFragmentManager(), "account:save");
} else } else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getFragmentManager().popBackStack(); getFragmentManager().popBackStack();
} }
@ -1346,7 +1346,8 @@ public class FragmentAccount extends FragmentBase {
@Override @Override
protected void onExecuted(Bundle args, Void data) { protected void onExecuted(Bundle args, Void data) {
getFragmentManager().popBackStack(); if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getFragmentManager().popBackStack();
} }
@Override @Override

@ -42,6 +42,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.Group; import androidx.constraintlayout.widget.Group;
import androidx.lifecycle.Lifecycle;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
@ -258,7 +259,7 @@ public class FragmentFolder extends FragmentBase {
} }
}); });
onSave(false); onSave(false);
} else } else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getFragmentManager().popBackStack(); getFragmentManager().popBackStack();
break; break;
@ -508,7 +509,7 @@ public class FragmentFolder extends FragmentBase {
ask.setArguments(aargs); ask.setArguments(aargs);
ask.setTargetFragment(FragmentFolder.this, REQUEST_SAVE_CHANGES); ask.setTargetFragment(FragmentFolder.this, REQUEST_SAVE_CHANGES);
ask.show(getFragmentManager(), "folder:save"); ask.show(getFragmentManager(), "folder:save");
} else } else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getFragmentManager().popBackStack(); getFragmentManager().popBackStack();
} }
@ -549,7 +550,8 @@ public class FragmentFolder extends FragmentBase {
@Override @Override
protected void onExecuted(Bundle args, Void data) { protected void onExecuted(Bundle args, Void data) {
getFragmentManager().popBackStack(); if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getFragmentManager().popBackStack();
} }
@Override @Override

@ -58,6 +58,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.Group; import androidx.constraintlayout.widget.Group;
import androidx.lifecycle.Lifecycle;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputLayout; import com.google.android.material.textfield.TextInputLayout;
@ -770,7 +771,7 @@ public class FragmentIdentity extends FragmentBase {
fragment.setArguments(aargs); fragment.setArguments(aargs);
fragment.setTargetFragment(FragmentIdentity.this, REQUEST_SAVE); fragment.setTargetFragment(FragmentIdentity.this, REQUEST_SAVE);
fragment.show(getFragmentManager(), "identity:save"); fragment.show(getFragmentManager(), "identity:save");
} else } else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getFragmentManager().popBackStack(); getFragmentManager().popBackStack();
} }
@ -1037,7 +1038,7 @@ public class FragmentIdentity extends FragmentBase {
} }
}); });
onSave(false); onSave(false);
} else } else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getFragmentManager().popBackStack(); getFragmentManager().popBackStack();
break; break;
case REQUEST_DELETE: case REQUEST_DELETE:
@ -1085,7 +1086,8 @@ public class FragmentIdentity extends FragmentBase {
@Override @Override
protected void onExecuted(Bundle args, Void data) { protected void onExecuted(Bundle args, Void data) {
getFragmentManager().popBackStack(); if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getFragmentManager().popBackStack();
} }
@Override @Override

Loading…
Cancel
Save