Fixed blank page bug... again

This commit is contained in:
Jay 2020-05-05 18:19:30 -04:00
parent 8cd4f158d8
commit c0eb0b62c7
3 changed files with 27 additions and 37 deletions

View File

@ -50,6 +50,8 @@ import eu.kanade.tachiyomi.util.lang.plusAssign
import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.storage.getUriCompat
import eu.kanade.tachiyomi.util.system.GLUtil import eu.kanade.tachiyomi.util.system.GLUtil
import eu.kanade.tachiyomi.util.system.ThemeUtil 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.getResourceColor
import eu.kanade.tachiyomi.util.system.hasSideNavBar import eu.kanade.tachiyomi.util.system.hasSideNavBar
import eu.kanade.tachiyomi.util.system.isBottomTappable 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.gone
import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.util.view.snack
import eu.kanade.tachiyomi.util.view.updateLayoutParams 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.util.view.visible
import eu.kanade.tachiyomi.widget.SimpleAnimationListener import eu.kanade.tachiyomi.widget.SimpleAnimationListener
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
@ -335,6 +338,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
chapters_bottom_sheet.sheetBehavior?.isHideable = !menuVisible chapters_bottom_sheet.sheetBehavior?.isHideable = !menuVisible
if (!menuVisible) chapters_bottom_sheet.sheetBehavior?.state = if (!menuVisible) chapters_bottom_sheet.sheetBehavior?.state =
BottomSheetBehavior.STATE_HIDDEN BottomSheetBehavior.STATE_HIDDEN
val peek = chapters_bottom_sheet.sheetBehavior?.peekHeight ?: 30.dpToPx
reader_layout.doOnApplyWindowInsets { v, insets, _ -> reader_layout.doOnApplyWindowInsets { v, insets, _ ->
sheetManageNavColor = when { sheetManageNavColor = when {
insets.isBottomTappable() -> { insets.isBottomTappable() -> {
@ -361,7 +365,11 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
chapters_bottom_sheet.updateLayoutParams<ViewGroup.MarginLayoutParams> { chapters_bottom_sheet.updateLayoutParams<ViewGroup.MarginLayoutParams> {
leftMargin = insets.systemWindowInsetLeft leftMargin = insets.systemWindowInsetLeft
rightMargin = insets.systemWindowInsetRight 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<ReaderPresenter>(),
private fun setMenuVisibility(visible: Boolean, animate: Boolean = true) { private fun setMenuVisibility(visible: Boolean, animate: Boolean = true) {
menuVisible = visible menuVisible = visible
if (visible) coroutine?.cancel() if (visible) coroutine?.cancel()
viewer_container.requestLayout()
if (visible) { if (visible) {
snackbar?.dismiss() snackbar?.dismiss()
systemUi?.show() systemUi?.show()

View File

@ -15,12 +15,8 @@ import com.mikepenz.fastadapter.adapters.ItemAdapter
import com.mikepenz.fastadapter.listeners.ClickEventHook import com.mikepenz.fastadapter.listeners.ClickEventHook
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.dpToPx 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.getResourceColor
import eu.kanade.tachiyomi.util.system.launchUI 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 kotlinx.android.synthetic.main.reader_chapters_sheet.view.*
import kotlin.math.max import kotlin.math.max
import kotlin.math.min import kotlin.math.min
@ -50,7 +46,6 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
} }
} }
val peek = sheetBehavior?.peekHeight ?: 30.dpToPx
post { post {
chapter_recycler.alpha = when (sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) { chapter_recycler.alpha = when (sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) {
true -> 1f 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<MarginLayoutParams> {
height = 280.dpToPx + insets.systemWindowInsetBottom
}
chapter_recycler.updatePaddingRelative(bottom = insets.systemWindowInsetBottom)
}
sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(bottomSheet: View, progress: Float) { override fun onSlide(bottomSheet: View, progress: Float) {
pill.alpha = (1 - max(0f, progress)) * 0.25f pill.alpha = (1 - max(0f, progress)) * 0.25f

View File

@ -6,10 +6,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center"> android:gravity="center">
<FrameLayout
android:id="@+id/reader_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout <FrameLayout
android:id="@+id/viewer_container" android:id="@+id/viewer_container"
@ -33,8 +29,6 @@
android:padding="4dp" android:padding="4dp"
android:textStyle="bold" /> android:textStyle="bold" />
</FrameLayout>
<eu.kanade.tachiyomi.ui.reader.ReaderColorFilterView <eu.kanade.tachiyomi.ui.reader.ReaderColorFilterView
android:id="@+id/color_overlay" android:id="@+id/color_overlay"
android:layout_width="match_parent" android:layout_width="match_parent"