Skip to content

Commit 357ac7e

Browse files
committed
update(adapter): item offets
1 parent 3604457 commit 357ac7e

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

app/src/main/java/com/hoc/pagination_mvi/ui/main/MainAdapter.kt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ class MainAdapter(
7070
private val retryHorizontalS = PublishSubject.create<Unit>()
7171
val retryHorizontalObservable get() = retryHorizontalS.asObservable()
7272

73+
/**
74+
*
75+
*/
76+
7377
override fun onCreateViewHolder(parent: ViewGroup, @LayoutRes viewType: Int): VH {
7478
val itemView = LayoutInflater.from(parent.context).inflate(viewType, parent, false)
7579
return when (viewType) {
@@ -98,6 +102,10 @@ class MainAdapter(
98102
@LayoutRes
99103
override fun getItemViewType(position: Int) = getItem(position).viewType
100104

105+
/**
106+
*
107+
*/
108+
101109
abstract class VH(itemView: View) : RecyclerView.ViewHolder(itemView) {
102110
abstract fun bind(item: Item)
103111
}
@@ -193,8 +201,12 @@ class MainAdapter(
193201
parent: RecyclerView,
194202
state: RecyclerView.State
195203
) {
196-
outRect.left =
197-
if (parent.getChildAdapterPosition(view) == parent.adapter!!.itemCount - 1) 0 else 8
204+
outRect.run {
205+
right = if (parent.getChildAdapterPosition(view) == parent.adapter!!.itemCount - 1) 0 else 8
206+
left = 0
207+
top = 0
208+
bottom = 0
209+
}
198210
}
199211
})
200212
}
@@ -254,6 +266,10 @@ class MainAdapter(
254266
}
255267
}
256268

269+
/**
270+
*
271+
*/
272+
257273
override fun onViewRecycled(holder: VH) {
258274
super.onViewRecycled(holder)
259275
if (holder is HorizontalListVH) {

0 commit comments

Comments
 (0)