From bc58dceaad164f3cfeb9a16729dcb890f5ab5fa2 Mon Sep 17 00:00:00 2001 From: Robozinho <65715921+RobozinhoD@users.noreply.github.com> Date: Sat, 4 May 2024 07:13:39 -0300 Subject: [PATCH] add progress dialog to deck options --- .../src/main/java/com/ichi2/anki/pages/DeckOptions.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/pages/DeckOptions.kt b/AnkiDroid/src/main/java/com/ichi2/anki/pages/DeckOptions.kt index 3a39160d43af..1a012727a86a 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/pages/DeckOptions.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/pages/DeckOptions.kt @@ -28,6 +28,7 @@ import com.ichi2.anki.OnPageFinishedCallback import com.ichi2.anki.R import com.ichi2.anki.SingleFragmentActivity import com.ichi2.anki.dialogs.DiscardChangesDialog +import com.ichi2.anki.withProgress import com.ichi2.annotations.NeedsTest import com.ichi2.libanki.undoableOp import com.ichi2.libanki.updateDeckConfigsRaw @@ -111,7 +112,13 @@ class DeckOptions : PageFragment() { } suspend fun FragmentActivity.updateDeckConfigsRaw(input: ByteArray): ByteArray { - val output = CollectionManager.withCol { updateDeckConfigsRaw(input) } + val output = withContext(Dispatchers.Main) { + withProgress { + withContext(Dispatchers.IO) { + CollectionManager.withCol { updateDeckConfigsRaw(input) } + } + } + } undoableOp { OpChanges.parseFrom(output) } withContext(Dispatchers.Main) { finish() } return output