Skip to content

Instantly share code, notes, and snippets.

@cutiko
Created May 7, 2020 21:12
Show Gist options
  • Save cutiko/92a7f093d197ea1ba1958807d810fed4 to your computer and use it in GitHub Desktop.
Save cutiko/92a7f093d197ea1ba1958807d810fed4 to your computer and use it in GitHub Desktop.
Fake RecyclerView Adapter for testing purpose
private class FakeAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = object :
RecyclerView.ViewHolder(TextView(parent.context)) {}
override fun getItemCount() = 100
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
(holder.itemView as? TextView)?.text = position.toString()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment