Fix fullscreen not applying on opening reader (fixes #4723)

This commit is contained in:
arkon 2021-03-28 10:48:41 -04:00
parent c4b975b777
commit 3d99a8ebdb
2 changed files with 10 additions and 7 deletions

View File

@ -397,10 +397,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
* [animate] the views. * [animate] the views.
*/ */
fun setMenuVisibility(visible: Boolean, animate: Boolean = true) { fun setMenuVisibility(visible: Boolean, animate: Boolean = true) {
if (visible == menuVisible) {
return
}
menuVisible = visible menuVisible = visible
if (visible) { if (visible) {
if (preferences.fullscreen().get()) { if (preferences.fullscreen().get()) {

View File

@ -23,13 +23,20 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : TabbedBottomSh
val filterTabIndex = getTabViews().indexOf(colorFilterSettings) val filterTabIndex = getTabViews().indexOf(colorFilterSettings)
binding.tabs.addOnTabSelectedListener(object : SimpleTabSelectedListener() { binding.tabs.addOnTabSelectedListener(object : SimpleTabSelectedListener() {
// Remove dimmed backdrop so color filter changes can be previewed
override fun onTabSelected(tab: TabLayout.Tab?) { override fun onTabSelected(tab: TabLayout.Tab?) {
val isFilterTab = tab?.position == filterTabIndex val isFilterTab = tab?.position == filterTabIndex
// Remove dimmed backdrop so color filter changes can be previewed
window?.setDimAmount(if (isFilterTab) 0f else sheetBackgroundDim) window?.setDimAmount(if (isFilterTab) 0f else sheetBackgroundDim)
activity.setMenuVisibility(!isFilterTab)
// Hide toolbars
if (activity.menuVisible != !isFilterTab) {
activity.setMenuVisibility(!isFilterTab)
}
// Partially collapse the sheet for better preview
if (isFilterTab) { if (isFilterTab) {
sheetBehavior?.state = BottomSheetBehavior.STATE_HALF_EXPANDED sheetBehavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
} }
} }
}) })