mihon/app/src/main/java/eu/kanade/tachiyomi/widget/PreCachingLayoutManager.kt

26 lines
734 B
Kotlin
Raw Normal View History

2016-03-07 19:22:56 -05:00
package eu.kanade.tachiyomi.widget
import android.content.Context
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
class PreCachingLayoutManager(context: Context) : LinearLayoutManager(context) {
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
}
2016-04-10 10:19:05 -04:00
// http://stackoverflow.com/questions/30220771/recyclerview-inconsistency-detected-invalid-item-position
override fun supportsPredictiveItemAnimations() = false
2016-03-07 19:22:56 -05:00
}