Skip to content
This repository was archived by the owner on Feb 17, 2020. It is now read-only.

Commit 7c7e749

Browse files
committed
share the recyclerview pool of the pages
1 parent 76182ca commit 7c7e749

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/src/main/java/net/squanchy/schedule/view/ScheduleViewPagerAdapter.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.squanchy.schedule.view
22

33
import android.content.Context
4+
import android.support.v7.widget.RecyclerView
45
import android.view.LayoutInflater
56
import android.view.View
67
import android.view.ViewGroup
@@ -17,6 +18,7 @@ class ScheduleViewPagerAdapter(context: Context) : ViewPagerAdapter<ScheduleDayP
1718
private var pages = emptyList<SchedulePage>()
1819

1920
private val inflater = LayoutInflater.from(context)
21+
private val viewPool = RecyclerView.RecycledViewPool()
2022

2123
fun updateWith(pages: List<SchedulePage>, listener: (Event) -> Unit) {
2224
this.pages = pages
@@ -27,7 +29,9 @@ class ScheduleViewPagerAdapter(context: Context) : ViewPagerAdapter<ScheduleDayP
2729
override fun getCount() = pages.size
2830

2931
override fun createView(container: ViewGroup, position: Int): ScheduleDayPageView {
30-
return inflater.inflate(R.layout.view_page_schedule_day, container, false) as ScheduleDayPageView
32+
val recyclerView = inflater.inflate(R.layout.view_page_schedule_day, container, false) as ScheduleDayPageView
33+
recyclerView.recycledViewPool = viewPool
34+
return recyclerView
3135
}
3236

3337
override fun bindView(view: ScheduleDayPageView, position: Int) {

0 commit comments

Comments
 (0)