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