File tree Expand file tree Collapse file tree
AnkiDroid/src/main/java/com/ichi2/anki Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,18 +47,21 @@ class BrowserOptionsRepository(
4747 }
4848
4949 suspend fun setCardsOrNotes (value : CardsOrNotes ) {
50+ if (cardsOrNotes.value == value) return
5051 Timber .i(" setting cards/notes mode to %s" , value)
5152 withCol { value.saveToCollection(this ) }
5253 cardsOrNotes.value = value
5354 }
5455
5556 fun setIsTruncated (value : Boolean ) {
57+ if (isTruncated.value == value) return
5658 Timber .d(" setting truncated to %s" , value)
5759 sharedPrefs.edit { putBoolean(PREF_IS_TRUNCATED , value) }
5860 isTruncated.value = value
5961 }
6062
6163 suspend fun setIgnoreAccentsInSearch (value : Boolean ) {
64+ if (ignoreAccentsInSearch.value == value) return
6265 Timber .d(" setting ignore accents in search to %s" , value)
6366 withCol { config.ignoreAccentsInSearch = value }
6467 ignoreAccentsInSearch.value = value
Original file line number Diff line number Diff line change @@ -49,19 +49,9 @@ class BrowserOptionsDialog : AppCompatDialogFragment(R.layout.dialog_browser_opt
4949
5050 /* * Persists updated options to the ViewModel */
5151 fun saveChanges () {
52- if (cardsOrNotes != dialogCardsOrNotes) {
53- viewModel.setCardsOrNotes(dialogCardsOrNotes)
54- }
55- val newTruncate = binding.truncateCheckBox.isChecked
56-
57- if (newTruncate != isTruncated) {
58- viewModel.setTruncated(newTruncate)
59- }
60-
61- val newIgnoreAccent = binding.ignoreAccentsCheckBox.isChecked
62- if (newIgnoreAccent != viewModel.shouldIgnoreAccents) {
63- viewModel.setIgnoreAccents(newIgnoreAccent)
64- }
52+ viewModel.setCardsOrNotes(dialogCardsOrNotes)
53+ viewModel.setTruncated(binding.truncateCheckBox.isChecked)
54+ viewModel.setIgnoreAccents(binding.ignoreAccentsCheckBox.isChecked)
6555 }
6656
6757 private val cardsOrNotes by lazy {
You can’t perform that action at this time.
0 commit comments