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.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<ReaderPresenter>(),
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<ReaderPresenter>(),
chapters_bottom_sheet.updateLayoutParams<ViewGroup.MarginLayoutParams> {
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<ReaderPresenter>(),
private fun setMenuVisibility(visible: Boolean, animate: Boolean = true) {
menuVisible = visible
if (visible) coroutine?.cancel()
viewer_container.requestLayout()
if (visible) {
snackbar?.dismiss()
systemUi?.show()

View File

@ -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<MarginLayoutParams> {
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

View File

@ -6,34 +6,28 @@
android:layout_height="match_parent"
android:gravity="center">
<FrameLayout
android:id="@+id/reader_container"
android:id="@+id/viewer_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/viewer_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/please_wait"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_gravity="center"
android:visibility="gone"
tools:visibility="visible" />
<ProgressBar
android:id="@+id/please_wait"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_gravity="center"
android:visibility="gone"
tools:visibility="visible" />
<eu.kanade.tachiyomi.ui.reader.PageIndicatorTextView
android:id="@+id/page_number"
style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:padding="4dp"
android:textStyle="bold" />
</FrameLayout>
<eu.kanade.tachiyomi.ui.reader.PageIndicatorTextView
android:id="@+id/page_number"
style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:padding="4dp"
android:textStyle="bold" />
<eu.kanade.tachiyomi.ui.reader.ReaderColorFilterView
android:id="@+id/color_overlay"