From 13189e0ac49ecccd02406a298aaea4b6e394fa34 Mon Sep 17 00:00:00 2001
From: SanjaySargam <sargamsanjaykumar@gmail.com>
Date: Tue, 11 Jun 2024 10:37:49 +0530
Subject: [PATCH] remove back button on large screen only

This bug existed for a long time which was unnoticed. Back button is useful on small screen when the fragment appears on a separate screen, and is not useful when the fragment appears near the deck-picker, where there is nowhere to go back to, so we could remove the button
---
 .../src/main/java/com/ichi2/anki/StudyOptionsFragment.kt     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsFragment.kt
index 0420a859afee..f614d8c4b7fe 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsFragment.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsFragment.kt
@@ -358,7 +358,10 @@ class StudyOptionsFragment : Fragment(), ChangeManager.Subscriber, Toolbar.OnMen
                 menu.findItem(R.id.action_undo).title = col?.undoLabel()
             }
             // Set the back button listener
-            if (!fragmented) {
+            if (fragmented) {
+                // when the fragment is attached to deck picker on large screen, the "back" button had no purpose, so it should be removed
+                toolbar!!.navigationIcon = null
+            } else {
                 val icon = AppCompatResources.getDrawable(requireContext(), R.drawable.ic_arrow_back_white)
                 icon!!.isAutoMirrored = true
                 toolbar!!.navigationIcon = icon