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 @@ -451,10 +451,9 @@ open class DeckPicker :
451451
452452 private fun showDeckPickerContextMenu (deckId : DeckId ) =
453453 launchCatchingTask {
454- withCol { decks.select (deckId) }
454+ viewModel.selectDeck (deckId).join()
455455 val menu = DeckPickerContextMenu .newInstance(deckId)
456456 CardBrowser .clearLastDeckId()
457- updateDeckList()
458457 showDialogFragment(menu)
459458 }
460459
@@ -463,8 +462,7 @@ open class DeckPicker :
463462 x : Float ,
464463 y : Float ,
465464 ) = launchCatchingTask {
466- withCol { decks.select(deckId) }
467- updateDeckList()
465+ viewModel.selectDeck(deckId).join()
468466 DeckPickerMenuContentProvider .show(
469467 deckPicker = this @DeckPicker,
470468 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