haptic feedback

This commit is contained in:
2022-03-16 16:45:10 +08:00
parent d3af69b31e
commit cac4735bc4
11 changed files with 53 additions and 28 deletions

View File

@ -5,7 +5,9 @@ using Billing.Languages;
using Billing.Models;
using Billing.Store;
using Billing.UI;
using Xamarin.Essentials;
using Xamarin.Forms;
using Resource = Billing.Languages.Resource;
namespace Billing.Views
{
@ -171,6 +173,16 @@ namespace Billing.Views
category.LastUsed = DateTime.Now;
await StoreHelper.SaveCategoryItemAsync(category);
try
{
HapticFeedback.Perform();
}
catch (FeatureNotSupportedException) { }
catch (Exception ex)
{
Helper.Error("haptic.feedback", ex);
}
}
}

View File

@ -13,29 +13,28 @@
Shell.TabBarIsVisible="True">
<Shell.TitleView>
<Grid>
<StackLayout HorizontalOptions="Center" VerticalOptions="Center"
Orientation="Horizontal" Spacing="10">
<ui:TintImageButton Source="left.png" WidthRequest="20" HeightRequest="20"
VerticalOptions="Center" HorizontalOptions="Start"
Command="{Binding LeftCommand}"/>
<Label Text="{Binding Title}"
TextColor="{DynamicResource PrimaryColor}"
FontSize="{OnPlatform Android=20, iOS=18}">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding FilterCommand}"/>
</Label.GestureRecognizers>
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String"
Android="OpenSans-SemiBold.ttf#OpenSans-SemiBold"
iOS="OpenSans-Bold"/>
</Label.FontFamily>
</Label>
<ui:TintImageButton Source="right.png" WidthRequest="20" HeightRequest="20"
VerticalOptions="Center" HorizontalOptions="End"
Command="{Binding RightCommand}"/>
</StackLayout>
</Grid>
<StackLayout HorizontalOptions="Center" VerticalOptions="Center"
Orientation="Horizontal" Spacing="10">
<ui:TintImageButton Source="left.png" WidthRequest="20" HeightRequest="20"
VerticalOptions="Center" HorizontalOptions="Start"
Command="{Binding LeftCommand}"/>
<Label Text="{Binding Title}"
TextColor="{DynamicResource PrimaryColor}"
FontSize="{OnPlatform Android=20, iOS=18}"
Padding="10, 0">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding FilterCommand}"/>
</Label.GestureRecognizers>
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String"
Android="OpenSans-SemiBold.ttf#OpenSans-SemiBold"
iOS="OpenSans-Bold"/>
</Label.FontFamily>
</Label>
<ui:TintImageButton Source="right.png" WidthRequest="20" HeightRequest="20"
VerticalOptions="Center" HorizontalOptions="End"
Command="{Binding RightCommand}"/>
</StackLayout>
</Shell.TitleView>
<!--<ContentPage.ToolbarItems>

View File

@ -79,7 +79,7 @@ namespace Billing.Views
page.isLocked = false;
if (!page.isFreezed)
{
var format = Resource.TitleDateFormat;
var format = Resource.TitleShortDateFormat;
page.Title = page.StartDate.ToString(format) + " ~ " + page.EndDate.ToString(format);
page.LoadData();
}