feat: add dark mode support - #222
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new Appearance preference handling has a correctness issue for missing/invalid persisted values, and there are dark-mode theming gaps (e.g., selection and dialogs) that should be addressed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces app-wide dark mode support by switching to a DayNight base theme and migrating many UI surfaces/text to theme-resolved semantic colors, plus adds a user-facing appearance mode setting.
Changes:
- Switch
Theme.openCloudtoTheme.AppCompat.DayNight.*and introduce semantic color tokens withvalues-nightoverrides. - Replace hardcoded light colors in many layouts/drawables with
?attr/*/?android:attr/*theme attributes. - Add an “Appearance” setting backed by an
AppearanceModeenum and apply it at app startup viaAppCompatDelegate.
File summaries
| File | Description |
|---|---|
| opencloudApp/src/test/java/eu/opencloud/android/presentation/settings/AppearanceModeTest.kt | Adds unit tests for preference-to-night-mode mapping. |
| opencloudApp/src/main/res/xml/settings.xml | Adds the Appearance ListPreference to settings screen. |
| opencloudApp/src/main/res/values/styles.xml | Switches base theme to DayNight; adds semantic theme color items. |
| opencloudApp/src/main/res/values/strings.xml | Adds Appearance preference strings. |
| opencloudApp/src/main/res/values/colors.xml | Adds DayNight semantic color tokens (light defaults). |
| opencloudApp/src/main/res/values-night/colors.xml | Adds DayNight semantic color tokens (dark overrides). |
| opencloudApp/src/main/res/layout/whats_new_element.xml | Updates text colors to theme-aware colorOnPrimary. |
| opencloudApp/src/main/res/layout/whats_new_activity.xml | Updates skip button text color to theme-aware colorOnPrimary. |
| opencloudApp/src/main/res/layout/uploader_list_item_layout.xml | Migrates uploader list text colors to colorOnSurface*. |
| opencloudApp/src/main/res/layout/uploader_layout.xml | Migrates list divider color to theme colorOutline. |
| opencloudApp/src/main/res/layout/upload_list_item.xml | Migrates upload list text colors to colorOnSurface*. |
| opencloudApp/src/main/res/layout/upload_bottom_sheet_fragment.xml | Migrates bottom sheet background/divider/title colors to theme. |
| opencloudApp/src/main/res/layout/ssl_validator_layout.xml | Migrates SSL validator text color to colorOnSurface. |
| opencloudApp/src/main/res/layout/ssl_untrusted_cert_layout.xml | Migrates SSL untrusted cert header color to colorOnSurface. |
| opencloudApp/src/main/res/layout/spaces_list_item.xml | Migrates card background and text colors to surface/on-surface. |
| opencloudApp/src/main/res/layout/space_path_line.xml | Migrates icon/text tint to colorOnSurfaceVariant. |
| opencloudApp/src/main/res/layout/space_header.xml | Migrates header backgrounds and text colors to surface/on-surface. |
| opencloudApp/src/main/res/layout/sort_options_layout.xml | Migrates bottom sheet header text/icon tint to colorOnPrimary. |
| opencloudApp/src/main/res/layout/sort_bottom_sheet_fragment.xml | Migrates bottom sheet background/divider/title colors to theme. |
| opencloudApp/src/main/res/layout/share_user_item.xml | Migrates share user item text color to colorOnSurface. |
| opencloudApp/src/main/res/layout/share_public_link_item.xml | Migrates public link item title color to colorOnSurface. |
| opencloudApp/src/main/res/layout/share_public_dialog.xml | Migrates dialog label/secondary text colors to theme-aware attrs. |
| opencloudApp/src/main/res/layout/share_file_layout.xml | Migrates share file sheet colors to on-surface/on-primary. |
| opencloudApp/src/main/res/layout/remove_files_dialog.xml | Migrates dialog card/text colors to surface/on-surface. |
| opencloudApp/src/main/res/layout/rate_me_dialog.xml | Migrates button text to colorOnPrimary. |
| opencloudApp/src/main/res/layout/passcodelock.xml | Migrates passcode lock backgrounds/text to theme attributes. |
| opencloudApp/src/main/res/layout/opencloud_toolbar.xml | Migrates toolbar text/drawable tint to colorOnPrimary. |
| opencloudApp/src/main/res/layout/newfile_bottom_sheet_fragment.xml | Migrates bottom sheet background/divider/title colors to theme. |
| opencloudApp/src/main/res/layout/nav_main_container.xml | Migrates main container background to platform background attr. |
| opencloudApp/src/main/res/layout/nav_drawer_header.xml | Migrates drawer header text color to colorOnPrimary. |
| opencloudApp/src/main/res/layout/nav_drawer_footer.xml | Migrates drawer footer text colors to on-surface variants. |
| opencloudApp/src/main/res/layout/nav_drawer_content.xml | Sets drawer backgrounds to theme colorSurface. |
| opencloudApp/src/main/res/layout/nav_coordinator_layout.xml | Migrates bottom nav icon/text tint to colorOnPrimary. |
| opencloudApp/src/main/res/layout/manage_accounts_dialog.xml | Migrates dialog card/text/icon tint to theme attributes. |
| opencloudApp/src/main/res/layout/main_file_list_fragment.xml | Migrates FAB label/icon colors to colorOnPrimary. |
| opencloudApp/src/main/res/layout/log_list_item.xml | Migrates log list text colors to on-surface variants. |
| opencloudApp/src/main/res/layout/list_footer.xml | Migrates footer text color to colorOnSurfaceVariant. |
| opencloudApp/src/main/res/layout/item_file_list.xml | Adds surface background + migrates text/tints to on-surface variants. |
| opencloudApp/src/main/res/layout/item_empty_dataset.xml | Migrates empty state tint/text colors to theme attributes. |
| opencloudApp/src/main/res/layout/grid_item.xml | Migrates grid item text color to colorOnSurface. |
| opencloudApp/src/main/res/layout/fragment_migration_progress.xml | Migrates wizard background/text/progress tint to primary/on-primary. |
| opencloudApp/src/main/res/layout/fragment_migration_intro.xml | Migrates wizard background/text/button tint to primary/on-primary. |
| opencloudApp/src/main/res/layout/fragment_migration_completed.xml | Migrates wizard background/text/button tint to primary/on-primary. |
| opencloudApp/src/main/res/layout/fragment_migration_choice.xml | Migrates wizard background/text/button tint to primary/on-primary. |
| opencloudApp/src/main/res/layout/file_options_bottom_sheet_fragment.xml | Migrates bottom sheet background/text/divider to theme attrs. |
| opencloudApp/src/main/res/layout/file_details_fragment.xml | Migrates card/background/dividers to surface/outline theme attrs. |
| opencloudApp/src/main/res/layout/file_details_empty.xml | Migrates empty background to platform background attr. |
| opencloudApp/src/main/res/layout/edit_share_layout.xml | Migrates secondary text color to colorOnSurfaceVariant. |
| opencloudApp/src/main/res/layout/dialog_file_already_exists.xml | Migrates dialog card/text colors to surface/on-surface. |
| opencloudApp/src/main/res/layout/create_shortcut_dialog.xml | Migrates labels/disabled button text to on-surface variants. |
| opencloudApp/src/main/res/layout/activity_pattern_lock.xml | Migrates background/text colors to theme attributes. |
| opencloudApp/src/main/res/layout/account_item.xml | Migrates account item text/icon tints to on-surface variants. |
| opencloudApp/src/main/res/layout/account_action.xml | Migrates account action icon/text to on-surface colors. |
| opencloudApp/src/main/res/drawable/top_progress_bar_determinate.xml | Makes progress bar background use theme colorSurface. |
| opencloudApp/src/main/java/eu/opencloud/android/presentation/settings/SettingsFragment.kt | Wires up Appearance preference and applies night mode on change. |
| opencloudApp/src/main/java/eu/opencloud/android/presentation/settings/AppearanceMode.kt | Introduces AppearanceMode enum + preference mapping helper. |
| opencloudApp/src/main/java/eu/opencloud/android/presentation/files/filelist/FileListAdapter.kt | Replaces hardcoded white with theme colorSurface for file list items. |
| opencloudApp/src/main/java/eu/opencloud/android/MainApp.kt | Applies persisted appearance mode at application startup. |
| opencloudApp/src/androidTest/java/eu/opencloud/android/settings/SettingsFragmentTest.kt | Extends UI test to validate Appearance preference configuration. |
Review details
- Files reviewed: 59/59 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
thanks for the sanity check with co-pilot. I've updated the issues it called out, should be ready for re-review |
Summary
Adds dark mode support by replacing hardcoded white backgrounds with theme-aware
DayNightattributes across the app.Closes #23
Changes
styles.xml) to use platform semantic background attributes linked totheme_color_background.FileListAdapteranditem_file_list.xmlto use?attr/colorSurfaceinstead of hardcoded white backgrounds.?android:attr/colorBackground.Testing
./gradlew :opencloudApp:assembleOriginalDebug.