mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 07:05:06 +01:00
Fixing tracepot crashes
This commit is contained in:
parent
be69f05657
commit
3ad9d84b5f
@ -180,10 +180,11 @@ class LibraryController(
|
|||||||
private var scrollListener = object : RecyclerView.OnScrollListener() {
|
private var scrollListener = object : RecyclerView.OnScrollListener() {
|
||||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||||
super.onScrolled(recyclerView, dx, dy)
|
super.onScrolled(recyclerView, dx, dy)
|
||||||
|
val recyclerCover = recycler_cover ?: return
|
||||||
val notAtTop = recycler.canScrollVertically(-1)
|
val notAtTop = recycler.canScrollVertically(-1)
|
||||||
if (notAtTop != elevate) elevateFunc(notAtTop)
|
if (notAtTop != elevate) elevateFunc(notAtTop)
|
||||||
val order = getCategoryOrder()
|
val order = getCategoryOrder()
|
||||||
if (!recycler_cover.isClickable && isAnimatingHopper != true) {
|
if (!recyclerCover.isClickable && isAnimatingHopper != true) {
|
||||||
category_hopper_frame.translationY += dy
|
category_hopper_frame.translationY += dy
|
||||||
category_hopper_frame.translationY =
|
category_hopper_frame.translationY =
|
||||||
category_hopper_frame.translationY.coerceIn(0f, 50f.dpToPx)
|
category_hopper_frame.translationY.coerceIn(0f, 50f.dpToPx)
|
||||||
|
@ -254,7 +254,7 @@ class MangaDetailsController : BaseController,
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||||
val atTop = !recycler.canScrollVertically(-1)
|
val atTop = recycler?.canScrollVertically(-1) == false
|
||||||
if (atTop) getHeader()?.backdrop?.translationY = 0f
|
if (atTop) getHeader()?.backdrop?.translationY = 0f
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -521,7 +521,7 @@ class MangaDetailsController : BaseController,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getHeader(): MangaHeaderHolder? {
|
private fun getHeader(): MangaHeaderHolder? {
|
||||||
return recycler.findViewHolderForAdapterPosition(0) as? MangaHeaderHolder
|
return recycler?.findViewHolderForAdapterPosition(0) as? MangaHeaderHolder
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateHeader() {
|
fun updateHeader() {
|
||||||
|
@ -143,6 +143,7 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
dl_bottom_sheet.sheetBehavior?.addBottomSheetCallback(object :
|
dl_bottom_sheet.sheetBehavior?.addBottomSheetCallback(object :
|
||||||
BottomSheetBehavior.BottomSheetCallback() {
|
BottomSheetBehavior.BottomSheetCallback() {
|
||||||
override fun onSlide(bottomSheet: View, progress: Float) {
|
override fun onSlide(bottomSheet: View, progress: Float) {
|
||||||
|
val shadow2 = shadow2 ?: return
|
||||||
shadow2.alpha = (1 - abs(progress)) * 0.25f
|
shadow2.alpha = (1 - abs(progress)) * 0.25f
|
||||||
shadow.alpha = (1 - abs(progress)) * 0.5f
|
shadow.alpha = (1 - abs(progress)) * 0.5f
|
||||||
if (progress >= 0) activity?.appbar?.elevation = max(
|
if (progress >= 0) activity?.appbar?.elevation = max(
|
||||||
|
@ -119,7 +119,7 @@ fun Controller.scrollViewWith(
|
|||||||
if (changeType.isEnter) {
|
if (changeType.isEnter) {
|
||||||
elevateFunc(elevate)
|
elevateFunc(elevate)
|
||||||
if (fakeToolbarView?.parent != null) {
|
if (fakeToolbarView?.parent != null) {
|
||||||
val parent = recycler.parent as ViewGroup
|
val parent = recycler.parent as? ViewGroup ?: return
|
||||||
parent.removeView(fakeToolbarView)
|
parent.removeView(fakeToolbarView)
|
||||||
fakeToolbarView = null
|
fakeToolbarView = null
|
||||||
}
|
}
|
||||||
@ -136,9 +136,9 @@ fun Controller.scrollViewWith(
|
|||||||
if (!customPadding && lastY == 0f && router.backstack.lastOrNull()
|
if (!customPadding && lastY == 0f && router.backstack.lastOrNull()
|
||||||
?.controller() is MangaDetailsController
|
?.controller() is MangaDetailsController
|
||||||
) {
|
) {
|
||||||
|
val parent = recycler.parent as? ViewGroup ?: return
|
||||||
val v = View(activity)
|
val v = View(activity)
|
||||||
fakeToolbarView = v
|
fakeToolbarView = v
|
||||||
val parent = recycler.parent as ViewGroup
|
|
||||||
parent.addView(v, parent.indexOfChild(recycler) + 1)
|
parent.addView(v, parent.indexOfChild(recycler) + 1)
|
||||||
val params = fakeToolbarView?.layoutParams
|
val params = fakeToolbarView?.layoutParams
|
||||||
params?.height = recycler.paddingTop
|
params?.height = recycler.paddingTop
|
||||||
|
Loading…
Reference in New Issue
Block a user