Skip to content

Commit

Permalink
refactor: add autoFocusTypeAnswer to Prefs
Browse files Browse the repository at this point in the history
  • Loading branch information
BrayanDSO committed Jan 16, 2025
1 parent f6fd0fc commit 5321d68
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ object UsageAnalytics {
"useInputTag", // Type answer into the card
"disableExtendedTextUi", // Disable Single-Field Edit Mode
"noteEditorNewlineReplace", // Replace newlines with HTML
"autoFocusTypeInAnswer", // Focus ‘type in answer’
PrefKey.AUTO_FOCUS_TYPE_ANSWER, // Focus ‘type in answer’
"mediaImportAllowAllFiles", // Allow all files in media imports
"providerEnabled", // Enable AnkiDroid API
// ******************************** App bar buttons ****************************************
Expand Down
1 change: 1 addition & 0 deletions AnkiDroid/src/main/java/com/ichi2/anki/settings/PrefKey.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ object PrefKey {
const val FRAME_STYLE = "reviewerFrameStyle"
const val HIDE_SYSTEM_BARS = "hideSystemBars"
const val IGNORE_DISPLAY_CUTOUT = "ignoreDisplayCutout"
const val AUTO_FOCUS_TYPE_ANSWER = "autoFocusTypeInAnswer"

// ************************************** Accessibility ************************************* //
const val ANSWER_BUTTON_SIZE = "answerButtonSize"
Expand Down
1 change: 1 addition & 0 deletions AnkiDroid/src/main/java/com/ichi2/anki/settings/Prefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ object Prefs {
// **************************************** Reviewer **************************************** //

val ignoreDisplayCutout by booleanPref(PrefKey.IGNORE_DISPLAY_CUTOUT, false)
val autoFocusTypeAnswer by booleanPref(PrefKey.AUTO_FOCUS_TYPE_ANSWER, true)

val frameStyle: FrameStyle
get() = getEnum(PrefKey.FRAME_STYLE, FrameStyle.CARD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class ReviewerFragment :
}
}
}
val autoFocusTypeAnswer = sharedPrefs().getBoolean(getString(R.string.type_in_answer_focus_key), true)
val autoFocusTypeAnswer = Prefs.autoFocusTypeAnswer
viewModel.typeAnswerFlow.collectIn(lifecycleScope) { typeInAnswer ->
typeAnswerEditText.text = null
if (typeInAnswer == null) {
Expand Down

0 comments on commit 5321d68

Please sign in to comment.