Last active
May 7, 2018 12:52
-
-
Save sjthn/198cac1f6ae0d29352ca181fac0f5318 to your computer and use it in GitHub Desktop.
Kotlin template for RecyclerView Adapter in Android Studio
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} | |
import android.support.v7.widget.RecyclerView | |
import android.view.View | |
import android.view.ViewGroup | |
#end | |
#parse("File Header.java") | |
class ${NAME}(private var items: MutableList<${ITEM_TYPE}>): RecyclerView.Adapter<${VIEWHOLDER}>() { | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ${VIEWHOLDER} { | |
// TODO: Return ${VIEWHOLDER} | |
} | |
override fun onBindViewHolder(holder: ${VIEWHOLDER}, position: Int) { | |
} | |
override fun getItemCount(): Int { | |
return items.size | |
} | |
} | |
class ${VIEWHOLDER}(private val view: View) : RecyclerView.ViewHolder(view) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To create the template,
Ctrl + Shift + A
for Windows,Command + Shift + A
for Mac, and type "File and Code Templates" and click it.To use this template go to the New submenu to find the name of the template