mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-29 21:34:44 +02:00
Android 13: use on back invoked
This commit is contained in:
@@ -36,7 +36,6 @@ import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -55,6 +54,7 @@ import android.widget.ScrollView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
@@ -491,16 +491,10 @@ public class FragmentIdentity extends FragmentBase {
|
||||
}
|
||||
});
|
||||
|
||||
addKeyPressedListener(new ActivityBase.IKeyPressedListener() {
|
||||
getActivity().getOnBackPressedDispatcher().addCallback(getViewLifecycleOwner(), new OnBackPressedCallback(true) {
|
||||
@Override
|
||||
public boolean onKeyPressed(KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
public void handleOnBackPressed() {
|
||||
onSave(true);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1045,7 +1039,7 @@ public class FragmentIdentity extends FragmentBase {
|
||||
fragment.setTargetFragment(FragmentIdentity.this, REQUEST_SAVE);
|
||||
fragment.show(getParentFragmentManager(), "identity:save");
|
||||
} else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||
getParentFragmentManager().popBackStack();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1419,8 +1413,8 @@ public class FragmentIdentity extends FragmentBase {
|
||||
}
|
||||
});
|
||||
onSave(false);
|
||||
} else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||
getParentFragmentManager().popBackStack();
|
||||
} else
|
||||
finish();
|
||||
break;
|
||||
case REQUEST_DELETE:
|
||||
if (resultCode == RESULT_OK)
|
||||
@@ -1461,8 +1455,7 @@ public class FragmentIdentity extends FragmentBase {
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||
getParentFragmentManager().popBackStack();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user