Conversation
Co-authored-by: ricky9667 <55730003+ricky9667@users.noreply.github.com>
|
@copilot Also apply the theme seed color to the HushKeyboardTheme in HushKeyboardView. |
Co-authored-by: ricky9667 <55730003+ricky9667@users.noreply.github.com>
Done in ae98f06. Added |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #63 +/- ##
==========================================
+ Coverage 53.66% 54.70% +1.03%
==========================================
Files 39 39
Lines 1090 1148 +58
Branches 79 82 +3
==========================================
+ Hits 585 628 +43
- Misses 474 489 +15
Partials 31 31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| enum class KeyboardColorOption { | ||
| NeutralGray, | ||
| OceanBlue, | ||
| CoralRed, | ||
| ForestGreen, | ||
| DeepPurple, | ||
| AmberOrange, | ||
| TealBlue, | ||
| SlateGray, | ||
| ; | ||
|
|
||
| val color: Color | ||
| get() = | ||
| when (this) { | ||
| NeutralGray -> Color(0xFF6B6B6B) | ||
| OceanBlue -> Color(0xFF0077BE) | ||
| CoralRed -> Color(0xFFE53935) | ||
| ForestGreen -> Color(0xFF2E7D32) | ||
| DeepPurple -> Color(0xFF512DA8) | ||
| AmberOrange -> Color(0xFFFF8F00) | ||
| TealBlue -> Color(0xFF00695C) | ||
| SlateGray -> Color(0xFF455A64) | ||
| } | ||
|
|
||
| override fun toString() = | ||
| when (this) { | ||
| NeutralGray -> "Neutral Gray" | ||
| OceanBlue -> "Ocean Blue" | ||
| CoralRed -> "Coral Red" | ||
| ForestGreen -> "Forest Green" | ||
| DeepPurple -> "Deep Purple" | ||
| AmberOrange -> "Amber Orange" | ||
| TealBlue -> "Teal Blue" | ||
| SlateGray -> "Slate Gray" | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
@copilot I think we can move the color and text to the enum class member instead of using a getter function.
There was a problem hiding this comment.
Done in 51f2a47. color and displayName are now constructor parameters on each enum entry, and toString() delegates to displayName.
Co-authored-by: ricky9667 <55730003+ricky9667@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new Keyboard Color setting that lets users choose a seed color for the app’s dynamic Material theme, and applies the same seed color to the IME keyboard theme for visual consistency.
Changes:
- Introduces
KeyboardColorOptionand persists it viaAppSettings/SettingsRepository, exposing updates throughSettingsViewModelandKeyboardViewModel. - Extends
DropdownListItemwith optional custom option rendering to show a color swatch + label in the dropdown. - Updates theming to accept a configurable
seedColorand wires it throughMainAppandHushKeyboardView.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/test/java/com/rickyhu/hushkeyboard/ui/SettingsScreenUiTest.kt | Adds UI tests to cover presence and behavior of the new Keyboard Color dropdown. |
| app/src/main/res/values/strings.xml | Adds keyboard_color string resource. |
| app/src/main/res/drawable/ic_palette.xml | Adds palette icon for the new setting. |
| app/src/main/java/com/rickyhu/hushkeyboard/theme/Theme.kt | Adds seedColor parameter and exposes a default seed color constant. |
| app/src/main/java/com/rickyhu/hushkeyboard/settings/ui/DropdownListItem.kt | Adds optional optionContent slot for custom option rendering. |
| app/src/main/java/com/rickyhu/hushkeyboard/settings/SettingsViewModel.kt | Adds state + update method for keyboardColorOption. |
| app/src/main/java/com/rickyhu/hushkeyboard/settings/SettingsScreen.kt | Adds the new Keyboard Color dropdown UI with color preview. |
| app/src/main/java/com/rickyhu/hushkeyboard/main/MainApp.kt | Applies selected seed color to app theme. |
| app/src/main/java/com/rickyhu/hushkeyboard/keyboard/KeyboardViewModel.kt | Includes keyboardColorOption in KeyboardState. |
| app/src/main/java/com/rickyhu/hushkeyboard/keyboard/HushKeyboardView.kt | Applies selected seed color to IME theme. |
| app/src/main/java/com/rickyhu/hushkeyboard/data/SettingsRepository.kt | Persists keyboardColorOption changes in DataStore. |
| app/src/main/java/com/rickyhu/hushkeyboard/data/AppSettings.kt | Adds keyboardColorOption to settings and defines KeyboardColorOption. |
Comments suppressed due to low confidence (1)
app/src/main/java/com/rickyhu/hushkeyboard/data/AppSettings.kt:40
KeyboardColorOption.NeutralGrayis defined asColor(0xFF6B6B6B), but bothMainAppandHushKeyboardViewspecial-caseNeutralGrayto useDefaultSeedColor(0xFF5B7C99). This makes the settings preview circle (which usesoption.color) disagree with the actual theme seed color when NeutralGray is selected. Align the enum’scolor(and/or its display name) with the default seed color, or remove the special-casing and always usekeyboardColorOption.colorso the selected option matches what’s applied.
SlateGray(Color(0xFF455A64), "Slate Gray"),
;
override fun toString() = displayName
}
enum class WideNotationOption {
WideWithW,
WideWithLowercase,
;
override fun toString() =
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| val seedColor = | ||
| when (state.keyboardColorOption) { | ||
| KeyboardColorOption.NeutralGray -> DefaultSeedColor | ||
| else -> state.keyboardColorOption.color | ||
| } |
There was a problem hiding this comment.
seedColor is being special-cased for KeyboardColorOption.NeutralGray to DefaultSeedColor, while other options use keyboardColorOption.color. This creates inconsistent behavior relative to the option’s own color value (and the UI preview) and also requires duplicating this mapping elsewhere (IME). Consider making the enum’s default option color match the default seed color, then simply pass state.keyboardColorOption.color here without a when.
| val seedColor = | ||
| when (state.keyboardColorOption) { | ||
| KeyboardColorOption.NeutralGray -> DefaultSeedColor | ||
| else -> state.keyboardColorOption.color | ||
| } |
There was a problem hiding this comment.
The seedColor mapping logic (including the NeutralGray -> DefaultSeedColor special case) is duplicated here and in MainApp. This duplication makes it easy for the app theme and IME theme to drift over time. Once the enum/default color mismatch is resolved, prefer deriving the seed color from a single shared helper (e.g., an extension/property) and reusing it in both places.
| val seedColor = | |
| when (state.keyboardColorOption) { | |
| KeyboardColorOption.NeutralGray -> DefaultSeedColor | |
| else -> state.keyboardColorOption.color | |
| } | |
| val seedColor = state.keyboardColorOption.seedColor |
Description
Adds a Keyboard Color setting that lets users pick a seed color for the app's dynamic Material theme, mirroring the
ColorSettingsDropdownTilepattern from HushTimer.Data layer
KeyboardColorOptionenum inAppSettings.kt— 8 predefined colors (Neutral Gray, Ocean Blue, Coral Red, Forest Green, Deep Purple, Amber Orange, Teal Blue, Slate Gray), each withcolor: ColoranddisplayName: Stringas constructor parameterskeyboardColorOptionfield added toAppSettings(default:NeutralGray)updateKeyboardColorOption()added toSettingsRepositoryandSettingsViewModelUI layer
DropdownListItemgains an optionaloptionContent: (@Composable (T) -> Unit)?param — when provided, replaces the default text display with custom content (color circle + label). Fully backwards-compatibleSettingsScreenshows the new dropdown with a colored circle preview per optionHushKeyboardThemenow accepts aseedColorparameter (defaults to existing neutral blue-gray)MainAppreadskeyboardColorOptionfrom settings state and passes its color asseedColorto the themeHushKeyboardViewalso readskeyboardColorOptionfromKeyboardStateand passes its color asseedColortoHushKeyboardTheme, so the IME keyboard matches the selected colorKeyboard ViewModel
keyboardColorOptionadded toKeyboardStateinKeyboardViewModeland mapped fromAppSettingsHow to verify
Screenshots / Videos
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.