Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
BrayanDSO committed Dec 24, 2024
1 parent 3005031 commit 6256faa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReviewerBinding> {
SHOW_ANSWER(R.string.show_answer),
FLIP_OR_ANSWER_EASE1(R.string.answer_again),
FLIP_OR_ANSWER_EASE2(R.string.answer_hard),
Expand Down Expand Up @@ -134,6 +135,10 @@ enum class ViewerCommand(
preferences.edit { putString(preferenceKey, newValue) }
}

override fun getBindings(prefs: SharedPreferences): List<ReviewerBinding> {
TODO("Not yet implemented")
}

// If we use the serialised format, then this adds additional coupling to the properties.
val defaultValue: List<MappableBinding>
get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ import com.ichi2.utils.hash
import timber.log.Timber
import java.util.Objects

interface ScreenAction<B : MappableBinding> {
fun getBindings(prefs: SharedPreferences): List<B>
}

interface BindingProcessor<B : MappableBinding, A : ScreenAction<B>> {
fun executeAction(action: A)
}

/**
* Binding + additional contextual information
* Also defines equality over bindings.
Expand Down

0 comments on commit 6256faa

Please sign in to comment.