change fonts

This commit is contained in:
2022-03-08 08:54:05 +08:00
parent 4076b2c9ed
commit 91db3caa15
24 changed files with 30 additions and 51 deletions

View File

@@ -7,11 +7,7 @@ namespace Billing.Themes
{
public static Color CurrentPrimaryColor => (Color)Application.Current.Resources[PrimaryColor];
public const string CascadiaFontRegular = nameof(CascadiaFontRegular);
public const string CascadiaFontBold = nameof(CascadiaFontBold);
public const string RobotoCondensedFontRegular = nameof(RobotoCondensedFontRegular);
public const string RobotoCondensedFontBold = nameof(RobotoCondensedFontBold);
public const string BrandsFontRegular = nameof(BrandsFontRegular);
public const string FontBold = nameof(FontBold);
public const string WindowBackgroundColor = nameof(WindowBackgroundColor);
public const string OptionTintColor = nameof(OptionTintColor);
@@ -32,12 +28,8 @@ namespace Billing.Themes
protected void InitResources()
{
var robotoRegularFontFamily = Definition.GetRobotoCondensedRegularFontFamily();
Add(CascadiaFontRegular, Definition.GetCascadiaRegularFontFamily());
Add(CascadiaFontBold, Definition.GetCascadiaBoldFontFamily());
Add(RobotoCondensedFontRegular, Definition.GetRobotoCondensedRegularFontFamily());
Add(RobotoCondensedFontBold, Definition.GetRobotoCondensedBoldFontFamily());
Add(BrandsFontRegular, Definition.GetBrandsFontFamily());
var regularFontFamily = Definition.GetRegularFontFamily();
Add(FontBold, Definition.GetBoldFontFamily());
Add(PrimaryColor, PrimaryMauiColor);
Add(SecondaryColor, SecondaryMauiColor);
@@ -49,7 +41,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 = robotoRegularFontFamily }
new Setter { Property = Label.FontFamilyProperty, Value = regularFontFamily }
}
});
Add(new Style(typeof(OptionEntry))
@@ -57,7 +49,7 @@ namespace Billing.Themes
Setters =
{
new Setter { Property = Entry.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(Entry)) },
new Setter { Property = Entry.FontFamilyProperty, Value = robotoRegularFontFamily }
new Setter { Property = Entry.FontFamilyProperty, Value = regularFontFamily }
}
});
Add(new Style(typeof(OptionEditor))
@@ -65,7 +57,7 @@ namespace Billing.Themes
Setters =
{
new Setter { Property = Editor.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(Editor)) },
new Setter { Property = Editor.FontFamilyProperty, Value = robotoRegularFontFamily }
new Setter { Property = Editor.FontFamilyProperty, Value = regularFontFamily }
}
});
Add(new Style(typeof(OptionDatePicker))
@@ -73,7 +65,7 @@ namespace Billing.Themes
Setters =
{
new Setter { Property = DatePicker.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(DatePicker)) },
new Setter { Property = DatePicker.FontFamilyProperty, Value = robotoRegularFontFamily }
new Setter { Property = DatePicker.FontFamilyProperty, Value = regularFontFamily }
}
});
Add(new Style(typeof(OptionTimePicker))
@@ -81,7 +73,7 @@ namespace Billing.Themes
Setters =
{
new Setter { Property = TimePicker.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(TimePicker)) },
new Setter { Property = TimePicker.FontFamilyProperty, Value = robotoRegularFontFamily }
new Setter { Property = TimePicker.FontFamilyProperty, Value = regularFontFamily }
}
});
Add(new Style(typeof(Button))
@@ -89,7 +81,7 @@ namespace Billing.Themes
Setters =
{
new Setter { Property = Button.TextColorProperty, Value = SecondaryMauiColor },
new Setter { Property = Button.FontFamilyProperty, Value = robotoRegularFontFamily },
new Setter { Property = Button.FontFamilyProperty, Value = regularFontFamily },
new Setter { Property = VisualElement.BackgroundColorProperty, Value = PrimaryMauiColor },
new Setter { Property = Button.PaddingProperty, Value = new Thickness(14, 10) }
}

View File

@@ -17,7 +17,7 @@
<Setter Property="HorizontalOptions" Value="Center"/>
</Style>
<ControlTemplate x:Key="weekDay">
<Grid Padding="0, 8, 0, 0" RowDefinitions="Auto, 3" RowSpacing="{OnPlatform Android=0, iOS=4}">
<Grid Padding="0, 8, 0, 0" RowDefinitions="Auto, 3" RowSpacing="4">
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OnDayTapped, Source={x:Reference billingDate}}" CommandParameter="{TemplateBinding BillingDay}"/>
</Grid.GestureRecognizers>
@@ -32,7 +32,7 @@
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="weekEnd">
<Grid Padding="0, 8, 0, 0" RowDefinitions="Auto, 3" RowSpacing="{OnPlatform Android=0, iOS=4}">
<Grid Padding="0, 8, 0, 0" RowDefinitions="Auto, 3" RowSpacing="4">
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OnDayTapped, Source={x:Reference billingDate}}" CommandParameter="{TemplateBinding BillingDay}"/>
</Grid.GestureRecognizers>

