Skip to content

Instantly share code, notes, and snippets.

@johanneslagos
Last active February 20, 2017 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanneslagos/e662e786bc721c32cd86170dc4e6ce86 to your computer and use it in GitHub Desktop.
Save johanneslagos/e662e786bc721c32cd86170dc4e6ce86 to your computer and use it in GitHub Desktop.
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
#parse("File Header.java")
class ${NAME}(context:Context, val items: List<${ITEM_CLASS}>?) : RecyclerView.Adapter<${VIEWHOLDER_CLASS}>() {
override fun onBindViewHolder(holder: ${VIEWHOLDER_CLASS}, position: Int) {
val item = items?.get(position)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ${VIEWHOLDER_CLASS} {
val v = LayoutInflater.from(parent.context)
.inflate(R.layout.${LAYOUT_RES_ID}, parent, false)
return ${VIEWHOLDER_CLASS}(v)
}
override fun getItemCount(): Int {
return items?.size ?: 0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment