Skip to content

Runtime theme controls and page transitions - #22

Merged
pschildgen87-code merged 11 commits into
compat/android-6-api23from
feature/theme-runtime-controls
Sep 18, 2026
Merged

pschildgen87-code merged 11 commits into
compat/android-6-api23from
feature/theme-runtime-controls

Conversation

@pschildgen87-code

Copy link
Copy Markdown
Collaborator

Adds Dark/Light/Auto WebView theming, trusted-page color-scheme exposure, profile-controlled status/navigation/splash colors, automatic light/dark system-bar icon appearance, and optional native page fade transitions. Keeps the mandatory production splash unchanged and preserves Android 6/API 23 compatibility.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-18T09:00:23.930108Z 3a08e03 PR opened
🔒 Security Review ✅ Completed 2026-09-18T08:55:38.727404Z 3a08e03 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pschildgen87-code
pschildgen87-code merged commit c953151 into compat/android-6-api23 Sep 18, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a08e03a0e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +28 to +30
if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
WebSettingsCompat.setAlgorithmicDarkeningAllowed(settings, dark);
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make the selected mode drive the WebView color scheme

When a profile selects light on a current WebView, this branch only disables algorithmic darkening; it does not make CSS prefers-color-scheme resolve to light. Because the activity uses the fixed dark Theme.Material.NoActionBar, pages with their own dark media rules can continue rendering dark even while data-quantum-theme reports light. The selected mode needs to drive the WebView/app theme rather than treating the algorithmic-darkening permission as a mode switch.

Useful? React with 👍 / 👎.

Comment on lines +50 to +52
+ "if(mode==='auto'){"
+ "resolved=(window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches)?'dark':'light';"
+ "}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Resolve Auto from the system configuration

With WEB_DARK_MODE="auto" on a system-light device, this resolves the exposed theme from WebView's prefers-color-scheme, which follows the activity theme on the targeted modern WebViews. Since this app uses the fixed dark Theme.Material.NoActionBar, the script can publish data-quantum-theme="dark" despite the native configuration being light. Pass the native Configuration result into the injection instead, and refresh it when the handled uiMode changes.

Useful? React with 👍 / 👎.

+ (0.7152 * linearize(g))
+ (0.0722 * linearize(b));
return luminance > 0.55;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Choose system-bar icons using actual contrast

For common mid-light configured colors, this cutoff selects light icons even when they have very poor contrast. For example, #BBBBBB has linear luminance about 0.497, so this returns false and uses white icons at roughly 1.9:1 contrast, whereas black icons exceed 10:1. Compare black-versus-white contrast directly (their crossover is near luminance 0.179) so configured bars do not make the icons unreadable.

Useful? React with 👍 / 👎.

Comment on lines +174 to +176
window.setStatusBarColor(
SystemBarStyle.parseRgb(AppConfig.STATUS_BAR_COLOR, Color.BLACK)
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Draw the status-bar background on edge-to-edge Android

When the status bar is visible on Android 15 or newer, this target-SDK-36 app is subject to enforced edge-to-edge behavior, where the status bar is transparent and setStatusBarColor no longer paints the requested background. Profiles therefore lose STATUS_BAR_COLOR on the Android versions this change explicitly supports, and the icon appearance is calculated against a color that is not actually displayed. Draw the configured color behind the status-bar inset instead of relying solely on this window setter.

Useful? React with 👍 / 👎.

Comment on lines +103 to +105
introOverlay.setBackgroundColor(
SystemBarStyle.parseRgb(AppConfig.SPLASH_BACKGROUND_COLOR, Color.BLACK)
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply the splash color to the starting window

On a cold launch with a nonblack SPLASH_BACKGROUND_COLOR, Android displays the activity's starting window before onCreate() and setContentView(), and that window still uses the hardcoded black android:windowBackground from Theme.StarlightUnit. Setting the ImageView background here happens too late to prevent the black launch frame, so the configured splash color should also be emitted into the launch/window theme.

Useful? React with 👍 / 👎.

Comment on lines 19 to +20
public static void apply(WebView webView) {
webView.evaluateJavascript(themeInjectionScript(AppConfig.WEB_DARK_MODE), null);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Install the theme contract before page scripts run

WebOverrides.apply() is called only from GameWebViewClient.onPageFinished(), so this evaluation occurs after the trusted page's inline, deferred, and module initialization has already run. A page that reads data-quantum-theme once during startup sees it as absent and can permanently select its default assets or state, while CSS using the attribute also renders an initial unthemed frame. Install this script at document start with the trusted-origin restriction rather than adding the contract after load completion.

Useful? React with 👍 / 👎.

);
} else {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve dark icon flags in legacy immersive mode

On API 23–29 with immersive fullscreen enabled, this return prevents the later LIGHT_STATUS_BAR and LIGHT_NAVIGATION_BAR flags from ever being applied. Even for a pure-white configured bar, swiping to reveal the transient system bars therefore shows the platform's default light icons against the bright background. Include the applicable light-appearance bits in the immersive visibility mask before returning.

Useful? React with 👍 / 👎.

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.

1 participant