mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 19:31:49 +01:00
Fixed reader activity layout issues
This commit is contained in:
parent
af817fb13c
commit
22eb46ac0b
@ -312,8 +312,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
||||
// 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<ReaderPresenter>(),
|
||||
// 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<ReaderPresenter>(),
|
||||
}
|
||||
}
|
||||
|
||||
appbar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
leftMargin = insets.systemWindowInsetLeft
|
||||
rightMargin = insets.systemWindowInsetRight
|
||||
}
|
||||
toolbar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
topMargin = insets.systemWindowInsetTop
|
||||
}
|
||||
v.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
chapters_bottom_sheet.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
leftMargin = insets.systemWindowInsetLeft
|
||||
rightMargin = insets.systemWindowInsetRight
|
||||
}
|
||||
@ -372,7 +375,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
||||
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<ReaderPresenter>(),
|
||||
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<ReaderPresenter>(),
|
||||
}
|
||||
}
|
||||
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) {
|
||||
|
@ -41,26 +41,27 @@
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorSecondary"
|
||||
android:stateListAnimator="@null"
|
||||
android:theme="?attr/actionBarTheme"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@android:color/transparent" />
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@android:color/transparent" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<include layout="@layout/reader_chapters_sheet"/>
|
||||
<include layout="@layout/reader_chapters_sheet" />
|
||||
|
||||
<View
|
||||
android:id="@+id/brightness_overlay"
|
||||
|
Loading…
Reference in New Issue
Block a user