mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 16:25:36 +03: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
|
val currentItems : List<GenericListItem<in ViewBinding>> get() = asyncListDiffer.currentList
|
||||||
|
|
||||||
var currentSearchTerm = ""
|
var currentSearchTerm = ""
|
||||||
|
var selectedPosition : Int? = null
|
||||||
|
|
||||||
private val viewTypesMapping = mutableMapOf<ViewBindingFactory, Int>()
|
private val viewTypesMapping = mutableMapOf<ViewBindingFactory, Int>()
|
||||||
|
|
||||||
@ -68,6 +69,11 @@ class GenericAdapter : RecyclerView.Adapter<GenericViewHolder<ViewBinding>>(), F
|
|||||||
filter.filter(currentSearchTerm)
|
filter.filter(currentSearchTerm)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun removeItemAt(position : Int) {
|
||||||
|
allItems.removeAt(position)
|
||||||
|
filter.filter(currentSearchTerm)
|
||||||
|
}
|
||||||
|
|
||||||
fun setOnFilterPublishedListener(listener : OnFilterPublishedListener) {
|
fun setOnFilterPublishedListener(listener : OnFilterPublishedListener) {
|
||||||
onFilterPublishedListener = listener
|
onFilterPublishedListener = listener
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user