Skip to content

Commit

Permalink
Implement predictive back navigation in ModelFieldEditor
Browse files Browse the repository at this point in the history
Simply deleted the onBackPressed() callback as all it did was to close
the activity. Without a back callbak set, the system will handle the
back navigation itself.

The toolbar home button was already handled in the superclass AnkiActivity.
  • Loading branch information
lukstbit authored and david-allison committed Nov 9, 2023
1 parent 9115576 commit e701cfa
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions AnkiDroid/src/main/java/com/ichi2/anki/ModelFieldEditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,6 @@ class ModelFieldEditor : AnkiActivity(), LocaleSelectionDialogHandler {
}

override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
android.R.id.home -> {
onBackPressed()
true
}
R.id.action_add_new_model -> {
addFieldDialog()
true
Expand All @@ -469,12 +465,6 @@ class ModelFieldEditor : AnkiActivity(), LocaleSelectionDialogHandler {
finishWithAnimation(ActivityTransitionAnimation.Direction.END)
}

@Suppress("DEPRECATION", "Deprecated in API34+dependencies for predictive back feature")
override fun onBackPressed() {
super.onBackPressed()
closeActivity()
}

fun handleAction(contextMenuAction: ModelEditorContextMenuAction) {
when (contextMenuAction) {
ModelEditorContextMenuAction.Sort -> sortByField()
Expand Down

0 comments on commit e701cfa

Please sign in to comment.