From c0eb0b62c7252d1008f0b76362832fe677701973 Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 5 May 2020 18:19:30 -0400 Subject: [PATCH] Fixed blank page bug... again --- .../tachiyomi/ui/reader/ReaderActivity.kt | 9 ++++ .../tachiyomi/ui/reader/ReaderChapterSheet.kt | 13 ------ app/src/main/res/layout/reader_activity.xml | 42 ++++++++----------- 3 files changed, 27 insertions(+), 37 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 737f3ec124..ae4f3fe3b1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -50,6 +50,8 @@ import eu.kanade.tachiyomi.util.lang.plusAssign import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.system.GLUtil import eu.kanade.tachiyomi.util.system.ThemeUtil +import eu.kanade.tachiyomi.util.system.dpToPx +import eu.kanade.tachiyomi.util.system.getBottomGestureInsets import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.hasSideNavBar import eu.kanade.tachiyomi.util.system.isBottomTappable @@ -59,6 +61,7 @@ import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.util.view.updateLayoutParams +import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.widget.SimpleAnimationListener import eu.kanade.tachiyomi.widget.SimpleSeekBarListener @@ -335,6 +338,7 @@ class ReaderActivity : BaseRxActivity(), chapters_bottom_sheet.sheetBehavior?.isHideable = !menuVisible if (!menuVisible) chapters_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN + val peek = chapters_bottom_sheet.sheetBehavior?.peekHeight ?: 30.dpToPx reader_layout.doOnApplyWindowInsets { v, insets, _ -> sheetManageNavColor = when { insets.isBottomTappable() -> { @@ -361,7 +365,11 @@ class ReaderActivity : BaseRxActivity(), chapters_bottom_sheet.updateLayoutParams { leftMargin = insets.systemWindowInsetLeft rightMargin = insets.systemWindowInsetRight + height = 280.dpToPx + insets.systemWindowInsetBottom } + chapters_bottom_sheet.sheetBehavior?.peekHeight = peek + insets.getBottomGestureInsets() + chapter_recycler.updatePaddingRelative(bottom = insets.systemWindowInsetBottom) + viewer_container.requestLayout() } } @@ -372,6 +380,7 @@ class ReaderActivity : BaseRxActivity(), private fun setMenuVisibility(visible: Boolean, animate: Boolean = true) { menuVisible = visible if (visible) coroutine?.cancel() + viewer_container.requestLayout() if (visible) { snackbar?.dismiss() systemUi?.show() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderChapterSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderChapterSheet.kt index 90bf64365a..b580da9806 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderChapterSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderChapterSheet.kt @@ -15,12 +15,8 @@ import com.mikepenz.fastadapter.adapters.ItemAdapter import com.mikepenz.fastadapter.listeners.ClickEventHook import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.dpToPx -import eu.kanade.tachiyomi.util.system.getBottomGestureInsets import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.launchUI -import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets -import eu.kanade.tachiyomi.util.view.updateLayoutParams -import eu.kanade.tachiyomi.util.view.updatePaddingRelative import kotlinx.android.synthetic.main.reader_chapters_sheet.view.* import kotlin.math.max import kotlin.math.min @@ -50,7 +46,6 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr } } - val peek = sheetBehavior?.peekHeight ?: 30.dpToPx post { chapter_recycler.alpha = when (sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) { true -> 1f @@ -58,14 +53,6 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr } } - chapters_bottom_sheet.doOnApplyWindowInsets { _, insets, _ -> - sheetBehavior?.peekHeight = peek + insets.getBottomGestureInsets() - - chapters_bottom_sheet.updateLayoutParams { - height = 280.dpToPx + insets.systemWindowInsetBottom - } - chapter_recycler.updatePaddingRelative(bottom = insets.systemWindowInsetBottom) - } sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { override fun onSlide(bottomSheet: View, progress: Float) { pill.alpha = (1 - max(0f, progress)) * 0.25f diff --git a/app/src/main/res/layout/reader_activity.xml b/app/src/main/res/layout/reader_activity.xml index 9db3413b11..821c5e2325 100644 --- a/app/src/main/res/layout/reader_activity.xml +++ b/app/src/main/res/layout/reader_activity.xml @@ -6,34 +6,28 @@ android:layout_height="match_parent" android:gravity="center"> + + android:layout_height="match_parent" /> - + - - - - - +