Skip to content

fix: widen snackbars on tablets (#4921) - #4985

Open
ibrahim-iqbal wants to merge 1 commit into
owncloud:masterfrom
ibrahim-iqbal:fix/short-snackbar-tablet-4921
Open

ibrahim-iqbal wants to merge 1 commit into
owncloud:masterfrom
ibrahim-iqbal:fix/short-snackbar-tablet-4921

Conversation

@ibrahim-iqbal

Copy link
Copy Markdown

Related Issues

App: closes #4921

Snackbars used the Material default width on tablets, so they only occupied a narrow band in the middle of the screen and left most of the row empty. This ports the phone-like behaviour to tablets: at a smallest-width of at least 600dp — the same qualifier the existing layout-sw600dp folder targets — the snackbar view expands to fill the parent, so a device the size of the Galaxy Tab A8 in the original report gets a snackbar that spans the row.

Changes

  • New helper owncloudApp/src/main/java/com/owncloud/android/extensions/SnackbarExt.kt: Snackbar.applyResponsiveWidth() reads resources.configuration.smallestScreenWidthDp and, on tablet-sized devices (>= 600dp), sets the snackbar view's layout width to MATCH_PARENT. Below the threshold it returns the snackbar unchanged, so phones keep the current Material width.

  • ActivityExt.kt and FragmentExt.kt: the four helpers (showMessageInSnackbar, showSnackbarWithAction on both Activity and Fragment) chain applyResponsiveWidth() before show().

  • Inline Snackbar.make(...) sites that bypass the helpers: FileDisplayActivity.kt:1411, PreviewImageFragment.kt:251/257, PreviewAudioFragment.kt:308/314, PreviewTextFragment.kt:173/181, PreviewVideoActivity.kt:414/422. All now chain the same helper so no snackbar in the app is narrow on a tablet.

  • Changelog file at changelog/unreleased/4921 (Bugfix: type).

  • Release Notes in ReleaseNotesViewModel.kt — not added, this is a UI polish fix rather than a headline feature; happy to add one if you'd prefer.


QA

  • Local:
    • ./gradlew :owncloudApp:compileOriginalDebugKotlin → BUILD SUCCESSFUL.
    • ./gradlew :owncloudApp:ktlintCheck — no new violations in the changed files; pre-existing ktlint violations elsewhere on master are unchanged.
    • No behaviour change on devices below 600dp smallestScreenWidthDp: applyResponsiveWidth() returns early and the snackbar keeps its Material default layout params.
  • Manual check to run on-device before merge: trigger any snackbar (e.g. set/unset a file as available offline in PreviewImageFragment) on a sw600dp+ tablet (Galaxy Tab A8 in the original report) and confirm the snackbar now spans the row. A phone (< 600dp) should look identical to today.

Snackbars used the Material default width on tablets, so they only
occupied a narrow band in the middle of the screen and left the rest of
the row empty. Add a small extension, applyResponsiveWidth, that
expands the snackbar view to match the parent width when the device
reports a smallest-width of at least 600dp, matching the sw600dp
qualifier the layouts already use. Apply it in the four snackbar helpers
in ActivityExt and FragmentExt, and in the inline Snackbar.make sites in
FileDisplayActivity, PreviewImageFragment, PreviewAudioFragment,
PreviewTextFragment, and PreviewVideoActivity so every snackbar in the
app benefits.

Phones and other devices below the 600dp threshold keep the current
Material width.

Signed-off-by: ibrahim-iqbal <ibrahim-iqbal@users.noreply.github.com>
@ibrahim-iqbal
ibrahim-iqbal requested a review from a team as a code owner September 19, 2026 11:16
@CLAassistant

CLAassistant commented Sep 19, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@joragua

joragua commented Sep 21, 2026

Copy link
Copy Markdown
Member

Hi @ibrahim-iqbal! Thanks for opening this PR! 🙌🏻

I'll start with the CR as soon as possible. Stay tuned!

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.

[BUG] Short snackbar in tablets

3 participants