Add auto, light, and dark theme modes - #8
Merged
Conversation
A new Theme setting (auto / light / dark) drives a per-activity palette in BaseActivity: forced modes override the activity's uiMode so dialogs and the values-night theme follow along, and auto tracks the system setting. Stacked activities recreate on resume when the choice changes.
fanis
force-pushed
the
claude/auto-light-dark-mode-jtiou5
branch
from
August 9, 2026 17:54
faac516 to
4614756
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a user-selectable theme with three modes: Auto (follow system), Light, and Dark.
Changes
ThemePreferences(new): stores the choice in SharedPreferences, following the existingCurrencyPreferencespattern. Defaults to Auto and falls back to Auto on unknown stored values. Also maps each mode to theUI_MODE_NIGHT_*bits it forces.BaseActivity: the sharedCOLOR_*palette becomes per-activity fields resolved inattachBaseContext. Forced light/dark applies auiModeconfiguration override, so the activity's resources (values-nighttheme, dialogs) and the palette follow the forced choice; Auto tracks the system setting (activities already recreate on system dark-mode changes). A dark palette variant covers background, cards, borders, text, muted/hint text, secondary-button teal, and danger red. Navigation-bar color and light-system-bar flags switch per mode, and stacked activities recreate inonResumeif the theme changed while they were in the background.values-night/styles.xml(new): darkTheme.Material.NoActionBarvariant so AlertDialogs and window chrome go dark too.SettingsActivity: new "Theme" button (below the currency picker) opening a single-choice dialog, styled like the existing currency dialog. Selecting a different mode recreates the screen immediately.Testing
ThemePreferencesRobolectricTestcovering the default, persistence, invalid-value fallback, night-bit mapping, and labels.gradle testDebugUnitTest).