Skip to content

Commit

Permalink
Fixed: The bottom bar disappears when reopening the app from the back…
Browse files Browse the repository at this point in the history
…ground.

* The issue was that we were setting the bottom margin to `0` when the fragment was moved to the background (i.e., when switching fragments) to prevent the bottom margin from affecting other screens. This was applied to the `NavHostContainer`, which hosts the reader fragment. Enabling the bottom margin when the fragment view is created worked in most cases. However, on Android 15, the system saves the fragment state and does not recreate the view, which means our margin-setting logic was not executed. As a result, the `bottomAppBar` appeared to disappear, but in reality, it was rendering behind the `BottomNavigationView` (the three options at the bottom).
* To fix this, we now set the bottom margin in the `onResume` method so that whenever the reader screen becomes visible, the bottom margin is automatically adjusted.
  • Loading branch information
MohitMaliDeveloper authored and kelson42 committed Jan 31, 2025
1 parent e61e3e8 commit b573fe4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class KiwixReaderFragment : CoreReaderFragment() {
}
activity.supportActionBar?.setDisplayHomeAsUpEnabled(true)
toolbar?.let { activity.setupDrawerToggle(it, true) }
setFragmentContainerBottomMarginToSizeOfNavBar()
openPageInBookFromNavigationArguments()
}

Expand Down Expand Up @@ -237,6 +236,7 @@ class KiwixReaderFragment : CoreReaderFragment() {

override fun onResume() {
super.onResume()
setFragmentContainerBottomMarginToSizeOfNavBar()
if (isFullScreenVideo || isInFullScreenMode()) {
hideNavBar()
}
Expand Down

0 comments on commit b573fe4

Please sign in to comment.