mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 09:11:52 +01:00
Misc improvements to GenericAdapter
- Allow removing one item from the list - Keep track of one selected position. This is useful for single choice lists using radio buttons - Max number of displayed entries. An expand button will be displayed at the bottom when going past the limit, and the entries to display when collapsed is configurable
This commit is contained in:
parent
c5797fdff6
commit
67881d2215
@ -36,6 +36,7 @@ class GenericAdapter : RecyclerView.Adapter<GenericViewHolder<ViewBinding>>(), F
|
||||
val currentItems : List<GenericListItem<in ViewBinding>> get() = asyncListDiffer.currentList
|
||||
|
||||
var currentSearchTerm = ""
|
||||
var selectedPosition : Int? = null
|
||||
|
||||
private val viewTypesMapping = mutableMapOf<ViewBindingFactory, Int>()
|
||||
|
||||
@ -68,6 +69,11 @@ class GenericAdapter : RecyclerView.Adapter<GenericViewHolder<ViewBinding>>(), F
|
||||
filter.filter(currentSearchTerm)
|
||||
}
|
||||
|
||||
fun removeItemAt(position : Int) {
|
||||
allItems.removeAt(position)
|
||||
filter.filter(currentSearchTerm)
|
||||
}
|
||||
|
||||
fun setOnFilterPublishedListener(listener : OnFilterPublishedListener) {
|
||||
onFilterPublishedListener = listener
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user