Skip to content

Fix UCrop screen overlapping the system bars on Android 15+ (#9084)#9138

Open
shugav wants to merge 1 commit intoelement-hq:developfrom
shugav:bugfix/shugav/9084-ucrop-edge-to-edge-overlap
Open

Fix UCrop screen overlapping the system bars on Android 15+ (#9084)#9138
shugav wants to merge 1 commit intoelement-hq:developfrom
shugav:bugfix/shugav/9084-ucrop-edge-to-edge-overlap

Conversation

@shugav
Copy link
Copy Markdown

@shugav shugav commented Apr 18, 2026

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Apply a dedicated theme to com.yalantis.ucrop.UCropActivity that, on API 35 only, opts the activity out of forced edge-to-edge layout via android: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 — base Theme.Vector.UCrop, just inheriting Theme.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 add android:windowOptOutEdgeToEdgeEnforcement="true".
  • vector/src/main/AndroidManifest.xml — applies android:theme="@style/Theme.Vector.UCrop" to the existing UCropActivity entry.
  • changelog.d/9084.bugfix.

The follow-up plan is documented in the v35 theme's XML comment: when the project bumps to targetSdk = 36 (where windowOptOutEdgeToEdgeEnforcement is no longer honoured), uCrop will need to be upgraded or its layouts overridden in vector/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, AttachmentsPreviewFragment and UCropHelper — does not consume WindowInsets. The result on Android 15:

  • The toolbar (containing the ✓ save checkmark) is drawn under the status bar. On many devices the save gesture is captured by the status bar pull-down instead, so users cannot save their new avatar at all (see the user reports on Profile picture confirmation checkmark overlaps with Android status bar – cannot be clicked #9084 from Pixel 8 Pro / Pixel 6a / Pixel 7a / Moto Edge 60 Pro).
  • The bottom rotate / scale controls are drawn under the 3-button navigation bar, so they are partially obscured and hard to hit.

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.kt already calls setStatusBarColor(...) and setToolbarColor(...), 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 in UCropHelper.

Screenshots / GIFs

Before (Element Classic 1.6.54, Android 15, 3-button nav) After
Title row with the X close 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. Toolbar and bottom controls render fully within the safe area; save button is tappable.

Tests

  • Step 1: Open Element Classic on a device or emulator running Android 15 (API 35). Sign in.
  • Step 2: Tap your avatar → Settings → tap your account name → tap your current profile picture → choose Take photo or Choose from gallery.
  • Step 3: After the picture is captured / picked, the Rotate and crop screen opens.
  • Step 4: Verify the title bar (close X, "Rotate and crop" title, save ) is fully below the status bar.
  • Step 5: Verify the bottom rotate / scale tabs sit fully above the navigation bar with both gesture navigation and 3-button navigation.
  • Step 6: Tap save and confirm the new avatar is uploaded.
  • Step 7: Repeat on Android 14 (API 34) to confirm no regression — the screen should look identical to current behaviour.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

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

…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>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Profile picture confirmation checkmark overlaps with Android status bar – cannot be clicked

2 participants