Created
May 15, 2018 21:01
-
-
Save adrianhall/4af9d13b5ae0fea3c8b4d9d3bbb218ec to your computer and use it in GitHub Desktop.
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 NotesPagedListAdapter(val onClick: (Note) -> Unit) : PagedListAdapter<Note, ListItemViewHolder>(Note.DiffCallback) { | |
companion object { | |
private val TAG = this::class.java.simpleName | |
} | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ListItemViewHolder | |
= ListItemViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.note_list_item, parent, false)) | |
override fun onBindViewHolder(holder: ListItemViewHolder, position: Int) { | |
Log.d(TAG, "Binding view holder at position $position") | |
holder.note = getItem(position) | |
holder.view.setOnClickListener { onClick(holder.note!!) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment