Skip to content

Commit

Permalink
Rename Item as DelegateViewHolder
Browse files Browse the repository at this point in the history
  • Loading branch information
Yesferal committed Oct 3, 2021
1 parent 6995d08 commit b916d9a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.yesferal.hornsapp.delegate.abstraction.DelegateListener
import com.yesferal.hornsapp.delegate.abstraction.Delegate
import com.yesferal.hornsapp.delegate.viewholder.ItemViewHolder
import com.yesferal.hornsapp.delegate.viewholder.DelegateViewHolder
import java.lang.Exception

class DelegateAdapter private constructor(
Expand All @@ -15,8 +15,8 @@ class DelegateAdapter private constructor(
private val viewTypes: HashMap<Int, (
itemView: View,
listener: DelegateListener
) -> ItemViewHolder> = hashMapOf()
) : RecyclerView.Adapter<ItemViewHolder>() {
) -> DelegateViewHolder> = hashMapOf()
) : RecyclerView.Adapter<DelegateViewHolder>() {

init {
items.forEach { updateViewTypes(it) }
Expand All @@ -25,7 +25,7 @@ class DelegateAdapter private constructor(
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): ItemViewHolder {
): DelegateViewHolder {
val itemView = LayoutInflater
.from(parent.context)
.inflate(viewType, parent, false)
Expand All @@ -44,7 +44,7 @@ class DelegateAdapter private constructor(
}

override fun onBindViewHolder(
holder: ItemViewHolder,
holder: DelegateViewHolder,
position: Int
) {
holder.itemPosition = position
Expand All @@ -68,7 +68,7 @@ class DelegateAdapter private constructor(
}
}

override fun onViewRecycled(holder: ItemViewHolder) {
override fun onViewRecycled(holder: DelegateViewHolder) {
super.onViewRecycled(holder)
val item = items[holder.itemPosition]
holder.onViewRecycled(item)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.yesferal.hornsapp.delegate.abstraction

import android.view.View
import com.yesferal.hornsapp.delegate.viewholder.ItemViewHolder
import com.yesferal.hornsapp.delegate.viewholder.DelegateViewHolder

interface Delegate : LayoutBinding {

Expand All @@ -12,7 +12,7 @@ interface Delegate : LayoutBinding {
fun onCreateViewHolder(
itemView: View,
listener: DelegateListener
): ItemViewHolder {
return ItemViewHolder(itemView, listener)
): DelegateViewHolder {
return DelegateViewHolder(itemView, listener)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.yesferal.hornsapp.delegate.R
import com.yesferal.hornsapp.delegate.abstraction.Delegate
import com.yesferal.hornsapp.delegate.viewholder.ItemViewHolder
import com.yesferal.hornsapp.delegate.viewholder.DelegateViewHolder
import com.yesferal.hornsapp.delegate.DelegateAdapter
import com.yesferal.hornsapp.delegate.abstraction.DelegateListener

Expand All @@ -25,8 +25,8 @@ class RowDelegate private constructor(
override fun onCreateViewHolder(
itemView: View,
listener: DelegateListener
): ItemViewHolder {
return ItemViewHolder(itemView, listener)
): DelegateViewHolder {
return DelegateViewHolder(itemView, listener)
}

override val layout: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.yesferal.hornsapp.delegate.abstraction.DelegateListener
import com.yesferal.hornsapp.delegate.abstraction.Delegate

class ItemViewHolder(
class DelegateViewHolder(
itemView: View,
private val listener: DelegateListener
) : RecyclerView.ViewHolder(itemView) {
Expand Down

0 comments on commit b916d9a

Please sign in to comment.