Using frame instead of appbar in reader

Not sure if will fix the disappearing page bug but appbars are weird enough to cause it
This commit is contained in:
Jay 2020-05-22 21:28:47 -04:00
parent 26081fae64
commit 42e299366a
2 changed files with 19 additions and 20 deletions

View File

@ -389,7 +389,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
if (visible) { if (visible) {
snackbar?.dismiss() snackbar?.dismiss()
systemUi?.show() systemUi?.show()
appbar.visible() reader_menu.visible()
if (chapters_bottom_sheet.sheetBehavior.isExpanded()) { if (chapters_bottom_sheet.sheetBehavior.isExpanded()) {
chapters_bottom_sheet.sheetBehavior?.isHideable = false chapters_bottom_sheet.sheetBehavior?.isHideable = false
@ -416,14 +416,14 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.exit_to_top) val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.exit_to_top)
toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() { toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() {
override fun onAnimationEnd(animation: Animation) { override fun onAnimationEnd(animation: Animation) {
appbar.gone() reader_menu.gone()
} }
}) })
appbar.startAnimation(toolbarAnimation) appbar.startAnimation(toolbarAnimation)
BottomSheetBehavior.from(chapters_bottom_sheet).isHideable = true BottomSheetBehavior.from(chapters_bottom_sheet).isHideable = true
chapters_bottom_sheet.sheetBehavior?.hide() chapters_bottom_sheet.sheetBehavior?.hide()
} else { } else {
appbar.gone() reader_menu.gone()
} }
} }
menuStickyVisible = false menuStickyVisible = false
@ -713,7 +713,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
} }
} }
if (sheetManageNavColor) window.navigationBarColor = getResourceColor(R.attr.colorSecondary) if (sheetManageNavColor) window.navigationBarColor = getResourceColor(R.attr.colorSecondary)
appbar.visible() reader_menu.visible()
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_top) val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_top)
toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() { toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() {
override fun onAnimationStart(animation: Animation) { override fun onAnimationStart(animation: Animation) {

View File

@ -1,5 +1,4 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/reader_layout" android:id="@+id/reader_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -35,17 +34,16 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="gone" /> android:visibility="gone" />
<com.google.android.material.appbar.AppBarLayout <FrameLayout
android:id="@+id/reader_menu"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorSecondary" android:background="?attr/colorSecondary">
android:stateListAnimator="@null"
android:theme="?attr/actionBarTheme"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
@ -53,7 +51,8 @@
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="@android:color/transparent" /> android:background="@android:color/transparent" />
</com.google.android.material.appbar.AppBarLayout> </FrameLayout>
</FrameLayout>
<include layout="@layout/reader_chapters_sheet" /> <include layout="@layout/reader_chapters_sheet" />