Skip to content

TRUST-1963 (bug fix) - Fix blank banner on light/dark mode switch#33

Merged
graham-crackr merged 1 commit into
mainfrom
TRUST-1963-android-sdk-switching-between-light-and-dark-mode-after-sdk-initialization-can-lead-to-blank-banner
Jun 24, 2026
Merged

TRUST-1963 (bug fix) - Fix blank banner on light/dark mode switch#33
graham-crackr merged 1 commit into
mainfrom
TRUST-1963-android-sdk-switching-between-light-and-dark-mode-after-sdk-initialization-can-lead-to-blank-banner

Conversation

@graham-crackr

Copy link
Copy Markdown
Collaborator

Jira Ticket

https://datagrail.atlassian.net/browse/TRUST-1963

Summary

When a user switches between light and dark mode on their device while the consent banner is open, the banner content may appear blank because text and background colors become mismatched (e.g., dark text on dark background). This happens because colors are applied programmatically in onCreateView, but the Fragment's view is not re-created when the configuration changes.

This PR fixes the issue by overriding onConfigurationChanged to detect theme changes and reapply all color resources to existing views, ensuring the banner remains readable regardless of when the user switches themes.

Key Changes

  • Override onConfigurationChanged in BannerDialog to detect UI mode changes
  • Add reapplyColors() method to refresh close button color and re-render the current layer
  • Add reapplyColorsRecursively() helper to update background colors throughout the view hierarchy
  • Import android.content.res.Configuration for configuration change detection

Checklist

  • Tests updated or created
  • Changes verified locally

Override onConfigurationChanged in BannerDialog to reapply all color
resources when the UI mode changes. Previously, colors set in
onCreateView would become stale when the system switched between light
and dark mode, causing text and background to render as the same color.

The fix adds reapplyColors() to refresh the close button color and
re-render the current layer, plus a helper method to recursively update
background colors throughout the view hierarchy.
@graham-crackr graham-crackr requested a review from lucasv-dg June 24, 2026 19:23
@graham-crackr graham-crackr merged commit 5eb58c0 into main Jun 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants