Fix: FAB buttons shrinking and opening vertically in landscape mode on Contributions screen#6756
Conversation
…Contributions screen
|
@Shoaibkhalid65 |
Thank you for testing and confirming! Appreciate the feedback. |
app/src/main/java/fr/free/nrw/commons/contributions/ContributionsListFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/contributions/ContributionsListFragment.kt
Show resolved
Hide resolved
…ape-contributions' into fix/fab-orientation-reset-landscape-contributions
|
✅ Generated APK variants! |
Fixes #6755
Problem
On the Contributions screen, FAB buttons (camera, gallery, custom gallery) correctly open
horizontally in landscape mode on first visit. After navigating to another tab and returning,
the FABs revert to vertical orientation and appear shrunk or partially hidden. Same behaviour
occurs in the Contributions tab of the Profile screen.
Root Cause
onConfigurationChangedcorrectly setsfabLayout.orientationtoHORIZONTALin landscape,but
onCreateViewalways inflates the layout with the XML default (vertical). When the usernavigates away and returns,
onCreateViewruns again resetting orientation to vertical, whileonConfigurationChangeddoes not fire since orientation hasn't changed.Fix
Added orientation check in
onCreateViewto setfabLayout.orientationbased on currentdevice orientation, consistent with what
onConfigurationChangedalready does.Demo
Before:
fabs_broken_land_contributions.mp4
After:
fixed_broken_fabs_land_contributions.mp4
Tested on: [Samsung a07] | Android [16]