fix: widen snackbars on tablets (#4921) - #4985
Open
ibrahim-iqbal wants to merge 1 commit into
Open
ibrahim-iqbal wants to merge 1 commit into
ibrahim-iqbal wants to merge 1 commit into
Conversation
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>
Member
|
Hi @ibrahim-iqbal! Thanks for opening this PR! 🙌🏻 I'll start with the CR as soon as possible. Stay tuned! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-sw600dpfolder 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()readsresources.configuration.smallestScreenWidthDpand, on tablet-sized devices (>= 600dp), sets the snackbar view's layout width toMATCH_PARENT. Below the threshold it returns the snackbar unchanged, so phones keep the current Material width.ActivityExt.ktandFragmentExt.kt: the four helpers (showMessageInSnackbar,showSnackbarWithActionon bothActivityandFragment) chainapplyResponsiveWidth()beforeshow().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
./gradlew :owncloudApp:compileOriginalDebugKotlin→ BUILD SUCCESSFUL../gradlew :owncloudApp:ktlintCheck— no new violations in the changed files; pre-existing ktlint violations elsewhere onmasterare unchanged.applyResponsiveWidth()returns early and the snackbar keeps its Material default layout params.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.