Skip to content

Fix bookmarks rotation issue#6753

Open
Roniscend wants to merge 1 commit intocommons-app:mainfrom
Roniscend:fix-bookmarks-tab
Open

Fix bookmarks rotation issue#6753
Roniscend wants to merge 1 commit intocommons-app:mainfrom
Roniscend:fix-bookmarks-tab

Conversation

@Roniscend
Copy link
Contributor

Description (required)

Fixes #6700
Handled configuration changes in BookmarkFragment to ensure proper UI behavior in landscape mode.

Tests performed (required)

Tested 6.3.0-debug on Pixel 9 Android 16

Screenshots (for UI changes only)

a.mp4

Copilot AI review requested due to automatic review settings March 17, 2026 20:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the Bookmarks UI to remain well-aligned across device rotations by updating TabLayout behavior based on orientation, addressing the tab-title misalignment reported in #6700.

Changes:

  • Apply an orientation-based TabLayout mode update during initial setup.
  • Handle runtime configuration changes in BookmarkFragment to re-apply the correct TabLayout mode/gravity on rotation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

binding!!.tabLayout.visibility = View.GONE
}
}
override fun onConfigurationChanged(newConfig: android.content.res.Configuration) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to handle this manually? Could you check if we've set configChanges for the activity?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config changes are set in the android manifest for Mainactivity which is host for bookmarkfragment
i think this pr is focused on manipulating the tablayout.mode and tablayout.gravity based on the current device orientation

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not recommended to forcefully prevent activity recreation. My understanding is that this is when we need to manually handle orientation changes. I would recommend checking for alternatives once for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed which would mess with other parts of the activity
alternatives would be best with using styles
something like this .

<style name="BookmarkTabStyle">
    <item name="app:tabMode">scrollable</item>
    <item name="app:tabGravity">fill</item>
</style>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RitikaPahwa4444 You are right , Mainactivity file has configchanges set , this was a localized workaround without triggering a large refactor , If this approach is not satisfactory i can implement OnLayoutChangeListener on the Tablayout

Copy link
Contributor Author

@Roniscend Roniscend Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed which would mess with other parts of the activity alternatives would be best with using styles something like this .

<style name="BookmarkTabStyle">
    <item name="app:tabMode">scrollable</item>
    <item name="app:tabGravity">fill</item>
</style>

@rovertrack Thanks for the suggestion , However relying on XML styles won't actually work in this architectural scenario, since MainActivity uses configChanges="orientation|screenSize", the Fragment is never destroyed and the view hierarchy is never re inflated during rotation. This means Android won't dynamically swap between a values and values-land style the layout will just get permanently stuck in whichever style it was initially inflated with.
Also a quick heads up tabGravity is ignored by the framework whenever tabMode = "scrollable" is used

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No workarounds for config changes, please 🙂 I've pinned the issue where I've shared my thoughts, we've already patched a lot. So, any localised bug fixes might not get merged - there are some other long standing PRs too.

If, however, we're extending it to Main activity in general, we can discuss the approach.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed #6538

Signed-off-by: Owm Dubey <owmdubey163@gmail.com>
@github-actions
Copy link

✅ Generated APK variants!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bookmark tab titles align to left after configuration change

4 participants