[PR #1556] [MERGED] Dynamic theme switching and visual tweaks #2961

Closed
opened 2025-11-26 23:26:28 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1556
Author: @mpbw2
Created: 10/3/2021
Status: Merged
Merged: 10/8/2021
Merged by: @mpbw2

Base: masterHead: feature-dynamic-themes


📝 Commits (6)

  • ade6999 Dynamic theme switching and visual tweaks
  • f9b4a2c update action runner to use macos-11 for iOS 15 support
  • 1a63583 additional tweaks
  • 4789d71 refinements
  • bd04a4c refinements
  • f3dfc77 formatting and tweaks

📊 Changes

69 files changed (+2305 additions, -3545 deletions)

View changed files

📝 .github/workflows/build.yml (+1 -1)
📝 src/Android/Accessibility/AccessibilityActivity.cs (+1 -1)
📝 src/Android/Android.csproj (+10 -8)
📝 src/Android/Effects/FabShadowEffect.cs (+2 -2)
📝 src/Android/MainActivity.cs (+7 -42)
📝 src/Android/Renderers/CustomEditorRenderer.cs (+33 -1)
📝 src/Android/Renderers/CustomEntryRenderer.cs (+25 -0)
📝 src/Android/Renderers/CustomPickerRenderer.cs (+33 -1)
src/Android/Renderers/CustomSwitchRenderer.cs (+59 -0)
📝 src/Android/Renderers/ExtendedGridRenderer.cs (+1 -21)
📝 src/Android/Renderers/ExtendedSliderRenderer.cs (+17 -1)
📝 src/Android/Renderers/ExtendedStackLayoutRenderer.cs (+1 -21)
src/Android/Renderers/ExtendedStepperRenderer.cs (+72 -0)
📝 src/Android/Resources/drawable-v23/splash_screen.xml (+1 -1)
📝 src/Android/Resources/drawable/list_item_bg.xml (+1 -1)
src/Android/Resources/drawable/list_item_bg_dark.xml (+0 -7)
src/Android/Resources/drawable/list_item_bg_nord.xml (+0 -7)
📝 src/Android/Resources/drawable/splash_screen.xml (+1 -1)
src/Android/Resources/drawable/switch_thumb.xml (+5 -0)
📝 src/Android/Resources/values-night/styles.xml (+19 -1)

...and 49 more files

📄 Description

User-Facing Goodies

  • Dynamic Theme Switching (no app restart necessary)
  • Button style/colors more in sync with web vault and between Android & iOS (screenshots below)
  • Support for ProMotion refresh rates on supported iOS devices (untested)

Dev-Facing Comfort Food

  • Removed multiple copies of theme colors (theme xmls within the XF App drive all colorization)
  • Cleaned up styling/organization

The-Meat

  • AccessibilityActivity.cs: Changed to new BaseTheme in Android styles
  • AddEditPage.xaml: Updated color ref to DynamicResource
  • Android/iOS.xaml: Updated color refs to DynamicResource and added/modified styles
  • App.xaml.cs: Added theme updater on resume and while running (system auto or manual toggle)
  • AppDelegate.cs: Added theme update listener for iOS-specific visual tweaks. Also changed the order of operations in DidEnterBackground so we save the LastActiveTime before attempting visual adjustments which crash on iOS 15.0 (seems to be fixed in 15.0.1 but I'm leaving this change)
  • AppResources.resx: Removed references to restarting the app and added a new Default theme string to better indicate its function
  • AutofillServicesPage.xaml/ViewModel.cs: Adjusted approach to switch overlay to work around drawing bug when control is disabled
  • Base.xaml: Updated color refs to DynamicResource, tweaked FAB button, added segmented button style for the create Send screen, and dedicated overlay style for invisible buttons over top other elements
  • BaseContentPage.cs: Apply theme to ActivityIndicator
  • Light/Dark/Black/Nord.xaml: Added/adjusted colors
  • CredentialProviderViewController.cs: Update visuals for theme during init
  • CustomEntry/Editor/Picker/Switch/Slider/StepperRenderer.cs: Handle theme changes for Android focused/toggled modes
  • CustomTabbedRenderer.cs: Added theme update listener to force refresh of iOS TabBar, and added required ScrollEdgeAppearance adjustment for iOS 15+
  • DeviceActionService.cs (Android): Changed method of accessibility service detection due to restrictions on general service detection from ActivityManager and apply themes to AlertDialog
  • DeviceActionService.cs (Android and iOS): Removed custom dark mode detection since Forms does this now
  • ExtendedGrid/StackLayoutRenderer.cs: Removed themed resources since they can't be replaced on the fly, and replaced with common color
  • GeneratorPage.xaml: Added primary button style to "Regenerate" button
  • GeneratorPage.xaml/ViewModel.cs: Aadded theme update listener to redraw password with updated colors
  • HomePage.xaml.cs: Added theme update listener to swap dark/light logo when needed
  • Info.plist: Added ProMotion support key
  • Lock/Login/LoginSsoPage.xaml: Added primary button styling
  • MainActivity.cs: Handle ConfigChanges.UiMode to prevent app teardown when switching system dark/light mode, and tweak visuals upon theme switching
  • OptionsPage.xaml/ViewModel.cs: Remove restart wording and trigger immediate theme change upon selection
  • SendGroupingsPage.xaml/ViewModel.cs: Fixed race condition on fresh install that caused NPE
  • SendAddEditPage.xaml: Remove custom segmented button styling and update color refs to DynamicResource
  • styles.xml: Disable forced uppercase in Android buttons to match iOS
  • TabsPage.cs: Force a theme refresh upon tab switching to cover for some not-quite-there-yet drawing issues (plan to remove this in the future)
  • ThemeHelpers.cs: Cleanup and removal of duplicate color constants
  • ThemeManager.cs: Implemented dark mode detection the XF way

01

01a

02

02a

03

03a


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/1556 **Author:** [@mpbw2](https://github.com/mpbw2) **Created:** 10/3/2021 **Status:** ✅ Merged **Merged:** 10/8/2021 **Merged by:** [@mpbw2](https://github.com/mpbw2) **Base:** `master` ← **Head:** `feature-dynamic-themes` --- ### 📝 Commits (6) - [`ade6999`](https://github.com/bitwarden/android/commit/ade6999aeb4c7b05b31a0f47ee68cdef9e9e3e4e) Dynamic theme switching and visual tweaks - [`f9b4a2c`](https://github.com/bitwarden/android/commit/f9b4a2c22223071df4754a8dff29d9d6eb5534f8) update action runner to use macos-11 for iOS 15 support - [`1a63583`](https://github.com/bitwarden/android/commit/1a635833eef057063f06d31cf84b60553b7016e3) additional tweaks - [`4789d71`](https://github.com/bitwarden/android/commit/4789d7160678504cabce0d47c0cc614cd487da64) refinements - [`bd04a4c`](https://github.com/bitwarden/android/commit/bd04a4c358dffe193f6156afca0a030fda4d3cdc) refinements - [`f3dfc77`](https://github.com/bitwarden/android/commit/f3dfc7747a8f4fd75cfaf484de222b022e58f592) formatting and tweaks ### 📊 Changes **69 files changed** (+2305 additions, -3545 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/build.yml` (+1 -1) 📝 `src/Android/Accessibility/AccessibilityActivity.cs` (+1 -1) 📝 `src/Android/Android.csproj` (+10 -8) 📝 `src/Android/Effects/FabShadowEffect.cs` (+2 -2) 📝 `src/Android/MainActivity.cs` (+7 -42) 📝 `src/Android/Renderers/CustomEditorRenderer.cs` (+33 -1) 📝 `src/Android/Renderers/CustomEntryRenderer.cs` (+25 -0) 📝 `src/Android/Renderers/CustomPickerRenderer.cs` (+33 -1) ➕ `src/Android/Renderers/CustomSwitchRenderer.cs` (+59 -0) 📝 `src/Android/Renderers/ExtendedGridRenderer.cs` (+1 -21) 📝 `src/Android/Renderers/ExtendedSliderRenderer.cs` (+17 -1) 📝 `src/Android/Renderers/ExtendedStackLayoutRenderer.cs` (+1 -21) ➕ `src/Android/Renderers/ExtendedStepperRenderer.cs` (+72 -0) 📝 `src/Android/Resources/drawable-v23/splash_screen.xml` (+1 -1) 📝 `src/Android/Resources/drawable/list_item_bg.xml` (+1 -1) ➖ `src/Android/Resources/drawable/list_item_bg_dark.xml` (+0 -7) ➖ `src/Android/Resources/drawable/list_item_bg_nord.xml` (+0 -7) 📝 `src/Android/Resources/drawable/splash_screen.xml` (+1 -1) ➕ `src/Android/Resources/drawable/switch_thumb.xml` (+5 -0) 📝 `src/Android/Resources/values-night/styles.xml` (+19 -1) _...and 49 more files_ </details> ### 📄 Description **User-Facing Goodies** - Dynamic Theme Switching (no app restart necessary) - Button style/colors more in sync with web vault and between Android & iOS (screenshots below) - Support for ProMotion refresh rates on supported iOS devices (untested) **Dev-Facing Comfort Food** - Removed multiple copies of theme colors (theme xmls within the XF App drive all colorization) - Cleaned up styling/organization **The-Meat** - `AccessibilityActivity.cs`: Changed to new `BaseTheme` in Android styles - `AddEditPage.xaml`: Updated color ref to `DynamicResource` - `Android/iOS.xaml`: Updated color refs to `DynamicResource` and added/modified styles - `App.xaml.cs`: Added theme updater on resume and while running (system auto or manual toggle) - `AppDelegate.cs`: Added theme update listener for iOS-specific visual tweaks. Also changed the order of operations in `DidEnterBackground` so we save the `LastActiveTime` before attempting visual adjustments which crash on iOS 15.0 (seems to be fixed in 15.0.1 but I'm leaving this change) - `AppResources.resx`: Removed references to restarting the app and added a new Default theme string to better indicate its function - `AutofillServicesPage.xaml/ViewModel.cs`: Adjusted approach to switch overlay to work around drawing bug when control is disabled - `Base.xaml`: Updated color refs to `DynamicResource`, tweaked FAB button, added segmented button style for the create Send screen, and dedicated overlay style for invisible buttons over top other elements - `BaseContentPage.cs`: Apply theme to `ActivityIndicator` - `Light/Dark/Black/Nord.xaml`: Added/adjusted colors - `CredentialProviderViewController.cs`: Update visuals for theme during init - `CustomEntry/Editor/Picker/Switch/Slider/StepperRenderer.cs`: Handle theme changes for Android focused/toggled modes - `CustomTabbedRenderer.cs`: Added theme update listener to force refresh of iOS TabBar, and added required `ScrollEdgeAppearance` adjustment for iOS 15+ - `DeviceActionService.cs (Android)`: Changed method of accessibility service detection due to restrictions on general service detection from `ActivityManager` and apply themes to `AlertDialog` - `DeviceActionService.cs (Android and iOS)`: Removed custom dark mode detection since Forms does this now - `ExtendedGrid/StackLayoutRenderer.cs`: Removed themed resources since they can't be replaced on the fly, and replaced with common color - `GeneratorPage.xaml`: Added primary button style to "Regenerate" button - `GeneratorPage.xaml/ViewModel.cs`: Aadded theme update listener to redraw password with updated colors - `HomePage.xaml.cs`: Added theme update listener to swap dark/light logo when needed - `Info.plist`: Added ProMotion support key - `Lock/Login/LoginSsoPage.xaml`: Added primary button styling - `MainActivity.cs`: Handle `ConfigChanges.UiMode` to prevent app teardown when switching system dark/light mode, and tweak visuals upon theme switching - `OptionsPage.xaml/ViewModel.cs`: Remove restart wording and trigger immediate theme change upon selection - `SendGroupingsPage.xaml/ViewModel.cs`: Fixed race condition on fresh install that caused NPE - `SendAddEditPage.xaml`: Remove custom segmented button styling and update color refs to `DynamicResource` - `styles.xml`: Disable forced uppercase in Android buttons to match iOS - `TabsPage.cs`: Force a theme refresh upon tab switching to cover for some not-quite-there-yet drawing issues (plan to remove this in the future) - `ThemeHelpers.cs`: Cleanup and removal of duplicate color constants - `ThemeManager.cs`: Implemented dark mode detection the XF way ![01](https://user-images.githubusercontent.com/59324545/136435021-000ee52c-8337-47af-8534-a499862bba18.png) ![01a](https://user-images.githubusercontent.com/59324545/136435058-9eac52ec-ddb3-44b4-b2e1-1fcbd725aaaa.png) ![02](https://user-images.githubusercontent.com/59324545/136435079-fd5cc213-a169-447f-83d6-34b672d116d1.png) ![02a](https://user-images.githubusercontent.com/59324545/136435090-92001ac8-0a54-4157-bf4a-ffadfb9afa18.png) ![03](https://user-images.githubusercontent.com/59324545/136435109-98d012fe-9320-4c21-841a-fa0fdd6e04ab.png) ![03a](https://user-images.githubusercontent.com/59324545/136435127-c7f46ad2-5b55-4cf7-af2b-6ca1e933acd0.png) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-26 23:26:28 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#2961