Created
August 17, 2019 09:52
-
-
Save akshaymukadam/fea67934f32aef5199b91187f09142c2 to your computer and use it in GitHub Desktop.
IntelliJ template
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 | |
class ${NAME}(val list: List<$DataType>) : RecyclerView.Adapter<${NAME}.$Viewholder>() { | |
override fun onCreateViewHolder(container: ViewGroup, viewType: Int): $Viewholder { | |
val view = LayoutInflater.from(container.context) | |
.inflate(R.layout.$Layout, container, false) | |
return $Viewholder(view) | |
} | |
override fun getItemCount(): Int = list.size | |
override fun onBindViewHolder(holder: $Viewholder, position: Int) { | |
holder.bind(list[position]) | |
} | |
inner class $Viewholder(view: View) : RecyclerView.ViewHolder(view) { | |
fun bind(data: $DataType) { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment