mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 20:03:05 +02:00
Fixed the bug that filtered/custom study decks don't show in the Card browser
This commit is contained in:
parent
e0ff9d3533
commit
7673c410ce
@ -671,7 +671,7 @@ open class CardBrowser :
|
||||
val deckId = col.decks.selected()
|
||||
mDeckSpinnerSelection = DeckSpinnerSelection(
|
||||
this, col, findViewById(R.id.toolbar_spinner),
|
||||
showAllDecks = true, alwaysShowDefault = false
|
||||
showAllDecks = true, alwaysShowDefault = false, showFilteredDecks = true
|
||||
)
|
||||
mDeckSpinnerSelection!!.initializeActionBarDeckSpinner(this.supportActionBar!!)
|
||||
selectDeckAndSave(deckId)
|
||||
|
@ -19,6 +19,7 @@ import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.Filter
|
||||
import android.widget.Spinner
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.ActionBar
|
||||
@ -48,13 +49,15 @@ import timber.log.Timber
|
||||
* 2. All decks from [mAllDeckIds].
|
||||
* @param showAllDecks Whether the deck selection should allow "All Decks" as an option
|
||||
* @param alwaysShowDefault If true, never hide the default deck. If false, match [DeckPicker]'s logic
|
||||
* @param showFilteredDecks whether to show filtered decks
|
||||
*/
|
||||
class DeckSpinnerSelection(
|
||||
private val context: AnkiActivity,
|
||||
private val collection: Collection,
|
||||
private val spinner: Spinner,
|
||||
private val showAllDecks: Boolean,
|
||||
private val alwaysShowDefault: Boolean
|
||||
private val alwaysShowDefault: Boolean,
|
||||
private val showFilteredDecks: Boolean,
|
||||
) {
|
||||
/**
|
||||
* All of the decks shown to the user.
|
||||
@ -225,9 +228,9 @@ class DeckSpinnerSelection(
|
||||
/**
|
||||
* Displays a [DeckSelectionDialog]
|
||||
*/
|
||||
fun displayDeckSelectionDialog(col: Collection) {
|
||||
val nonDynamic = FunctionalInterfaces.Filter { d: Deck -> !Decks.isDynamic(d) }
|
||||
val decks = fromCollection(col, nonDynamic).toMutableList()
|
||||
fun displayDeckSelectionDialog(col: Collection?) {
|
||||
val filter = FunctionalInterfaces.Filter { d: Deck -> showFilteredDecks || !Decks.isDynamic(d) }
|
||||
val decks = fromCollection(col!!, filter).toMutableList()
|
||||
if (showAllDecks) {
|
||||
decks.add(SelectableDeck(ALL_DECKS_ID, context.resources.getString(R.string.card_browser_all_decks)))
|
||||
}
|
||||
|
@ -442,7 +442,8 @@ class NoteEditor : AnkiActivity(), DeckSelectionListener, SubtitleListener, Tags
|
||||
DeckSpinnerSelection(
|
||||
this, col, findViewById(R.id.note_deck_spinner),
|
||||
showAllDecks = false,
|
||||
alwaysShowDefault = true
|
||||
alwaysShowDefault = true,
|
||||
showFilteredDecks = false
|
||||
)
|
||||
mDeckSpinnerSelection!!.initializeNoteEditorDeckSpinner(mCurrentEditedCard, addNote)
|
||||
deckId = intent.getLongExtra(EXTRA_DID, deckId)
|
||||
|
@ -116,7 +116,7 @@ class Statistics : NavigationDrawerActivity(), DeckSelectionListener, SubtitleLi
|
||||
}
|
||||
mDeckSpinnerSelection = DeckSpinnerSelection(
|
||||
this, col,
|
||||
findViewById(R.id.toolbar_spinner), showAllDecks = true, alwaysShowDefault = true
|
||||
findViewById(R.id.toolbar_spinner), showAllDecks = true, alwaysShowDefault = true, showFilteredDecks = true
|
||||
)
|
||||
mDeckSpinnerSelection.initializeActionBarDeckSpinner(this.supportActionBar!!)
|
||||
mDeckSpinnerSelection.selectDeckById(mStatsDeckId, false)
|
||||
|
Loading…
Reference in New Issue
Block a user