mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 05:25:04 +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
|
// Set toolbar
|
||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
val primaryColor = ColorUtils.setAlphaComponent(
|
val primaryColor = ColorUtils.setAlphaComponent(
|
||||||
getResourceColor(R.attr.colorSecondary),
|
getResourceColor(R.attr.colorSecondary), 200
|
||||||
200
|
|
||||||
)
|
)
|
||||||
appbar.setBackgroundColor(primaryColor)
|
appbar.setBackgroundColor(primaryColor)
|
||||||
window.statusBarColor = Color.TRANSPARENT
|
window.statusBarColor = Color.TRANSPARENT
|
||||||
@ -334,8 +333,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
// Set initial visibility
|
// Set initial visibility
|
||||||
setMenuVisibility(menuVisible)
|
setMenuVisibility(menuVisible)
|
||||||
chapters_bottom_sheet.sheetBehavior?.isHideable = !menuVisible
|
chapters_bottom_sheet.sheetBehavior?.isHideable = !menuVisible
|
||||||
if (!menuVisible)
|
if (!menuVisible) chapters_bottom_sheet.sheetBehavior?.state =
|
||||||
chapters_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN
|
BottomSheetBehavior.STATE_HIDDEN
|
||||||
reader_layout.doOnApplyWindowInsets { v, insets, _ ->
|
reader_layout.doOnApplyWindowInsets { v, insets, _ ->
|
||||||
sheetManageNavColor = when {
|
sheetManageNavColor = when {
|
||||||
insets.isBottomTappable() -> {
|
insets.isBottomTappable() -> {
|
||||||
@ -352,10 +351,14 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appbar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
|
leftMargin = insets.systemWindowInsetLeft
|
||||||
|
rightMargin = insets.systemWindowInsetRight
|
||||||
|
}
|
||||||
toolbar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
toolbar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
topMargin = insets.systemWindowInsetTop
|
topMargin = insets.systemWindowInsetTop
|
||||||
}
|
}
|
||||||
v.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
chapters_bottom_sheet.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
leftMargin = insets.systemWindowInsetLeft
|
leftMargin = insets.systemWindowInsetLeft
|
||||||
rightMargin = insets.systemWindowInsetRight
|
rightMargin = insets.systemWindowInsetRight
|
||||||
}
|
}
|
||||||
@ -372,7 +375,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
if (visible) {
|
if (visible) {
|
||||||
snackbar?.dismiss()
|
snackbar?.dismiss()
|
||||||
systemUi?.show()
|
systemUi?.show()
|
||||||
toolbar.visibility = View.VISIBLE
|
appbar.visible()
|
||||||
|
|
||||||
if (chapters_bottom_sheet.sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) {
|
if (chapters_bottom_sheet.sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) {
|
||||||
chapters_bottom_sheet.sheetBehavior?.isHideable = false
|
chapters_bottom_sheet.sheetBehavior?.isHideable = false
|
||||||
@ -399,14 +402,15 @@ 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) {
|
||||||
toolbar.visibility = View.GONE
|
appbar.gone()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
appbar.startAnimation(toolbarAnimation)
|
appbar.startAnimation(toolbarAnimation)
|
||||||
BottomSheetBehavior.from(chapters_bottom_sheet).isHideable = true
|
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 {
|
} else {
|
||||||
toolbar.visibility = View.GONE
|
appbar.gone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menuStickyVisible = false
|
menuStickyVisible = false
|
||||||
@ -661,7 +665,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sheetManageNavColor) window.navigationBarColor = getResourceColor(R.attr.colorSecondary)
|
if (sheetManageNavColor) window.navigationBarColor = getResourceColor(R.attr.colorSecondary)
|
||||||
toolbar.visibility = View.VISIBLE
|
appbar.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) {
|
||||||
|
@ -41,26 +41,27 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/appbar"
|
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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorSecondary"
|
android:background="@android:color/transparent" />
|
||||||
android:stateListAnimator="@null"
|
|
||||||
android:theme="?attr/actionBarTheme"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
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>
|
<include layout="@layout/reader_chapters_sheet" />
|
||||||
|
|
||||||
<include layout="@layout/reader_chapters_sheet"/>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/brightness_overlay"
|
android:id="@+id/brightness_overlay"
|
||||||
|
Loading…
Reference in New Issue
Block a user