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 @@ -446,10 +446,9 @@ open class DeckPicker :
446446
447447 private fun showDeckPickerContextMenu (deckId : DeckId ) =
448448 launchCatchingTask {
449- withCol { decks.select (deckId) }
449+ viewModel.selectDeck (deckId).join()
450450 val menu = DeckPickerContextMenu .newInstance(deckId)
451451 CardBrowser .clearLastDeckId()
452- updateDeckList()
453452 showDialogFragment(menu)
454453 }
455454
@@ -458,8 +457,7 @@ open class DeckPicker :
458457 x : Float ,
459458 y : Float ,
460459 ) = launchCatchingTask {
461- withCol { decks.select(deckId) }
462- updateDeckList()
460+ viewModel.selectDeck(deckId).join()
463461 DeckPickerMenuContentProvider .show(
464462 deckPicker = this @DeckPicker,
465463 deckId = deckId,
Original file line number Diff line number Diff line change @@ -275,6 +275,17 @@ class DeckPickerViewModel :
275275 flowOfDeckCountsChanged.emit(Unit )
276276 }
277277
278+ /* *
279+ * Marks [deckId] as the currently selected deck and updates the selection in the deck list.
280+ */
281+ fun selectDeck (deckId : DeckId ) =
282+ viewModelScope.launch {
283+ // TODO: should we always reset the Card Browser default deck here?
284+ withCol { decks.select(deckId) }
285+ focusedDeck = deckId
286+ flowOfRefreshDeckList.emit(Unit )
287+ }
288+
278289 fun browseCards (deckId : DeckId ) =
279290 launchCatchingIO {
280291 withCol { decks.select(deckId) }
You can’t perform that action at this time.
0 commit comments