From b573fe4040a0a947b6f157d98e24efa47089a525 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Wed, 29 Jan 2025 18:16:46 +0530 Subject: [PATCH] Fixed: The bottom bar disappears when reopening the app from the background. * 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. --- .../kiwixmobile/nav/destination/reader/KiwixReaderFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/reader/KiwixReaderFragment.kt b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/reader/KiwixReaderFragment.kt index 642eee259c..eaf1c41311 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/reader/KiwixReaderFragment.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/reader/KiwixReaderFragment.kt @@ -84,7 +84,6 @@ class KiwixReaderFragment : CoreReaderFragment() { } activity.supportActionBar?.setDisplayHomeAsUpEnabled(true) toolbar?.let { activity.setupDrawerToggle(it, true) } - setFragmentContainerBottomMarginToSizeOfNavBar() openPageInBookFromNavigationArguments() } @@ -237,6 +236,7 @@ class KiwixReaderFragment : CoreReaderFragment() { override fun onResume() { super.onResume() + setFragmentContainerBottomMarginToSizeOfNavBar() if (isFullScreenVideo || isInFullScreenMode()) { hideNavBar() }