Fixing tracepot crashes

This commit is contained in:
Jay 2020-05-14 13:55:03 -04:00
parent 6cafc5f5a0
commit 9ca70a5ace
3 changed files with 7 additions and 5 deletions

View File

@ -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)
}

View File

@ -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
}
})

View File

@ -136,11 +136,11 @@ class SourceController : NucleusController<SourcePresenter>(),
.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