Created
May 7, 2020 21:12
-
-
Save cutiko/92a7f093d197ea1ba1958807d810fed4 to your computer and use it in GitHub Desktop.
Fake RecyclerView Adapter for testing purpose
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
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