Last active
June 17, 2020 09:49
-
-
Save tonnylitao/2a24ebeddc91a9d465f7040f9bb9b5b9 to your computer and use it in GitHub Desktop.
RecyclerAdapter, one adapter for all recycler view for https://medium.com/@tonny/recyclerview-2020-when-recyclerview-meets-data-binding-616ca5c2147d
This file contains hidden or 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
| class RecyclerAdapter<M : RecyclerItem>( | |
| diffCallback: DiffUtil.ItemCallback<M>, | |
| @LayoutRes val placeholderId: Int?, | |
| private val clickListener: Listener? = null | |
| ) : PagedListAdapter<M, ViewHolder<M>> | |
| (diffCallback) { | |
| ... | |
| typealias Listener<M> | |
| = (RecyclerAdapter<M>, Int, M) -> Unit | |
| typealias ViewHolder<M> | |
| = RecyclerAdapter<M>.ViewHolder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment