Repository navigation
Runtime theme controls and page transitions - #22
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
| if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) { | ||
| WebSettingsCompat.setAlgorithmicDarkeningAllowed(settings, dark); | ||
| return; |
There was a problem hiding this comment.
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 👍 / 👎.
| + "if(mode==='auto'){" | ||
| + "resolved=(window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches)?'dark':'light';" | ||
| + "}" |
There was a problem hiding this comment.
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; | ||
| } |
There was a problem hiding this comment.
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 👍 / 👎.
| window.setStatusBarColor( | ||
| SystemBarStyle.parseRgb(AppConfig.STATUS_BAR_COLOR, Color.BLACK) | ||
| ); |
There was a problem hiding this comment.
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 👍 / 👎.
| introOverlay.setBackgroundColor( | ||
| SystemBarStyle.parseRgb(AppConfig.SPLASH_BACKGROUND_COLOR, Color.BLACK) | ||
| ); |
There was a problem hiding this comment.
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 👍 / 👎.
| public static void apply(WebView webView) { | ||
| webView.evaluateJavascript(themeInjectionScript(AppConfig.WEB_DARK_MODE), null); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 👍 / 👎.
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.