Remove no predictive animations. Upgrade Kotlin to 1.0.3
This commit is contained in:
parent
864f001c3e
commit
130b7501d1
@ -174,7 +174,7 @@ dependencies {
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.0.2'
|
||||
ext.kotlin_version = '1.0.3'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
@ -185,5 +185,4 @@ buildscript {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.catalogue
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.GridLayoutManager
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.SearchView
|
||||
import android.support.v7.widget.Toolbar
|
||||
import android.view.*
|
||||
@ -24,7 +25,6 @@ import eu.kanade.tachiyomi.util.snack
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
import eu.kanade.tachiyomi.widget.DividerItemDecoration
|
||||
import eu.kanade.tachiyomi.widget.EndlessScrollListener
|
||||
import eu.kanade.tachiyomi.widget.NpaLinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.fragment_catalogue.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import nucleus.factory.RequiresPresenter
|
||||
@ -138,7 +138,7 @@ class CatalogueFragment : BaseRxFragment<CataloguePresenter>(), FlexibleViewHold
|
||||
catalogue_grid.adapter = adapter
|
||||
catalogue_grid.addOnScrollListener(gridScrollListener)
|
||||
|
||||
val llm = NpaLinearLayoutManager(activity)
|
||||
val llm = LinearLayoutManager(activity)
|
||||
listScrollListener = EndlessScrollListener(llm, { requestNextPage() })
|
||||
catalogue_list.setHasFixedSize(true)
|
||||
catalogue_list.adapter = adapter
|
||||
|
@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.v7.view.ActionMode
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.support.v7.widget.helper.ItemTouchHelper
|
||||
import android.view.Menu
|
||||
@ -15,7 +16,6 @@ import eu.kanade.tachiyomi.data.database.models.Category
|
||||
import eu.kanade.tachiyomi.ui.base.activity.BaseRxActivity
|
||||
import eu.kanade.tachiyomi.ui.base.adapter.FlexibleViewHolder
|
||||
import eu.kanade.tachiyomi.ui.base.adapter.OnStartDragListener
|
||||
import eu.kanade.tachiyomi.widget.NpaLinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.activity_edit_categories.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import nucleus.factory.RequiresPresenter
|
||||
@ -69,7 +69,7 @@ class CategoryActivity : BaseRxActivity<CategoryPresenter>(), ActionMode.Callbac
|
||||
adapter = CategoryAdapter(this)
|
||||
|
||||
// Create view and inject category items into view
|
||||
recycler.layoutManager = NpaLinearLayoutManager(this)
|
||||
recycler.layoutManager = LinearLayoutManager(this)
|
||||
recycler.setHasFixedSize(true)
|
||||
recycler.adapter = adapter
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package eu.kanade.tachiyomi.ui.download
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.view.*
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.download.DownloadService
|
||||
@ -8,7 +9,6 @@ import eu.kanade.tachiyomi.data.download.model.Download
|
||||
import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.util.plusAssign
|
||||
import eu.kanade.tachiyomi.widget.NpaLinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.fragment_download_queue.*
|
||||
import nucleus.factory.RequiresPresenter
|
||||
import rx.Observable
|
||||
@ -92,7 +92,7 @@ class DownloadFragment : BaseRxFragment<DownloadPresenter>() {
|
||||
recycler.adapter = adapter
|
||||
|
||||
// Set the layout manager for the recycler and fixed size.
|
||||
recycler.layoutManager = NpaLinearLayoutManager(activity)
|
||||
recycler.layoutManager = LinearLayoutManager(activity)
|
||||
recycler.setHasFixedSize(true)
|
||||
|
||||
// Suscribe to changes
|
||||
|
@ -6,6 +6,7 @@ import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.DialogFragment
|
||||
import android.support.v7.view.ActionMode
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.view.*
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
@ -22,7 +23,6 @@ import eu.kanade.tachiyomi.util.getResourceDrawable
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
import eu.kanade.tachiyomi.widget.DeletingChaptersDialog
|
||||
import eu.kanade.tachiyomi.widget.DividerItemDecoration
|
||||
import eu.kanade.tachiyomi.widget.NpaLinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.fragment_manga_chapters.*
|
||||
import nucleus.factory.RequiresPresenter
|
||||
import timber.log.Timber
|
||||
@ -66,7 +66,7 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
||||
adapter = ChaptersAdapter(this)
|
||||
|
||||
recycler.adapter = adapter
|
||||
recycler.layoutManager = NpaLinearLayoutManager(activity)
|
||||
recycler.layoutManager = LinearLayoutManager(activity)
|
||||
recycler.addItemDecoration(DividerItemDecoration(
|
||||
context.theme.getResourceDrawable(R.attr.divider_drawable)))
|
||||
recycler.setHasFixedSize(true)
|
||||
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.recent_updates
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.DialogFragment
|
||||
import android.support.v7.view.ActionMode
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.view.*
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
@ -15,7 +16,6 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||
import eu.kanade.tachiyomi.util.getResourceDrawable
|
||||
import eu.kanade.tachiyomi.widget.DeletingChaptersDialog
|
||||
import eu.kanade.tachiyomi.widget.DividerItemDecoration
|
||||
import eu.kanade.tachiyomi.widget.NpaLinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.fragment_recent_chapters.*
|
||||
import nucleus.factory.RequiresPresenter
|
||||
import timber.log.Timber
|
||||
@ -68,7 +68,7 @@ class RecentChaptersFragment
|
||||
*/
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
// Init RecyclerView and adapter
|
||||
recycler.layoutManager = NpaLinearLayoutManager(activity)
|
||||
recycler.layoutManager = LinearLayoutManager(activity)
|
||||
recycler.addItemDecoration(DividerItemDecoration(context.theme.getResourceDrawable(R.attr.divider_drawable)))
|
||||
recycler.setHasFixedSize(true)
|
||||
adapter = RecentChaptersAdapter(this)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package eu.kanade.tachiyomi.ui.recently_read
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -13,7 +14,6 @@ import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaActivity
|
||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||
import eu.kanade.tachiyomi.widget.NpaLinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.fragment_recently_read.*
|
||||
import nucleus.factory.RequiresPresenter
|
||||
|
||||
@ -58,7 +58,7 @@ class RecentlyReadFragment : BaseRxFragment<RecentlyReadPresenter>() {
|
||||
*/
|
||||
override fun onViewCreated(view: View?, savedState: Bundle?) {
|
||||
// Initialize adapter
|
||||
recycler.layoutManager = NpaLinearLayoutManager(activity)
|
||||
recycler.layoutManager = LinearLayoutManager(activity)
|
||||
adapter = RecentlyReadAdapter(this)
|
||||
recycler.setHasFixedSize(true)
|
||||
recycler.adapter = adapter
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
}
|
@ -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
|
||||
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user