From 6256faae06195f1e9b782e5684124077a66af36d Mon Sep 17 00:00:00 2001 From: Brayan Oliveira <69634269+brayandso@users.noreply.github.com> Date: Tue, 24 Dec 2024 06:32:14 -0300 Subject: [PATCH] wip --- .../main/java/com/ichi2/anki/cardviewer/ViewerCommand.kt | 7 ++++++- .../main/java/com/ichi2/anki/reviewer/MappableBinding.kt | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/ViewerCommand.kt b/AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/ViewerCommand.kt index e8635969449f..32cdeb881f39 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/ViewerCommand.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/ViewerCommand.kt @@ -29,11 +29,12 @@ import com.ichi2.anki.reviewer.MappableBinding import com.ichi2.anki.reviewer.MappableBinding.Companion.fromPreference import com.ichi2.anki.reviewer.MappableBinding.Companion.toPreferenceString import com.ichi2.anki.reviewer.ReviewerBinding +import com.ichi2.anki.reviewer.ScreenAction /** Abstraction: Discuss moving many of these to 'Reviewer' */ enum class ViewerCommand( val resourceId: Int, -) { +) : ScreenAction { SHOW_ANSWER(R.string.show_answer), FLIP_OR_ANSWER_EASE1(R.string.answer_again), FLIP_OR_ANSWER_EASE2(R.string.answer_hard), @@ -134,6 +135,10 @@ enum class ViewerCommand( preferences.edit { putString(preferenceKey, newValue) } } + override fun getBindings(prefs: SharedPreferences): List { + TODO("Not yet implemented") + } + // If we use the serialised format, then this adds additional coupling to the properties. val defaultValue: List get() { diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/reviewer/MappableBinding.kt b/AnkiDroid/src/main/java/com/ichi2/anki/reviewer/MappableBinding.kt index 57dcb6fdc32a..91bbfbc69f5c 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/reviewer/MappableBinding.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/reviewer/MappableBinding.kt @@ -31,6 +31,14 @@ import com.ichi2.utils.hash import timber.log.Timber import java.util.Objects +interface ScreenAction { + fun getBindings(prefs: SharedPreferences): List +} + +interface BindingProcessor> { + fun executeAction(action: A) +} + /** * Binding + additional contextual information * Also defines equality over bindings.