View File

@@ -221,7 +221,7 @@ namespace Billing.UI
{
public static readonly BindableProperty DateProperty = BindableProperty.Create(nameof(Date), typeof(DateTime), typeof(BillingDay), propertyChanged: OnDatePropertyChanged);
public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(BillingDay));
public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(BillingDay), defaultValue: Definition.GetCascadiaRegularFontFamily());
public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(BillingDay), defaultValue: Definition.GetRegularFontFamily());
public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool), typeof(BillingDay));
public static readonly BindableProperty OpacityProperty = BindableProperty.Create(nameof(Opacity), typeof(double), typeof(BillingDay), defaultValue: 1.0);
public static readonly BindableProperty TextOpacityProperty = BindableProperty.Create(nameof(TextOpacity), typeof(double), typeof(BillingDay), defaultValue: 1.0);
@@ -271,11 +271,11 @@ namespace Billing.UI
if (date.Year == selected.Year && date.DayOfYear == selected.DayOfYear)
{
SetValue(IsSelectedProperty, true);
SetValue(FontFamilyProperty, Definition.GetCascadiaBoldFontFamily());
SetValue(FontFamilyProperty, Definition.GetBoldFontFamily());
}
else
{
SetValue(FontFamilyProperty, Definition.GetCascadiaRegularFontFamily());
SetValue(FontFamilyProperty, Definition.GetRegularFontFamily());
}
if (date.Year == selected.Year && date.Month == selected.Month)
{

View File

@@ -13,10 +13,8 @@ namespace Billing.UI
{
public static string PrimaryColorKey = "PrimaryColor";
public static partial (string main, long build) GetVersion();
public static partial string GetCascadiaRegularFontFamily();
public static partial string GetCascadiaBoldFontFamily();
public static partial string GetRobotoCondensedRegularFontFamily();
public static partial string GetRobotoCondensedBoldFontFamily();
public static partial string GetRegularFontFamily();
public static partial string GetBoldFontFamily();
public static partial string GetBrandsFontFamily();
}

View File

@@ -30,7 +30,7 @@
</Grid.Effects>-->
<StackLayout VerticalOptions="Center" Margin="20, 0" Spacing="0">
<Label FontSize="Small" Text="{r:Text Balance}"/>
<Label FontSize="24" FontFamily="{DynamicResource RobotoCondensedFontBold}"
<Label FontSize="24" FontFamily="{DynamicResource FontBold}"
Text="{Binding Balance, Converter={StaticResource moneyConverter}}"/>
</StackLayout>
<Grid Grid.Column="1" Margin="20, 0" VerticalOptions="Center" HorizontalOptions="End"

View File

@@ -28,7 +28,6 @@
VerticalOptions="Center" LongCommand="{Binding TitleLongPressed}">
<Label Text="{Binding SelectedDate, Converter={StaticResource titleDateConverter}}"
TextColor="{DynamicResource PrimaryColor}"
FontFamily="{DynamicResource RobotoCondensedFontBold}"
FontAttributes="Bold" FontSize="20"/>
</ui:LongPressGrid>
</Grid>