Remove no predictive animations. Upgrade Kotlin to 1.0.3

This commit is contained in:
len
2016-07-01 01:39:57 +02:00
parent 864f001c3e
commit 130b7501d1
11 changed files with 17 additions and 70 deletions

View File

@@ -1,13 +1,14 @@
package eu.kanade.tachiyomi.widget
import android.content.Context
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.RecyclerView
import android.util.AttributeSet
class AutofitRecyclerView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
RecyclerView(context, attrs) {
private val manager = NpaGridLayoutManager(context, 1)
private val manager = GridLayoutManager(context, 1)
private var columnWidth = -1

View File

@@ -1,27 +0,0 @@
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
}

View File

@@ -1,27 +0,0 @@
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
}

View File

@@ -1,9 +1,10 @@
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) : NpaLinearLayoutManager(context) {
class PreCachingLayoutManager(context: Context) : LinearLayoutManager(context) {
companion object {
const val DEFAULT_EXTRA_LAYOUT_SPACE = 600