Fix UCrop screen overlapping the system bars on Android 15+ (#9084)#9138
Open
shugav wants to merge 1 commit intoelement-hq:developfrom
Open
Fix UCrop screen overlapping the system bars on Android 15+ (#9084)#9138shugav wants to merge 1 commit intoelement-hq:developfrom
shugav wants to merge 1 commit intoelement-hq:developfrom
Conversation
…hq#9084) Since the app targets SDK 35, Android 15 forces edge-to-edge layout for every window. UCrop 2.2.8 - the third-party library backing the avatar and image cropping screen - does not consume WindowInsets, so its toolbar (containing the save checkmark) is drawn under the status bar and its bottom rotate / scale controls are drawn under the 3-button navigation bar. On many devices the save button cannot even be tapped because the gesture is captured by the status bar. Apply a dedicated Theme.Vector.UCrop to UCropActivity that, on API 35, sets android:windowOptOutEdgeToEdgeEnforcement="true" - the official escape hatch documented for legacy screens that have not yet migrated to insets-aware layouts. The base theme keeps uCrop's expected AppCompat.Light.NoActionBar parent, so behaviour on API < 35 is unchanged. Signed-off-by: Vladimir Daskalov <shugav@gmail.com>
|
|
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.
Type of change
Content
Apply a dedicated theme to
com.yalantis.ucrop.UCropActivitythat, on API 35 only, opts the activity out of forced edge-to-edge layout viaandroid:windowOptOutEdgeToEdgeEnforcement="true"— the official escape hatch documented for legacy screens that have not yet been migrated to insets-aware layouts.Files changed:
library/ui-styles/src/main/res/values/theme_ucrop.xml— baseTheme.Vector.UCrop, just inheritingTheme.AppCompat.Light.NoActionBar(the parent uCrop's own manifest declares). No-op on API < 35.library/ui-styles/src/main/res/values-v35/theme_ucrop.xml— overrides the theme on API 35 to addandroid:windowOptOutEdgeToEdgeEnforcement="true".vector/src/main/AndroidManifest.xml— appliesandroid:theme="@style/Theme.Vector.UCrop"to the existingUCropActivityentry.changelog.d/9084.bugfix.The follow-up plan is documented in the v35 theme's XML comment: when the project bumps to
targetSdk = 36(wherewindowOptOutEdgeToEdgeEnforcementis no longer honoured), uCrop will need to be upgraded or its layouts overridden invector/src/main/res/layout/to consume insets directly. Doing that today is invasive and out of scope for a bug-fix; this change unblocks affected users right now without touching any other screen.Motivation and context
Closes #9084.
Since the app targets SDK 35, Android 15 forces edge-to-edge layout for every window. UCrop 2.2.8 — the third-party library backing the avatar / image cropping screen invoked from
GalleryOrCameraDialogHelper,AttachmentsPreviewFragmentandUCropHelper— does not consumeWindowInsets. The result on Android 15:Both problems are visible in the original report's screenshot and in @stringlapse's annotated screenshot on the same issue. They reproduce 100% on any device running Android 15 with 3-button navigation; gesture navigation hides the issue at the bottom but the save button at the top is still affected.
UCropHelper.ktalready callssetStatusBarColor(...)andsetToolbarColor(...), so once the activity's window is no longer forced edge-to-edge those colours behave correctly and the toolbar / bottom bar lay out within the safe area. No code changes are required inUCropHelper.Screenshots / GIFs
Xclose button and✓save check are hidden behind the status bar (clock / battery overlap them); bottom rotate / scale tabs are hidden behind the home / back / recents buttons. See screenshots on #9084.Tests
X, "Rotate and crop" title, save✓) is fully below the status bar.Tested devices
Note
Unable to test on a physical device or emulator from the contributor's environment. Reviewer please verify on a real Android 15 device with 3-button navigation. The change is XML-only (a new theme + one manifest attribute) and is the standard documented escape hatch for this exact scenario, so the risk of regression on other API levels is minimal.
Checklist