In Android, I am working on a library to make implementation of RecyclerView easy. I also want that once a developer has added this library as a dependency in app build.gradle, adding RecyclerView dependency in app build.gradle shouldn't be required. This library will basically be like a wrapper on RecyclerView.
I handled the view part by inflating RecyclerView dynamically in the library. For LayoutManager, I created a class based on Factory Design Pattern, where the developer can choose which LayoutManager and configuration he wants. But I faced an issue when implementing Adapter and ViewHolder wrapper classes.
Attempt #1
open class ViewHolder(view: View) : RecyclerView.ViewHolder(view)
Error: Missing super type dependency (which meant RecyclerView dependency needs to be present in app build.gradle)
Attempt #2
class ViewHolder(view: View)
and wherever I was using it internally in the library, I tried casing it explicitly as viewHolder as ViewHolder
or
adapter as RecyclerView.Adapter
Error: This cast can never succeed.
Please guide me regarding this, how can I achieve a 100% wrapper on RecyclerView?
 
    