This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.view.View | |
import androidx.core.view.ViewCompat | |
import androidx.core.view.get | |
import androidx.recyclerview.widget.ListAdapter | |
import androidx.recyclerview.widget.RecyclerView | |
interface StickyViewHolder<T> { | |
val type: Int | |
val root: View | |
fun bind(item: T) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class FilterableListAdapter<T, VH : RecyclerView.ViewHolder>( | |
diffCallback: DiffUtil.ItemCallback<T> | |
) : ListAdapter<T, VH>(diffCallback), Filterable { | |
private var originalList: List<T> = currentList.toList() | |
override fun getFilter(): Filter { | |
return object : Filter() { | |
override fun performFiltering(constraint: CharSequence?): FilterResults { | |
return FilterResults().apply { |