From 9ca70a5ace7afa7a6f4a06d346f7623284636270 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 14 May 2020 13:55:03 -0400 Subject: [PATCH] Fixing tracepot crashes --- .../java/eu/kanade/tachiyomi/ui/library/LibraryController.kt | 4 +++- .../eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt | 4 ++-- .../java/eu/kanade/tachiyomi/ui/source/SourceController.kt | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 14214ba547..b472a4dd11 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -212,6 +212,7 @@ class LibraryController( override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { super.onScrollStateChanged(recyclerView, newState) + val recyclerCover = recycler_cover ?: return when (newState) { RecyclerView.SCROLL_STATE_DRAGGING -> { fast_scroller.showScrollbar() @@ -220,7 +221,7 @@ class LibraryController( val shortAnimationDuration = resources?.getInteger( android.R.integer.config_shortAnimTime ) ?: 0 - if (!recycler_cover.isClickable) { + if (!recyclerCover.isClickable) { category_hopper_frame.animate().translationY( if (category_hopper_frame.translationY > 25f.dpToPx) 50f.dpToPx else 0f @@ -624,6 +625,7 @@ class LibraryController( override fun onDestroyView(view: View) { LibraryUpdateService.removeListener(this) destroyActionModeIfNeeded() + recycler.removeOnScrollListener(scrollListener) super.onDestroyView(view) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt index 6a8216a4a7..cf708b8f3e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt @@ -247,14 +247,14 @@ class MangaDetailsController : BaseController, recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { super.onScrolled(recyclerView, dx, dy) - val atTop = !recycler.canScrollVertically(-1) + val atTop = !recyclerView.canScrollVertically(-1) val tY = getHeader()?.backdrop?.translationY ?: 0f getHeader()?.backdrop?.translationY = max(0f, tY + dy * 0.25f) if (atTop) getHeader()?.backdrop?.translationY = 0f } override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { - val atTop = recycler?.canScrollVertically(-1) == false + val atTop = !recyclerView.canScrollVertically(-1) if (atTop) getHeader()?.backdrop?.translationY = 0f } }) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceController.kt index a74287cf09..af06bfb9d6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceController.kt @@ -136,11 +136,11 @@ class SourceController : NucleusController(), .BottomSheetCallback() { override fun onSlide(bottomSheet: View, progress: Float) { val recycler = recycler ?: return - shadow2.alpha = (1 - max(0f, progress)) * 0.25f + shadow2?.alpha = (1 - max(0f, progress)) * 0.25f activity?.appbar?.elevation = max(progress * 15f, if (recycler.canScrollVertically(-1)) 15f else 0f) - sheet_layout.alpha = 1 - progress + sheet_layout?.alpha = 1 - progress activity?.appbar?.y = max(activity!!.appbar.y, -headerHeight * (1 - progress)) val oldShow = showingExtensions showingExtensions = progress > 0.92f