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: The bottom bar disappears when reopening the app from the background. #4197

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

MohitMaliFtechiz
Copy link
Collaborator

Fixes #4196

  • 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.
screen-20250129-181721.mp4

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.01%. Comparing base (e61e3e8) to head (b573fe4).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4197      +/-   ##
============================================
+ Coverage     56.90%   57.01%   +0.10%     
- Complexity     1538     1543       +5     
============================================
  Files           313      313              
  Lines         13513    13513              
  Branches       1695     1695              
============================================
+ Hits           7690     7704      +14     
+ Misses         4650     4639      -11     
+ Partials       1173     1170       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…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.
@kelson42 kelson42 merged commit a6a3843 into main Feb 1, 2025
31 checks passed
@kelson42 kelson42 deleted the Fixes#4196 branch February 1, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The bottom bar disappears when we reopen the app from the background.
3 participants