Skip to content

Conversation

@phoneuooyd
Copy link
Owner

This pull request introduces significant improvements to theming, localization, and font customization in the Foodbook app. The changes add dynamic theme and font resource support, enhance localization for theme and language selection, and refactor several converters to use dynamic resources, improving maintainability and user experience.

Theming and Font Customization Enhancements:

  • Added dynamic font resources (AppFontFamily, AppFontSize, etc.) to App.xaml for runtime font customization, and ensured these are set by a new FontService.
  • Updated App.xaml.cs to initialize and apply saved theme, color theme, and font settings at startup using IThemeService and IFontService. Added robust error handling for initialization.
  • Implemented new methods in App.xaml.cs to load saved theme, color theme, and font settings from preferences with fallbacks and debug logging.
  • Enhanced AppShell.xaml to use dynamic theme resources for background and text colors, improving visual consistency across themes.
  • In AppShell.xaml.cs, added logic to update system bars (status/navigation bar colors) on startup and when the shell appears, ensuring UI matches the selected theme.

Localization Improvements:

  • Added AppThemeToLocalizedStringConverter, AppColorThemeToLocalizedStringConverter, and CultureCodeToLocalizedNameConverter to provide localized display names for theme, color theme, and language selections in the UI. [1] [2] [3]

Refactoring and Converter Improvements:

  • Refactored BoolToColorConverter and related converters to use dynamic color resources from the application’s resource dictionary, supporting theming and improving code maintainability. Simplified and modernized converter logic for better readability and consistency.

Introduced UnitToLocalizedStringConverter and resource files for unit localization in both English and Polish. Updated HomeViewModel to use localized unit abbreviations and improved the recipe details dialog to include both ingredients and preparation steps. Modified ShoppingListDetailPage to display localized unit names in pickers and labels. Added a new menu_book.png image resource.
Introduced theme selection support with AppTheme enum, ThemeService, and related interfaces. Updated SettingsViewModel and SettingsPage to allow users to choose between system, light, and dark themes, persisting the preference. Added converters for theme and culture localization, expanded resource files with localized theme and language names, and improved SettingsPage layout and localization for database operations.
Introduces user-selectable font family and font size options throughout the application. Adds FontService and related models, updates PreferencesService for font persistence, and extends SettingsViewModel and SettingsPage to allow users to change font settings. Updates styles and localization resources to support dynamic font changes.
Introduces support for multiple color themes, including new models (AppColorTheme, ThemeColors), converters, and service methods for theme management. Updates settings UI to allow users to select a color theme, persists the preference, and dynamically applies the selected palette throughout the app. Localization resources and styles are updated to support the new feature.
Replaced static and AppThemeBinding color references with DynamicResource bindings for primary and secondary theme colors across XAML views and styles. Updated BoolToColorConverter to support dynamic theme color resolution and added new segment button color logic. Adjusted Android color resources to neutral defaults for runtime theming. This enables runtime theme changes and improves consistency across light and dark modes.
Refactored ThemeService to use dynamic resources for button and tab bar colors, ensuring better contrast and accessibility. Updated styles and XAML pages to use theme-aware background colors. Simplified ThemeService API and improved color contrast logic for buttons and tab bars. Fixed RecipesPage to avoid continuous pull-to-refresh state.
Introduces a range of new custom font families and weights to the app, updating the AppFontFamily enum, MauiProgram font registrations, and FontSettings mappings accordingly. Converters and styles are updated to use dynamic resources for font family and size, enabling user customization and consistent font usage across controls.
Introduces an IEventBus service for decoupled ViewModel communication, enabling ViewModels to publish and react to data change events (e.g., recipe or plan updates). Updates constructors and logic in AddRecipeViewModel, HomeViewModel, PlannerViewModel, RecipeViewModel, and ShoppingListViewModel to use the event bus. Adds cleanup logic to HomeViewModel and HomePage to prevent memory leaks. Also adds and configures Android theme and color resources for Material Design 3, including light and dark themes, and updates the AndroidManifest to use the new theme.
Replaces IEventBus-based ViewModel communication with a static AppEvents class for plan change notifications. Refactors ViewModels to remove IEventBus dependencies and update event handling accordingly. Improves ThemeService with enhanced color contrast logic for better accessibility, especially for TabBar and button text. Updates color resources and AppShell to use new dynamic TabBar color keys.
Refactored theme color logic to use dynamic resources for Shell background and title colors. Enhanced ThemeService to ensure better contrast and readability for TabBar and Shell title colors, especially in light and monochrome themes. Updated Colors.xaml to define new Shell color resources.
Introduces UpdateSystemBars to IThemeService and implements platform-specific system bar (status/navigation) color updates in ThemeService for Android. AppShell now calls this method on startup and when appearing to ensure system bars reflect the current theme. Minor code cleanups and comments were also added.
@phoneuooyd phoneuooyd merged commit 5c16f26 into main Sep 3, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant