0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00

showChangeDeckDialog selectableDecks

This commit is contained in:
dorrin-sot 2022-05-29 15:39:34 +04:30 committed by Arthur Milchior
parent 156e3c28f4
commit 6e05972eed
2 changed files with 4 additions and 7 deletions

View File

@ -1349,7 +1349,7 @@ open class CardBrowser : NavigationDrawerActivity(), SubtitleListener, DeckSelec
}
@KotlinCleanup("DeckSelectionListener is almost certainly a bug - deck!!")
fun getChangeDeckDialog(selectableDecks: java.util.ArrayList<SelectableDeck>?): DeckSelectionDialog {
fun getChangeDeckDialog(selectableDecks: List<SelectableDeck>?): DeckSelectionDialog {
val dialog = newInstance(
getString(R.string.move_all_to_deck),
null,
@ -1368,10 +1368,8 @@ open class CardBrowser : NavigationDrawerActivity(), SubtitleListener, DeckSelec
Timber.i("Not showing Change Deck - No Cards")
return
}
val selectableDecks = java.util.ArrayList<SelectableDeck>()
for (deck in validDecksForChangeDeck) {
selectableDecks.add(SelectableDeck(deck))
}
val selectableDecks = validDecksForChangeDeck
.map { d -> SelectableDeck(d) }
val dialog = getChangeDeckDialog(selectableDecks)
showDialogFragment(dialog)
}

View File

@ -59,7 +59,6 @@ import timber.log.Timber
import java.util.Arrays.stream
import java.util.Locale
import java.util.Random
import kotlin.collections.ArrayList
import kotlin.collections.HashSet
import kotlin.test.assertNotNull
import kotlin.test.assertNull
@ -570,7 +569,7 @@ class CardBrowserTest : RobolectricTest() {
fun change_deck_dialog_is_dismissed_on_activity_recreation() {
val cardBrowser = browserWithNoNewCards
val dialog = cardBrowser.getChangeDeckDialog(ArrayList())
val dialog = cardBrowser.getChangeDeckDialog(listOf())
cardBrowser.showDialogFragment(dialog)
val shownDialog: Fragment? = getDialogFragment(cardBrowser)