Created
April 11, 2018 08:27
-
-
Save Lzyct/6b2613f5a8bb41a5825b348c70c473d4 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
| #if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end | |
| import android.support.v7.widget.RecyclerView | |
| import android.view.LayoutInflater | |
| import android.view.View | |
| import android.view.ViewGroup | |
| import java.util.* | |
| #parse("File Header.java") | |
| class ${NAME} (private val dataList:List<${Model_Class}>): RecyclerView.Adapter<${NAME}.${ViewHolder_Class}>() { | |
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ${ViewHolder_Class} = | |
| ${ViewHolder_Class}(LayoutInflater.from(parent.context).inflate(R.layout.${Item_Layout_ID}, parent, false)) | |
| override fun onBindViewHolder(holder: ${ViewHolder_Class}, position: Int) = holder.bind${Model_Class}(dataList[position]) | |
| override fun getItemCount() = dataList.size | |
| inner class ${ViewHolder_Class}(itemView: View?) : RecyclerView.ViewHolder(itemView) { | |
| fun bind${Model_Class}(data: ${Model_Class}) = with(itemView) { | |
| // TODO: Bind data dengan View | |
| setOnClickListener { | |
| // TODO: Action ketika item di klik | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment