Fix: Snackbar overlapping bottom navigation bar on Explore screen#6742
Fix: Snackbar overlapping bottom navigation bar on Explore screen#6742Shoaibkhalid65 wants to merge 3 commits intocommons-app:mainfrom
Conversation
Review by GSoC applicantreproducing the original issue : az_recorder_20260318_031718.mp4the snackbar indeed occurs from the nav bottom bar after applying the changes by @Shoaibkhalid65 : az_recorder_20260318_032545.mp4the original issue has been solved as addressed in this pr ✅ |
nicolas-raoul
left a comment
There was a problem hiding this comment.
Code looks good to me.
Thanks @rovertrack for the review!
|
✅ Generated APK variants! |
| override fun showSnackbar() { | ||
| ViewUtil.showShortSnackbar(binding.paginatedSearchResultsList, errorTextId) | ||
| val anchorView= activity?.findViewById<View>(R.id.fragment_main_nav_tab_layout) | ||
| ViewUtil.showShortSnackbar(binding.paginatedSearchResultsList, errorTextId,anchorView) |
There was a problem hiding this comment.
Thanks a lot for contributing @Shoaibkhalid65. No issues with the current approach, but how about using Coordinator layout at the xml file i.e in main.xml?
There was a problem hiding this comment.
Hi @neeldoshii, I tried your suggestion of using CoordinatorLayout. I first tried replacing the RelativeLayout in main.xml but it caused all fragment content to shift behind the bottom navigation bar and the Snackbar stopped showing entirely. I also tried replacing the RelativeLayout in fragment_explore_map.xml but the TabLayout started overlapping the content below it.
I think the issue is that the existing layouts rely on RelativeLayout's layout_above and layout_below constraints for positioning, and switching to CoordinatorLayout without restructuring the full layout hierarchy breaks those constraints.
Could you point me to the exact file or layout you had in mind? I want to make sure I implement this the right way rather than guessing. Happy to make whatever changes you suggest.
Fixes #6741
Problem
On the Explore screen, when an error occurs while loading images, the Snackbar was appearing at the very bottom of the screen and overlapping the bottom navigation bar, making it partially hidden.
Root Cause
showShortSnackbarinViewUtilhad no anchor view parameter, causing the Snackbar to render at the bottom of the window, covering the navigation bar.Fix
anchorViewparameter toViewUtil.showShortSnackbar()BasePagingFragment.showSnackbar(), passedR.id.fragment_main_nav_tab_layoutas the anchor view so the Snackbar appears above the bottom navigation barScreenshots
Before:

unfixed_snackbar_alig_vid.mp4
After:

fixed_snackbar_align_vid.mp4
Tested on: Samsung a07 | Android 16