Skip to content

Commit

Permalink
fix- Can't disable "Show remaining" and "Show button time" (ankidroid…
Browse files Browse the repository at this point in the history
…#14512)

* fix Can't disable "Show remaining & Show Button Time"(ankidroid#14502)

* initial commit

* Fix-Can't disable "Show remaining & Show Button Time"

* Fix- "minor changes in "Can't disable Show remaining & Show Button Time""
  • Loading branch information
vyom198 authored Oct 16, 2023
1 parent 4a565f3 commit c006297
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,21 @@ class AppearanceSettingsFragment : SettingsFragment() {
// whether the buttons should indicate the duration of the interval if we click on them.
requirePreference<SwitchPreferenceCompat>(R.string.show_estimates_preference).apply {
launchCatchingTask { isChecked = withCol { config.get("estTimes") ?: true } }
setOnPreferenceChangeListener { newETA ->
launchCatchingTask { withCol { config.set("estTimes", newETA) } }
setOnPreferenceChangeListener { _, newETA ->
val newETABool = newETA as? Boolean ?: return@setOnPreferenceChangeListener false
launchCatchingTask { withCol { config.set("estTimes", newETABool) } }
true
}
}
// Show progress
// Represents the collection pref "dueCounts": i.e.
// whether the remaining number of cards should be shown.
requirePreference<SwitchPreferenceCompat>(R.string.show_progress_preference).apply {
launchCatchingTask { isChecked = withCol { config.get("dueCounts") ?: true } }
setOnPreferenceChangeListener { newDueCountsValue ->
launchCatchingTask { withCol { config.set("dueCounts", newDueCountsValue) } }
setOnPreferenceChangeListener { _, newDueCountsValue ->
val newDueCountsValueBool = newDueCountsValue as? Boolean ?: return@setOnPreferenceChangeListener false
launchCatchingTask { withCol { config.set("dueCounts", newDueCountsValueBool) } }
true
}
}
}
Expand Down

0 comments on commit c006297

Please sign in to comment.