Created
May 20, 2019 20:34
-
-
Save prof18/e87faf5172914a0ef4190deba00a8cbc to your computer and use it in GitHub Desktop.
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
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.recyclerview.widget.RecyclerView | |
class ${NAME}(val items: MutableList<${ITEM_CLASS}>) : RecyclerView.Adapter<${NAME}.ViewHolder>() { | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.${LAYOUT_RES_ID}, parent, false)) | |
override fun getItemCount() = items.size | |
override fun onBindViewHolder(holder: ${NAME}.ViewHolder, position: Int) = holder.bind(items[position]) | |
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | |
fun bind(item: ${ITEM_CLASS}) { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment