Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic theme switching and visual tweaks #1556

Merged
merged 6 commits into from
Oct 8, 2021
Merged

Conversation

mpbw2
Copy link
Contributor

@mpbw2 mpbw2 commented Oct 3, 2021

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

@mpbw2
Copy link
Contributor Author

mpbw2 commented Oct 3, 2021

iOS build failed with: 'UITabBar' does not contain a definition for 'ScrollEdgeAppearance' and no accessible extension method 'ScrollEdgeAppearance' accepting a first argument of type 'UITabBar' could be found (which is an iOS 15 thing). Not sure if something needs to be updated in the project or on GitHub. I'll revisit on Monday.

@djsmith85 djsmith85 linked an issue Oct 3, 2021 that may be closed by this pull request
1 task
@mpbw2
Copy link
Contributor Author

mpbw2 commented Oct 4, 2021

Looks like the macos-11 runner doesn't have Xamarin.iOS 15 yet. I'll try again once this is closed.

@mpbw2 mpbw2 marked this pull request as draft October 7, 2021 15:12
@mpbw2 mpbw2 marked this pull request as ready for review October 7, 2021 17:46
@mpbw2 mpbw2 requested review from cscharf, kspearrin and jlf0dev October 7, 2021 17:46
Copy link

@cscharf cscharf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great Matt, just a few comments/questions.

src/Android/Renderers/CustomEditorRenderer.cs Outdated Show resolved Hide resolved
src/Android/Renderers/CustomSwitchRenderer.cs Outdated Show resolved Hide resolved
src/Android/Renderers/ExtendedSliderRenderer.cs Outdated Show resolved Hide resolved
src/App/Pages/BaseContentPage.cs Show resolved Hide resolved
src/App/Controls/ExtendedStepper.cs Show resolved Hide resolved
src/Android/Renderers/CustomEditorRenderer.cs Show resolved Hide resolved
src/App/Pages/TabsPage.cs Show resolved Hide resolved
@mpbw2 mpbw2 requested a review from cscharf October 8, 2021 00:32
@mpbw2 mpbw2 merged commit 4aad34c into master Oct 8, 2021
@mpbw2 mpbw2 deleted the feature-dynamic-themes branch October 8, 2021 12:47
@mpbw2 mpbw2 linked an issue Oct 22, 2021 that may be closed by this pull request
@jlf0dev jlf0dev mentioned this pull request Nov 5, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants