diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt index 61c54f2d197b..66f739e50925 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt @@ -1233,8 +1233,7 @@ abstract class AbstractFlashcardViewer : // These are preferences we pull out of the collection instead of SharedPreferences try { showNextReviewTime = col.config.get("estTimes") ?: true - val preferences = baseContext.sharedPrefs() - automaticAnswer = AutomaticAnswer.createInstance(this, preferences, col) + automaticAnswer = AutomaticAnswer.createInstance(this, col) } catch (ex: Exception) { Timber.w(ex) onCollectionLoadError() diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/analytics/UsageAnalytics.kt b/AnkiDroid/src/main/java/com/ichi2/anki/analytics/UsageAnalytics.kt index ccacce170a00..e2fa793a2cc9 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/analytics/UsageAnalytics.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/analytics/UsageAnalytics.kt @@ -457,7 +457,6 @@ object UsageAnalytics { "dayOffset", // Start of next day "learnCutoff", // Learn ahead limit "timeLimit", // Timebox time limit - "timeoutAnswer", // Automatic display answer "keepScreenOn", // Disable screen timeout "doubleTapTimeInterval", // Double tap time interval (milliseconds) // Sync diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/reviewer/AutomaticAnswer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/reviewer/AutomaticAnswer.kt index b76c52ec7863..0c89a8e4ac00 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/reviewer/AutomaticAnswer.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/reviewer/AutomaticAnswer.kt @@ -16,7 +16,6 @@ package com.ichi2.anki.reviewer -import android.content.SharedPreferences import androidx.annotation.CheckResult import androidx.annotation.VisibleForTesting import com.ichi2.anki.CollectionManager.TR @@ -149,7 +148,6 @@ class AutomaticAnswer( /** Stop any "Automatic show answer" tasks in order to avoid race conditions */ fun onDisplayQuestion() { - if (!settings.useTimer) return if (!settings.autoAdvanceIfShowingQuestion) return hasPlayedSounds = false @@ -158,7 +156,6 @@ class AutomaticAnswer( /** Stop any "Automatic show question" tasks in order to avoid race conditions */ fun onDisplayAnswer() { - if (!settings.useTimer) return if (!settings.autoAdvanceIfShowingAnswer) return hasPlayedSounds = false @@ -187,7 +184,6 @@ class AutomaticAnswer( * after a user-specified duration, plus an additional delay for media */ fun scheduleAutomaticDisplayAnswer(additionalDelay: Long = 0) { - if (!settings.useTimer) return if (!settings.autoAdvanceIfShowingQuestion) return if (hasPlayedSounds) return hasPlayedSounds = true @@ -199,7 +195,6 @@ class AutomaticAnswer( * after a user-specified duration, plus an additional delay for media */ fun scheduleAutomaticDisplayQuestion(additionalMediaDelay: Long = 0) { - if (!settings.useTimer) return if (!settings.autoAdvanceIfShowingAnswer) return if (hasPlayedSounds) return hasPlayedSounds = true @@ -228,8 +223,8 @@ class AutomaticAnswer( } @CheckResult - fun createInstance(target: AutomaticallyAnswered, preferences: SharedPreferences, col: Collection): AutomaticAnswer { - val settings = AutomaticAnswerSettings.createInstance(preferences, col) + fun createInstance(target: AutomaticallyAnswered, col: Collection): AutomaticAnswer { + val settings = AutomaticAnswerSettings.createInstance(col) return AutomaticAnswer(target, settings) } } @@ -253,7 +248,6 @@ class AutomaticAnswer( */ class AutomaticAnswerSettings( val answerAction: AutomaticAnswerAction = AutomaticAnswerAction.BURY_CARD, - @get:JvmName("useTimer") val useTimer: Boolean = false, private val secondsToShowQuestionFor: Double = 60.0, private val secondsToShowAnswerFor: Double = 20.0 ) { @@ -271,24 +265,21 @@ class AutomaticAnswerSettings( */ @NeedsTest("ensure question setting maps to question parameter") fun queryOptions( - preferences: SharedPreferences, col: Collection, selectedDid: DeckId ): AutomaticAnswerSettings { val conf = col.decks.configDictForDeckId(selectedDid) val action = getAction(conf) - val useTimer = preferences.getBoolean("timeoutAnswer", false) return AutomaticAnswerSettings( answerAction = action, - useTimer = useTimer, secondsToShowQuestionFor = conf.secondsToShowQuestion, secondsToShowAnswerFor = conf.secondsToShowAnswer ) } - fun createInstance(preferences: SharedPreferences, col: Collection): AutomaticAnswerSettings { - return queryOptions(preferences, col, col.decks.selected()) + fun createInstance(col: Collection): AutomaticAnswerSettings { + return queryOptions(col, col.decks.selected()) } private fun getAction(conf: DeckConfig): AutomaticAnswerAction { diff --git a/AnkiDroid/src/main/res/values/10-preferences.xml b/AnkiDroid/src/main/res/values/10-preferences.xml index 4c057a26ecfa..39e1cb627559 100644 --- a/AnkiDroid/src/main/res/values/10-preferences.xml +++ b/AnkiDroid/src/main/res/values/10-preferences.xml @@ -128,8 +128,6 @@ More than %d cards due Vibrate Blink light - Automatic display answer - Show answer automatically without user input. Configure from deck options. Select language Disable card hardware render Hardware render is faster but may have problems, specifically on Android 8/8.1. If you cannot see parts of the card review user interface, try this setting. diff --git a/AnkiDroid/src/main/res/values/constants.xml b/AnkiDroid/src/main/res/values/constants.xml index 92e6206dbc5b..054124562708 100644 --- a/AnkiDroid/src/main/res/values/constants.xml +++ b/AnkiDroid/src/main/res/values/constants.xml @@ -249,7 +249,7 @@ @string/pref_cat_scheduling - @string/timeout_answer_text + @string/pref_keep_screen_on diff --git a/AnkiDroid/src/main/res/values/preferences.xml b/AnkiDroid/src/main/res/values/preferences.xml index 7b9f2c97823d..a0ff6de13223 100644 --- a/AnkiDroid/src/main/res/values/preferences.xml +++ b/AnkiDroid/src/main/res/values/preferences.xml @@ -13,7 +13,6 @@ dayOffset learnCutoff timeLimit - timeoutAnswer keepScreenOn doubleTapTimeInterval diff --git a/AnkiDroid/src/main/res/xml/preferences_reviewing.xml b/AnkiDroid/src/main/res/xml/preferences_reviewing.xml index 239ef2e95b19..e75765117ff0 100644 --- a/AnkiDroid/src/main/res/xml/preferences_reviewing.xml +++ b/AnkiDroid/src/main/res/xml/preferences_reviewing.xml @@ -49,14 +49,6 @@ app:min="0" app1:summaryFormat="@plurals/pref_summ_minutes"/> - - -