mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Fixed: Navigation drawer showing while reading a book in fullscreen mode.
* Disabled the right drawer when the user is reading a book in fullscreen mode to ensure uninterrupted reading. * Also disabled the drawer while a video is playing in fullscreen mode to avoid interruptions during video playback.
This commit is contained in:
parent
99aae9441b
commit
22a3b4d9d2
@ -308,6 +308,7 @@ class KiwixReaderFragment : CoreReaderFragment() {
|
||||
} else {
|
||||
showNavBar()
|
||||
}
|
||||
super.onFullscreenVideoToggled(isFullScreen)
|
||||
}
|
||||
|
||||
override fun openFullScreen() {
|
||||
|
@ -283,11 +283,16 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
|
||||
}
|
||||
}
|
||||
|
||||
open fun disableDrawer() {
|
||||
open fun disableDrawer(disableRightDrawer: Boolean = true) {
|
||||
drawerToggle?.isDrawerIndicatorEnabled = false
|
||||
drawerContainerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
||||
// Disable the right drawer
|
||||
drawerContainerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, GravityCompat.END)
|
||||
if (disableRightDrawer) {
|
||||
// Disable the right drawer
|
||||
drawerContainerLayout.setDrawerLockMode(
|
||||
DrawerLayout.LOCK_MODE_LOCKED_CLOSED,
|
||||
GravityCompat.END
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
open fun onNavigationItemSelected(item: MenuItem): Boolean {
|
||||
|
@ -1643,12 +1643,29 @@ abstract class CoreReaderFragment :
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the toggling of fullscreen video mode and adjusts the drawer's behavior accordingly.
|
||||
* - If a video is playing in fullscreen mode, the drawer is disabled to restrict interactions.
|
||||
* - When fullscreen mode is exited, the drawer is re-enabled unless the reader is still
|
||||
* in fullscreen mode.
|
||||
* - Specifically, if the reader is in fullscreen mode and the user plays a video in
|
||||
* fullscreen, then exits the video's fullscreen mode, the drawer remains disabled
|
||||
* because the reader is still in fullscreen mode.
|
||||
*/
|
||||
override fun onFullscreenVideoToggled(isFullScreen: Boolean) {
|
||||
// does nothing because custom doesn't have a nav bar
|
||||
if (isFullScreen) {
|
||||
(requireActivity() as CoreMainActivity).disableDrawer(false)
|
||||
} else {
|
||||
if (!isInFullScreenMode()) {
|
||||
toolbar?.let(::setUpDrawerToggle)
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
protected open fun openFullScreen() {
|
||||
(requireActivity() as CoreMainActivity).disableDrawer(false)
|
||||
toolbarContainer?.visibility = View.GONE
|
||||
bottomToolbar?.visibility = View.GONE
|
||||
exitFullscreenButton?.visibility = View.VISIBLE
|
||||
@ -1664,6 +1681,8 @@ abstract class CoreReaderFragment :
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
open fun closeFullScreen() {
|
||||
toolbar?.let(::setUpDrawerToggle)
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
|
||||
sharedPreferenceUtil?.putPrefFullScreen(false)
|
||||
toolbarContainer?.visibility = View.VISIBLE
|
||||
updateBottomToolbarVisibility()
|
||||
|
Loading…
x
Reference in New Issue
Block a user