Skip to content

Commit b889403

Browse files
lukstbitmikehardy
authored andcommitted
Fix filtered deck being displayed in the ImageOcclusion page
If a filtered deck is selected and we go to the ImageOcclusion page to add, the filtered deck will be displayed in the deck selector although we can't add to a filtered deck(the actual code handles this by adding to the 'Default' deck). The fix consists in showing the 'Default' deck so a user is not confused about the deck where his new card will go.
1 parent 971ee0c commit b889403

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/pages/ImageOcclusion.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import com.ichi2.anki.model.SelectableDeck
3939
import com.ichi2.anki.pages.viewmodel.ImageOcclusionArgs
4040
import com.ichi2.anki.pages.viewmodel.ImageOcclusionViewModel
4141
import com.ichi2.anki.requireAnkiActivity
42+
import com.ichi2.anki.selectedDeckIfNotFiltered
4243
import com.ichi2.anki.startDeckSelection
4344
import kotlinx.coroutines.launch
4445
import timber.log.Timber
@@ -62,12 +63,11 @@ class ImageOcclusion :
6263
}
6364
}
6465

65-
deckNameView = view.findViewById<TextView>(R.id.deck_name)
66+
deckNameView = view.findViewById(R.id.deck_name)
6667
deckNameView.setOnClickListener { startDeckSelection(all = false, filtered = false, skipEmptyDefault = false) }
6768

6869
requireAnkiActivity().launchCatchingTask {
69-
val selectedDeck = withCol { decks.getLegacy(decks.selected()) }
70-
if (selectedDeck == null) return@launchCatchingTask
70+
val selectedDeck = withCol { selectedDeckIfNotFiltered() }
7171
deckNameView.text = selectedDeck.name
7272
}
7373

0 commit comments

Comments
 (0)