renaming keyboard adapters viewholder

This commit is contained in:
tibbi 2022-01-29 09:42:13 +01:00
parent c8680b21ab
commit 17f7eab2e1
1 changed files with 5 additions and 5 deletions

View File

@ -19,23 +19,23 @@ import kotlinx.android.synthetic.main.item_section_label.view.*
import java.util.* import java.util.*
class ClipsKeyboardAdapter(val context: Context, var items: ArrayList<ListItem>, val itemClick: (clip: Clip) -> Unit) : class ClipsKeyboardAdapter(val context: Context, var items: ArrayList<ListItem>, val itemClick: (clip: Clip) -> Unit) :
RecyclerView.Adapter<ClipsKeyboardAdapter.ViewHolderr>() { RecyclerView.Adapter<ClipsKeyboardAdapter.ViewHolder>() {
private val layoutInflater = LayoutInflater.from(context) private val layoutInflater = LayoutInflater.from(context)
private val baseConfig = context.config private val baseConfig = context.config
private var textColor = baseConfig.textColor private var textColor = baseConfig.textColor
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolderr { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val layoutId = when (viewType) { val layoutId = when (viewType) {
ITEM_SECTION_LABEL -> R.layout.item_section_label ITEM_SECTION_LABEL -> R.layout.item_section_label
else -> R.layout.item_clip_on_keyboard else -> R.layout.item_clip_on_keyboard
} }
val view = layoutInflater.inflate(layoutId, parent, false) val view = layoutInflater.inflate(layoutId, parent, false)
return ViewHolderr(view) return ViewHolder(view)
} }
override fun onBindViewHolder(holder: ViewHolderr, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = items[position] val item = items[position]
holder.bindView(item) { itemView -> holder.bindView(item) { itemView ->
when (item) { when (item) {
@ -69,7 +69,7 @@ class ClipsKeyboardAdapter(val context: Context, var items: ArrayList<ListItem>,
} }
} }
open inner class ViewHolderr(view: View) : RecyclerView.ViewHolder(view) { open inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
fun bindView(any: Any, callback: (itemView: View) -> Unit): View { fun bindView(any: Any, callback: (itemView: View) -> Unit): View {
return itemView.apply { return itemView.apply {
callback(this) callback(this)