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 15, 2025
1 parent b76a4c9 commit 650fe14
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@ open class CardBrowser :
super.onCollectionLoaded(col)
Timber.d("onCollectionLoaded()")
registerReceiver()
cards.reset()

window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
deckSpinnerSelection.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,18 +675,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 650fe14

Please sign in to comment.