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 400b7f50bbe3..4dae3683524f 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 @@ -44,6 +44,7 @@ import androidx.lifecycle.lifecycleScope import com.google.android.material.appbar.MaterialToolbar import com.google.android.material.button.MaterialButton import com.google.android.material.card.MaterialCardView +import com.google.android.material.shape.ShapeAppearanceModel import com.google.android.material.textfield.TextInputEditText import com.google.android.material.textview.MaterialTextView import com.ichi2.anki.AbstractFlashcardViewer.Companion.RESULT_NO_MORE_CARDS @@ -98,6 +99,7 @@ import com.ichi2.anki.utils.ext.menu import com.ichi2.anki.utils.ext.removeSubMenu import com.ichi2.anki.utils.ext.sharedPrefs import com.ichi2.anki.utils.ext.window +import com.ichi2.anki.utils.setMargins import com.ichi2.libanki.sched.Counts import kotlinx.coroutines.launch @@ -140,6 +142,7 @@ class ReviewerFragment : } setupImmersiveMode(view) + setupFrame(view) setupTypeAnswer(view) setupAnswerButtons(view) setupCounts(view) @@ -461,6 +464,18 @@ class ReviewerFragment : } } + private fun setupFrame(view: View) { + val frameStyleKey = getString(R.string.reviewer_frame_style_key) + val boxValue = getString(R.string.reviewer_frame_style_box_value) + if (sharedPrefs().getString(frameStyleKey, null) == boxValue) { + view.findViewById(R.id.webview_container).apply { + setMargins(0) + cardElevation = 0F + shapeAppearanceModel = ShapeAppearanceModel() // Remove corners + } + } + } + private val noteEditorLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> if (result.data?.getBooleanExtra(NoteEditor.RELOAD_REQUIRED_EXTRA_KEY, false) == true || diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/utils/Layout.kt b/AnkiDroid/src/main/java/com/ichi2/anki/utils/Layout.kt new file mode 100644 index 000000000000..24f3e2e80e7b --- /dev/null +++ b/AnkiDroid/src/main/java/com/ichi2/anki/utils/Layout.kt @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Brayan Oliveira + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ +package com.ichi2.anki.utils + +import android.view.ViewGroup.MarginLayoutParams +import android.widget.FrameLayout + +fun FrameLayout.setMargins(value: Int) { + (layoutParams as? MarginLayoutParams)?.setMargins(value, value, value, value) +} diff --git a/AnkiDroid/src/main/res/layout/reviewer2.xml b/AnkiDroid/src/main/res/layout/reviewer2.xml index 4b4821bc5b96..97932507e4f1 100644 --- a/AnkiDroid/src/main/res/layout/reviewer2.xml +++ b/AnkiDroid/src/main/res/layout/reviewer2.xml @@ -79,7 +79,8 @@ + android:layout_height="match_parent" + tools:backgroundTint="@color/white"/> diff --git a/AnkiDroid/src/main/res/values/10-preferences.xml b/AnkiDroid/src/main/res/values/10-preferences.xml index 39e1cb627559..f94e06889400 100644 --- a/AnkiDroid/src/main/res/values/10-preferences.xml +++ b/AnkiDroid/src/main/res/values/10-preferences.xml @@ -204,7 +204,7 @@ Keyboard Bluetooth Answer buttons - Card + Card Note Navigation Media @@ -440,6 +440,11 @@ this formatter is used if the bind only applies to both the question and the ans Ignore display cutout Hide answer buttons Hide ‘Hard’ and ‘Easy’ buttons + Frame style + Card + Box Open settings diff --git a/AnkiDroid/src/main/res/values/constants.xml b/AnkiDroid/src/main/res/values/constants.xml index 831625016907..1f707653228c 100644 --- a/AnkiDroid/src/main/res/values/constants.xml +++ b/AnkiDroid/src/main/res/values/constants.xml @@ -241,6 +241,20 @@ @string/hide_system_bars_all_value + + @string/reviewer_frame_style_card + @string/reviewer_frame_style_box + + + 0 + 1 + + + @string/reviewer_frame_style_card_value + @string/reviewer_frame_style_box_value + + + @string/language diff --git a/AnkiDroid/src/main/res/values/preferences.xml b/AnkiDroid/src/main/res/values/preferences.xml index e150e4335d35..b4a59f5042da 100644 --- a/AnkiDroid/src/main/res/values/preferences.xml +++ b/AnkiDroid/src/main/res/values/preferences.xml @@ -204,5 +204,6 @@ hideAnswerButtons hideHardAndEasy reviewerMenuSettings + reviewerFrameStyle \ 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 707557d80e3e..59fca6845306 100644 --- a/AnkiDroid/src/main/res/xml/preferences_reviewer.xml +++ b/AnkiDroid/src/main/res/xml/preferences_reviewer.xml @@ -31,4 +31,12 @@ + + \ No newline at end of file