Skip to content

Commit

Permalink
fix(browse): theme change with no state refresh
Browse files Browse the repository at this point in the history
* cards.reset() is no longer needed
* onCleared is no longer needed:
  * It's called when the theme changes, and we didn't actually
want this, as we wanted to persist the rows in the ViewModel
  • Loading branch information
david-allison committed Jan 21, 2025
1 parent be67a3b commit 9a3685e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
3 changes: 0 additions & 3 deletions AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ open class CardBrowser :

lateinit var viewModel: CardBrowserViewModel

/** List of cards in the browser.
* When the list is changed, the position member of its elements should get changed. */
private val cards get() = viewModel.cards
private lateinit var deckSpinnerSelection: DeckSpinnerSelection

@VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,18 +692,6 @@ class CardBrowserViewModel(

fun getRowAtPosition(position: Int) = cards[position]

override fun onCleared() {
super.onCleared()
invalidate()
}

private fun invalidate() {
Timber.d("invalidate")
// TODO: this may no longer be needed now we call invalidate from onCleared
cards.clear()
selectNone()
}

private suspend fun updateSavedSearches(func: MutableMap<String, String>.() -> Unit): Map<String, String> {
val filters = savedSearches().toMutableMap()
func(filters)
Expand Down

0 comments on commit 9a3685e

Please sign in to comment.