From 130b7501d1a5b186e5033ea74521779bbd7ab435 Mon Sep 17 00:00:00 2001 From: len Date: Fri, 1 Jul 2016 01:39:57 +0200 Subject: [PATCH] Remove no predictive animations. Upgrade Kotlin to 1.0.3 --- app/build.gradle | 3 +-- .../ui/catalogue/CatalogueFragment.kt | 4 +-- .../tachiyomi/ui/category/CategoryActivity.kt | 4 +-- .../tachiyomi/ui/download/DownloadFragment.kt | 4 +-- .../ui/manga/chapter/ChaptersFragment.kt | 4 +-- .../recent_updates/RecentChaptersFragment.kt | 4 +-- .../ui/recently_read/RecentlyReadFragment.kt | 4 +-- .../tachiyomi/widget/AutofitRecyclerView.kt | 3 ++- .../tachiyomi/widget/NpaGridLayoutManager.kt | 27 ------------------- .../widget/NpaLinearLayoutManager.kt | 27 ------------------- .../widget/PreCachingLayoutManager.kt | 3 ++- 11 files changed, 17 insertions(+), 70 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/widget/NpaGridLayoutManager.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/widget/NpaLinearLayoutManager.kt diff --git a/app/build.gradle b/app/build.gradle index 300992383..1c58ef58a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueFragment.kt index edbda745b..ae62b22b5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueFragment.kt @@ -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(), 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 diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryActivity.kt index fedf1c27b..8a01bcacf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryActivity.kt @@ -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(), 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 diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadFragment.kt index 562aade65..3a58fa028 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadFragment.kt @@ -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() { 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 diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt index 75b33b433..2353f8c3b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt @@ -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(), 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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersFragment.kt index ebce2d9b1..8734456f9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersFragment.kt @@ -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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadFragment.kt index 02acec765..6264cdd51 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadFragment.kt @@ -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() { */ 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 diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/AutofitRecyclerView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/AutofitRecyclerView.kt index 7439bc4c7..11a8e1140 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/AutofitRecyclerView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/AutofitRecyclerView.kt @@ -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 diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/NpaGridLayoutManager.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/NpaGridLayoutManager.kt deleted file mode 100644 index f34e4274c..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/NpaGridLayoutManager.kt +++ /dev/null @@ -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 - -} \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/NpaLinearLayoutManager.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/NpaLinearLayoutManager.kt deleted file mode 100644 index ec754efcb..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/NpaLinearLayoutManager.kt +++ /dev/null @@ -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 - -} \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/PreCachingLayoutManager.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/PreCachingLayoutManager.kt index 525b92c29..f742a0e57 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/PreCachingLayoutManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/PreCachingLayoutManager.kt @@ -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