Created
April 3, 2021 03:42
-
-
Save manavtamboli/ac3301090634d85517acf68b9a6743d3 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
| // Added Parameter for the Layout Resource to inflate | |
| class AdapterX<T>( | |
| @LayoutRes private val layoutResId : Int, | |
| diff : DiffUtil.ItemCallback<T> | |
| ) : ListAdapter<T, AdapterX.ViewHolder>(diff){ | |
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | |
| val view = LayoutInflater.from(parent.context).inflate(layoutResId, parent, false) | |
| return ViewHolder(view) | |
| } | |
| class ViewHolder(view : View) : RecyclerView.ViewHolder(view) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment