From 22eb46ac0b2f7da383171a490879a1db292cdce1 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 4 May 2020 15:00:00 -0400 Subject: [PATCH] Fixed reader activity layout issues --- .../tachiyomi/ui/reader/ReaderActivity.kt | 24 +++++++------ app/src/main/res/layout/reader_activity.xml | 35 ++++++++++--------- 2 files changed, 32 insertions(+), 27 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 fcd2c2a8f3..522ded9bc9 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 @@ -312,8 +312,7 @@ class ReaderActivity : BaseRxActivity(), // Set toolbar setSupportActionBar(toolbar) val primaryColor = ColorUtils.setAlphaComponent( - getResourceColor(R.attr.colorSecondary), - 200 + getResourceColor(R.attr.colorSecondary), 200 ) appbar.setBackgroundColor(primaryColor) window.statusBarColor = Color.TRANSPARENT @@ -334,8 +333,8 @@ class ReaderActivity : BaseRxActivity(), // Set initial visibility setMenuVisibility(menuVisible) chapters_bottom_sheet.sheetBehavior?.isHideable = !menuVisible - if (!menuVisible) - chapters_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN + if (!menuVisible) chapters_bottom_sheet.sheetBehavior?.state = + BottomSheetBehavior.STATE_HIDDEN reader_layout.doOnApplyWindowInsets { v, insets, _ -> sheetManageNavColor = when { insets.isBottomTappable() -> { @@ -352,10 +351,14 @@ class ReaderActivity : BaseRxActivity(), } } + appbar.updateLayoutParams { + leftMargin = insets.systemWindowInsetLeft + rightMargin = insets.systemWindowInsetRight + } toolbar.updateLayoutParams { topMargin = insets.systemWindowInsetTop } - v.updateLayoutParams { + chapters_bottom_sheet.updateLayoutParams { leftMargin = insets.systemWindowInsetLeft rightMargin = insets.systemWindowInsetRight } @@ -372,7 +375,7 @@ class ReaderActivity : BaseRxActivity(), if (visible) { snackbar?.dismiss() systemUi?.show() - toolbar.visibility = View.VISIBLE + appbar.visible() if (chapters_bottom_sheet.sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) { chapters_bottom_sheet.sheetBehavior?.isHideable = false @@ -399,14 +402,15 @@ class ReaderActivity : BaseRxActivity(), val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.exit_to_top) toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() { override fun onAnimationEnd(animation: Animation) { - toolbar.visibility = View.GONE + appbar.gone() } }) appbar.startAnimation(toolbarAnimation) BottomSheetBehavior.from(chapters_bottom_sheet).isHideable = true - BottomSheetBehavior.from(chapters_bottom_sheet).state = BottomSheetBehavior.STATE_HIDDEN + BottomSheetBehavior.from(chapters_bottom_sheet).state = + BottomSheetBehavior.STATE_HIDDEN } else { - toolbar.visibility = View.GONE + appbar.gone() } } menuStickyVisible = false @@ -661,7 +665,7 @@ class ReaderActivity : BaseRxActivity(), } } if (sheetManageNavColor) window.navigationBarColor = getResourceColor(R.attr.colorSecondary) - toolbar.visibility = View.VISIBLE + appbar.visible() val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_top) toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() { override fun onAnimationStart(animation: Animation) { diff --git a/app/src/main/res/layout/reader_activity.xml b/app/src/main/res/layout/reader_activity.xml index 704166eb76..9db3413b11 100644 --- a/app/src/main/res/layout/reader_activity.xml +++ b/app/src/main/res/layout/reader_activity.xml @@ -41,26 +41,27 @@ android:layout_height="match_parent" android:visibility="gone" /> - + + + android:layout_height="?attr/actionBarSize" + android:background="@android:color/transparent" /> - + - - - +