Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Navigation drawer showing while reading a book in fullscreen mode. #4189

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@
} else {
showNavBar()
}
super.onFullscreenVideoToggled(isFullScreen)

Check warning on line 311 in app/src/main/java/org/kiwix/kiwixmobile/nav/destination/reader/KiwixReaderFragment.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/org/kiwix/kiwixmobile/nav/destination/reader/KiwixReaderFragment.kt#L311

Added line #L311 was not covered by tests
}

override fun openFullScreen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1643,12 +1643,29 @@
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)

Check warning on line 1657 in core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt#L1657

Added line #L1657 was not covered by tests
} else {
if (!isInFullScreenMode()) {
toolbar?.let(::setUpDrawerToggle)
setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)

Check warning on line 1661 in core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt#L1661

Added line #L1661 was not covered by tests
}
}
}

@Suppress("MagicNumber")
protected open fun openFullScreen() {
(requireActivity() as CoreMainActivity).disableDrawer(false)

Check warning on line 1668 in core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt#L1668

Added line #L1668 was not covered by tests
toolbarContainer?.visibility = View.GONE
bottomToolbar?.visibility = View.GONE
exitFullscreenButton?.visibility = View.VISIBLE
Expand All @@ -1664,6 +1681,8 @@

@Suppress("MagicNumber")
open fun closeFullScreen() {
toolbar?.let(::setUpDrawerToggle)
setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)

Check warning on line 1685 in core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt#L1685

Added line #L1685 was not covered by tests
sharedPreferenceUtil?.putPrefFullScreen(false)
toolbarContainer?.visibility = View.VISIBLE
updateBottomToolbarVisibility()
Expand Down
Loading