mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-28 12:57:57 +01:00
Some bugfixes
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package eu.kanade.tachiyomi.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v7.widget.GridLayoutManager
|
||||
import android.util.AttributeSet
|
||||
|
||||
/**
|
||||
* No Predictive Animations GridLayoutManager
|
||||
*/
|
||||
open class NpaGridLayoutManager : GridLayoutManager {
|
||||
|
||||
constructor(context: Context, spanCount: Int) : super(context, spanCount) {}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int)
|
||||
: super(context, attrs, defStyleAttr, defStyleRes) {}
|
||||
|
||||
constructor(context: Context, spanCount: Int, orientation: Int, reverseLayout: Boolean)
|
||||
: super(context, spanCount, orientation, reverseLayout) {}
|
||||
|
||||
/**
|
||||
* Disable predictive animations. There is a bug in RecyclerView which causes views that
|
||||
* are being reloaded to pull invalid ViewHolders from the internal recycler stack if the
|
||||
* adapter size has decreased since the ViewHolder was recycled.
|
||||
*/
|
||||
override fun supportsPredictiveItemAnimations() = false
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package eu.kanade.tachiyomi.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.util.AttributeSet
|
||||
|
||||
/**
|
||||
* No Predictive Animations LinearLayoutManager
|
||||
*/
|
||||
open class NpaLinearLayoutManager : LinearLayoutManager {
|
||||
|
||||
constructor(context: Context): super(context) {}
|
||||
|
||||
constructor(context: Context, orientation: Int, reverseLayout: Boolean)
|
||||
: super(context, orientation, reverseLayout) {}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int)
|
||||
: super(context, attrs, defStyleAttr, defStyleRes) {}
|
||||
|
||||
/**
|
||||
* Disable predictive animations. There is a bug in RecyclerView which causes views that
|
||||
* are being reloaded to pull invalid ViewHolders from the internal recycler stack if the
|
||||
* adapter size has decreased since the ViewHolder was recycled.
|
||||
*/
|
||||
override fun supportsPredictiveItemAnimations() = false
|
||||
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
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) {
|
||||
class PreCachingLayoutManager(context: Context) : NpaLinearLayoutManager(context) {
|
||||
|
||||
companion object {
|
||||
const val DEFAULT_EXTRA_LAYOUT_SPACE = 600
|
||||
@@ -19,7 +18,4 @@ class PreCachingLayoutManager(context: Context) : LinearLayoutManager(context) {
|
||||
return DEFAULT_EXTRA_LAYOUT_SPACE
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/questions/30220771/recyclerview-inconsistency-detected-invalid-item-position
|
||||
override fun supportsPredictiveItemAnimations() = false
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user