From b46b150f6abfcb3898a7783ab4ab2a7ea6b2b4b0 Mon Sep 17 00:00:00 2001 From: Tsanie Date: Thu, 17 Mar 2022 13:19:45 +0800 Subject: [PATCH] tiny fix --- Billing.Shared/Themes/BaseTheme.cs | 17 ++++++++--------- Billing.Shared/UI/BillingDate.xaml.cs | 6 +++--- Billing.Shared/UI/Converters.cs | 2 +- Billing.Shared/UI/Definition.cs | 6 ------ Billing.Shared/Views/BillPage.xaml | 9 ++------- Billing.Shared/Views/BillPage.xaml.cs | 10 ++++++++++ Billing.Shared/Views/RankPage.xaml | 13 +++++-------- Billing.Shared/Views/SettingPage.xaml.cs | 3 ++- Billing/Billing.Android/Definition.cs | 19 ++++--------------- .../Resources/Resource.designer.cs | 2 +- Billing/Billing.iOS/Definition.cs | 12 ++++-------- 11 files changed, 40 insertions(+), 59 deletions(-) diff --git a/Billing.Shared/Themes/BaseTheme.cs b/Billing.Shared/Themes/BaseTheme.cs index de45714..e118f21 100644 --- a/Billing.Shared/Themes/BaseTheme.cs +++ b/Billing.Shared/Themes/BaseTheme.cs @@ -31,9 +31,8 @@ namespace Billing.Themes protected void InitResources() { - var regularFontFamily = Definition.GetRegularFontFamily(); - Add(FontSemiBold, Definition.GetSemiBoldFontFamily()); - Add(FontBold, Definition.GetBoldFontFamily()); + Add(FontSemiBold, Definition.SemiBoldFontFamily); + Add(FontBold, Definition.BoldFontFamily); Add(PrimaryColor, PrimaryMauiColor); Add(SecondaryColor, SecondaryMauiColor); @@ -45,7 +44,7 @@ namespace Billing.Themes { new Setter { Property = Label.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(Label)) }, new Setter { Property = Label.TextColorProperty, Value = PrimaryMauiColor }, - new Setter { Property = Label.FontFamilyProperty, Value = regularFontFamily } + new Setter { Property = Label.FontFamilyProperty, Value = Definition.RegularFontFamily } } }); Add(new Style(typeof(OptionEntry)) @@ -53,7 +52,7 @@ namespace Billing.Themes Setters = { new Setter { Property = Entry.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(Entry)) }, - new Setter { Property = Entry.FontFamilyProperty, Value = regularFontFamily } + new Setter { Property = Entry.FontFamilyProperty, Value = Definition.RegularFontFamily } } }); Add(new Style(typeof(OptionEditor)) @@ -61,7 +60,7 @@ namespace Billing.Themes Setters = { new Setter { Property = Editor.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(Editor)) }, - new Setter { Property = Editor.FontFamilyProperty, Value = regularFontFamily } + new Setter { Property = Editor.FontFamilyProperty, Value = Definition.RegularFontFamily } } }); Add(new Style(typeof(OptionDatePicker)) @@ -69,7 +68,7 @@ namespace Billing.Themes Setters = { new Setter { Property = DatePicker.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(DatePicker)) }, - new Setter { Property = DatePicker.FontFamilyProperty, Value = regularFontFamily } + new Setter { Property = DatePicker.FontFamilyProperty, Value = Definition.RegularFontFamily } } }); Add(new Style(typeof(OptionTimePicker)) @@ -77,7 +76,7 @@ namespace Billing.Themes Setters = { new Setter { Property = TimePicker.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(TimePicker)) }, - new Setter { Property = TimePicker.FontFamilyProperty, Value = regularFontFamily } + new Setter { Property = TimePicker.FontFamilyProperty, Value = Definition.RegularFontFamily } } }); Add(new Style(typeof(OptionPicker)) @@ -85,7 +84,7 @@ namespace Billing.Themes Setters = { new Setter { Property = Picker.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(TimePicker)) }, - new Setter { Property = Picker.FontFamilyProperty, Value = regularFontFamily } + new Setter { Property = Picker.FontFamilyProperty, Value = Definition.RegularFontFamily } } }); Add(new Style(typeof(TintImage)) diff --git a/Billing.Shared/UI/BillingDate.xaml.cs b/Billing.Shared/UI/BillingDate.xaml.cs index 7517abd..8684f34 100644 --- a/Billing.Shared/UI/BillingDate.xaml.cs +++ b/Billing.Shared/UI/BillingDate.xaml.cs @@ -230,7 +230,7 @@ namespace Billing.UI { public static readonly BindableProperty DateProperty = Helper.Create(nameof(Date), propertyChanged: OnDatePropertyChanged); public static readonly BindableProperty TextProperty = Helper.Create(nameof(Text)); - public static readonly BindableProperty FontFamilyProperty = Helper.Create(nameof(FontFamily), defaultValue: Definition.GetRegularFontFamily()); + public static readonly BindableProperty FontFamilyProperty = Helper.Create(nameof(FontFamily), defaultValue: Definition.RegularFontFamily); public static readonly BindableProperty IsSelectedProperty = Helper.Create(nameof(IsSelected), defaultValue: false); public static readonly BindableProperty OpacityProperty = Helper.Create(nameof(Opacity), defaultValue: 1.0); public static readonly BindableProperty TextOpacityProperty = Helper.Create(nameof(TextOpacity), defaultValue: 1.0); @@ -273,11 +273,11 @@ namespace Billing.UI if (Helper.IsSameDay(date, selected)) { IsSelected = true; - SetValue(FontFamilyProperty, Definition.GetBoldFontFamily()); + SetValue(FontFamilyProperty, Definition.BoldFontFamily); } else { - SetValue(FontFamilyProperty, Definition.GetRegularFontFamily()); + SetValue(FontFamilyProperty, Definition.RegularFontFamily); } if (date.Year == selected.Year && date.Month == selected.Month) { diff --git a/Billing.Shared/UI/Converters.cs b/Billing.Shared/UI/Converters.cs index c54f2d4..10f10c9 100644 --- a/Billing.Shared/UI/Converters.cs +++ b/Billing.Shared/UI/Converters.cs @@ -211,7 +211,7 @@ namespace Billing.UI } return new FontImageSource { - FontFamily = Definition.GetBrandsFontFamily(), + FontFamily = Definition.BrandsFontFamily, Size = 20, Glyph = glyph, Color = Color.Black diff --git a/Billing.Shared/UI/Definition.cs b/Billing.Shared/UI/Definition.cs index 7e97113..0e1a92b 100644 --- a/Billing.Shared/UI/Definition.cs +++ b/Billing.Shared/UI/Definition.cs @@ -10,12 +10,6 @@ namespace Billing.UI public const string PrimaryColorKey = "PrimaryColor"; public const string DefaultIcon = "ic_default"; public const long TransparentColor = 0x00ffffffL; - - public static partial (string main, long build) GetVersion(); - public static partial string GetRegularFontFamily(); - public static partial string GetSemiBoldFontFamily(); - public static partial string GetBoldFontFamily(); - public static partial string GetBrandsFontFamily(); } public static class ExtensionHelper diff --git a/Billing.Shared/Views/BillPage.xaml b/Billing.Shared/Views/BillPage.xaml index bbf62e7..d86c228 100644 --- a/Billing.Shared/Views/BillPage.xaml +++ b/Billing.Shared/Views/BillPage.xaml @@ -32,13 +32,8 @@ VerticalOptions="Center" LongCommand="{Binding TitleLongPressed}"> + FontFamily="{x:Static ui:Definition.SemiBoldFontFamily}" + FontSize="{OnPlatform Android=20, iOS=18}"/> - + "OpenSans-Regular.ttf#OpenSans-Regular"; - public static partial string GetSemiBoldFontFamily() => "OpenSans-SemiBold.ttf#OpenSans-SemiBold"; - public static partial string GetBoldFontFamily() => "OpenSans-Bold.ttf#OpenSans-Bold"; - public static partial string GetBrandsFontFamily() => "fa-brands-400.ttf#FontAwesome6Brands-Regular"; + public const string RegularFontFamily = "OpenSans-Regular.ttf#OpenSans-Regular"; + public const string SemiBoldFontFamily = "OpenSans-SemiBold.ttf#OpenSans-SemiBold"; + public const string BoldFontFamily = "OpenSans-Bold.ttf#OpenSans-Bold"; + public const string BrandsFontFamily = "fa-brands-400.ttf#FontAwesome6Brands-Regular"; } } \ No newline at end of file diff --git a/Billing/Billing.Android/Resources/Resource.designer.cs b/Billing/Billing.Android/Resources/Resource.designer.cs index b3dabc0..f81d669 100644 --- a/Billing/Billing.Android/Resources/Resource.designer.cs +++ b/Billing/Billing.Android/Resources/Resource.designer.cs @@ -14,7 +14,7 @@ namespace Billing.Droid { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.2.0.155")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] public partial class Resource { diff --git a/Billing/Billing.iOS/Definition.cs b/Billing/Billing.iOS/Definition.cs index 7442856..1063744 100644 --- a/Billing/Billing.iOS/Definition.cs +++ b/Billing/Billing.iOS/Definition.cs @@ -2,13 +2,9 @@ { public static partial class Definition { - public static partial (string main, long build) GetVersion() => ( - Foundation.NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleShortVersionString").ToString(), - int.Parse(Foundation.NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleVersion").ToString()) - ); - public static partial string GetRegularFontFamily() => "OpenSans-Regular"; - public static partial string GetSemiBoldFontFamily() => "OpenSans-SemiBold"; - public static partial string GetBoldFontFamily() => "OpenSans-Bold"; - public static partial string GetBrandsFontFamily() => "FontAwesome6Brands-Regular"; + public const string RegularFontFamily = "OpenSans-Regular"; + public const string SemiBoldFontFamily = "OpenSans-SemiBold"; + public const string BoldFontFamily = "OpenSans-Bold"; + public const string BrandsFontFamily = "FontAwesome6Brands-Regular"; } } \ No newline at end of file