2016-03-07 19:22:56 -05:00
|
|
|
package eu.kanade.tachiyomi.widget
|
|
|
|
|
|
|
|
import android.content.Context
|
2020-01-05 11:29:27 -05:00
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
2016-03-07 19:22:56 -05:00
|
|
|
|
2016-06-30 19:39:57 -04:00
|
|
|
class PreCachingLayoutManager(context: Context) : LinearLayoutManager(context) {
|
2016-03-07 19:22:56 -05:00
|
|
|
|
2016-11-05 14:28:47 -04:00
|
|
|
init {
|
|
|
|
isItemPrefetchEnabled = false
|
|
|
|
}
|
|
|
|
|
2016-03-07 19:22:56 -05:00
|
|
|
companion object {
|
|
|
|
const val DEFAULT_EXTRA_LAYOUT_SPACE = 600
|
|
|
|
}
|
|
|
|
|
|
|
|
var extraLayoutSpace = 0
|
|
|
|
|
|
|
|
override fun getExtraLayoutSpace(state: RecyclerView.State): Int {
|
|
|
|
if (extraLayoutSpace > 0) {
|
|
|
|
return extraLayoutSpace
|
|
|
|
}
|
|
|
|
return DEFAULT_EXTRA_LAYOUT_SPACE
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|