Skip to content

fix(sample): repair toolbar theming and do an edge-to-edge pass - #668

Merged
mikepenz merged 1 commit into
developfrom
fix/sample-edge-to-edge
Aug 20, 2026
Merged

fix(sample): repair toolbar theming and do an edge-to-edge pass#668
mikepenz merged 1 commit into
developfrom
fix/sample-edge-to-edge

Conversation

@mikepenz

Copy link
Copy Markdown
Owner

The sample app's toolbar renders blank on recent Android versions: CustomToolbarStyle hardcoded white title/subtitle text on a ?colorPrimary background, and under Theme.Material3.DayNight in dark mode colorPrimary is a light tone — white on near-white. The old AppCompat themes had a dark colorPrimary, M3 inverted it.

While in there, the app never got an edge-to-edge pass.

Changes

  • Toolbar theming — drop CustomToolbarStyle / CustomTitleTextAppearance / CustomSubTitleTextAppearance and the colorControlNormal white override; use Widget.Material3.Toolbar.Surface and let M3 resolve content colors per light/dark. Same for activity_playground.xml's inline ?attr/colorPrimary + ThemeOverlay.MaterialComponents.Dark.
  • Menu iconsColor.WHITEgetThemeColor(android.R.attr.textColorPrimary); the hardcoded white had the same invisibility problem in light mode.
  • values-v21/themes.xml deletedwindowTranslucentStatus, statusBarColor and navigationBarColor are no-ops under Android 15 edge-to-edge, and the window transitions it declared were unused (no makeSceneTransitionAnimation anywhere in the sample). minSdk is well above 21, so the qualifier was moot regardless.
  • Edge-to-edgeenableEdgeToEdge() in both activities plus one shared applyEdgeToEdgeInsets(root, topView, bottomView) helper: status bar inset onto the toolbar, navigation bar inset onto the scrolling content, horizontal bar/cutout insets onto both.
  • activity_main.xmlfitsSystemWindows="true" on the ConstraintLayout. DrawerLayout otherwise applies the insets to that child as margins, which boxes the content inside the system bars and defeats edge-to-edge. The slider keeps its own fitsSystemWindows; MaterialDrawer handles its insets itself.

Testing

:app:assembleDebug passes. Installed on a device — the toolbar title, drawer toggle and menu icons are visible again in both themes, and content draws behind the system bars with correct padding.

- toolbar used a white-on-?colorPrimary style, which is invisible under
  Theme.Material3.DayNight in dark mode; use Widget.Material3.Toolbar.Surface
  and let M3 resolve the content colors
- menu icons hardcoded Color.WHITE, same problem in light mode
- drop values-v21/themes.xml: windowTranslucentStatus, statusBarColor and
  navigationBarColor are no-ops under Android 15 edge-to-edge, and the
  window transitions it declared were never used
- enable edge-to-edge in both activities and apply the insets explicitly
Copilot AI lite review requested due to automatic review settings August 20, 2026 16:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mikepenz mikepenz added the other label Aug 20, 2026
@mikepenz
mikepenz merged commit 4011316 into develop Aug 20, 2026
2 checks passed
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.

2 participants