From 2d1a4f1762aa75bea38a198cd0d85b2f871ba7f2 Mon Sep 17 00:00:00 2001 From: Brayan Oliveira <69634269+brayandso@users.noreply.github.com> Date: Fri, 19 Jul 2024 16:07:08 -0300 Subject: [PATCH] fix: `Processing...` popup in app startup 8e0b537b1d9fe464a82dad68e8bc744c1cbced4c introduced a call to `updateMenuState()` at the loadDeckCounts job in order to update the undo label state when the deck is reloaded. Following the method name, the whole menu is updated instead of only the undo label, which includes checking if there are changes to sync remotely, and that takes time, so it shouldn't be done if not necessary. The fix isn't the ideal one, but the menu of the deck picker is a zone, so I'll leave it as is. --- AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt b/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt index 454e3d418252..b737375019d1 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt @@ -1038,6 +1038,15 @@ open class DeckPicker : } } + private suspend fun updateUndoMenuState() { + withOpenColOrNull { + optionsMenuState = optionsMenuState?.copy( + undoLabel = undoLabel(), + undoAvailable = undoAvailable() + ) + } + } + private fun updateSearchVisibilityFromState(menu: Menu) { optionsMenuState?.run { menu.findItem(R.id.deck_picker_action_filter).isVisible = searchIcon @@ -2132,7 +2141,7 @@ open class DeckPicker : } onDecksLoaded(deckDueTree, collectionHasNoCards) - updateMenuState() + updateUndoMenuState() } } }