From 6496bafe7be526f1e66ab876b814b46a33fb814b Mon Sep 17 00:00:00 2001 From: Brayan Oliveira <69634269+brayandso@users.noreply.github.com> Date: Sun, 30 Jun 2024 14:08:32 -0300 Subject: [PATCH] feat(new reviewer): hide answer buttons --- .../com/ichi2/anki/ui/windows/reviewer/ReviewerFragment.kt | 7 +++++++ AnkiDroid/src/main/res/layout/reviewer2.xml | 6 ++++-- AnkiDroid/src/main/res/values/10-preferences.xml | 1 + AnkiDroid/src/main/res/values/preferences.xml | 1 + AnkiDroid/src/main/res/xml/preferences_reviewer.xml | 6 ++++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/reviewer/ReviewerFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/reviewer/ReviewerFragment.kt index 1924eacb4163..51881d82367a 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/reviewer/ReviewerFragment.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/reviewer/ReviewerFragment.kt @@ -24,6 +24,7 @@ import android.view.Menu import android.view.MenuItem import android.view.View import android.webkit.WebView +import android.widget.FrameLayout import androidx.activity.result.contract.ActivityResultContracts import androidx.annotation.StringRes import androidx.appcompat.view.menu.MenuBuilder @@ -165,6 +166,12 @@ class ReviewerFragment : } private fun setupAnswerButtons(view: View) { + val hideAnswerButtons = sharedPrefs().getBoolean(getString(R.string.hide_answer_buttons_key), false) + if (hideAnswerButtons) { + view.findViewById(R.id.buttons_area).isVisible = false + return + } + fun MaterialButton.setAnswerButtonNextTime(@StringRes title: Int, nextTime: String?) { val titleString = context.getString(title) text = ReviewerViewModel.buildAnswerButtonText(titleString, nextTime) diff --git a/AnkiDroid/src/main/res/layout/reviewer2.xml b/AnkiDroid/src/main/res/layout/reviewer2.xml index 5f5b525c008d..95e5707c9817 100644 --- a/AnkiDroid/src/main/res/layout/reviewer2.xml +++ b/AnkiDroid/src/main/res/layout/reviewer2.xml @@ -11,7 +11,8 @@ + android:layout_height="match_parent" + android:layout_marginBottom="4dp"> @@ -85,7 +87,7 @@ android:id="@+id/buttons_area" android:layout_width="0dp" android:layout_height="@dimen/touch_target" - android:layout_marginVertical="2dp" + android:layout_marginTop="2dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@id/webview_container" app:layout_constraintStart_toStartOf="@id/webview_container" diff --git a/AnkiDroid/src/main/res/values/10-preferences.xml b/AnkiDroid/src/main/res/values/10-preferences.xml index 03cefdecc4cd..637180daf596 100644 --- a/AnkiDroid/src/main/res/values/10-preferences.xml +++ b/AnkiDroid/src/main/res/values/10-preferences.xml @@ -443,4 +443,5 @@ this formatter is used if the bind only applies to both the question and the ans All Ignore display cutout + Hide answer buttons diff --git a/AnkiDroid/src/main/res/values/preferences.xml b/AnkiDroid/src/main/res/values/preferences.xml index 58568cf0e84e..c6d5e21737d3 100644 --- a/AnkiDroid/src/main/res/values/preferences.xml +++ b/AnkiDroid/src/main/res/values/preferences.xml @@ -203,4 +203,5 @@ hideSystemBars ignoreDisplayCutout + hideAnswerButtons \ No newline at end of file diff --git a/AnkiDroid/src/main/res/xml/preferences_reviewer.xml b/AnkiDroid/src/main/res/xml/preferences_reviewer.xml index 428b2125cd3c..7765a751050c 100644 --- a/AnkiDroid/src/main/res/xml/preferences_reviewer.xml +++ b/AnkiDroid/src/main/res/xml/preferences_reviewer.xml @@ -15,4 +15,10 @@ android:key="@string/ignore_display_cutout_key" android:title="@string/ignore_display_cutout" /> + + \ No newline at end of file