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

@@ -24,6 +24,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Languages\Resource.cs" />
<Compile Include="$(MSBuildThisFileDirectory)MainShell.xaml.cs">
<DependentUpon>MainShell.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Models\Category.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Models\Account.cs" />
@@ -32,6 +33,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Themes\Light.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\BillingDate.xaml.cs">
<DependentUpon>BillingDate.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UI\BillingPage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\ColorPicker.cs" />
@@ -44,12 +46,15 @@
<Compile Include="$(MSBuildThisFileDirectory)UI\WrapLayout.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Views\AccountPage.xaml.cs">
<DependentUpon>AccountPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Views\AddAccountPage.xaml.cs">
<DependentUpon>AddAccountPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Views\AddBillPage.xaml.cs">
<DependentUpon>AddBillPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Views\AddCategoryPage.xaml.cs">
<DependentUpon>AddCategoryPage.xaml</DependentUpon>
@@ -57,6 +62,7 @@
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Views\BillPage.xaml.cs">
<DependentUpon>BillPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Views\CategoryPage.xaml.cs">
<DependentUpon>CategoryPage.xaml</DependentUpon>
@@ -76,6 +82,7 @@
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Views\SettingPage.xaml.cs">
<DependentUpon>SettingPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UI\OptionsCells.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Store\StoreHelper.cs" />
@@ -84,6 +91,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Models\IIdItem.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SplashPage.xaml.cs">
<DependentUpon>SplashPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Models\Logs.cs" />
</ItemGroup>

View File

@@ -16,6 +16,7 @@ namespace Billing.Languages
public static string ConfirmDeleteAccount => Text(nameof(ConfirmDeleteAccount));
public static string ConfirmDeleteBill => Text(nameof(ConfirmDeleteBill));
public static string TitleDateFormat => Text(nameof(TitleDateFormat));
public static string TitleShortDateFormat => Text(nameof(TitleShortDateFormat));
public static string DateRangeFormat => Text(nameof(DateRangeFormat));
public static string Custom => Text(nameof(Custom));
public static string Monthly => Text(nameof(Monthly));

View File

@@ -20,6 +20,7 @@
<NoRecords>Bills not yet generated</NoRecords>
<TapToMemo>Click here to record</TapToMemo>
<TitleDateFormat>MM/dd/yyyy</TitleDateFormat>
<TitleShortDateFormat>MM/dd/yyyy</TitleShortDateFormat>
<DateRangeFormat>MM/dd</DateRangeFormat>
<To>To</To>
<Type>Type</Type>

View File

@@ -20,6 +20,7 @@
<NoRecords>还未产生账单</NoRecords>
<TapToMemo>点此记录</TapToMemo>
<TitleDateFormat>yyyy年MM月dd日</TitleDateFormat>
<TitleShortDateFormat>yyyy/MM/dd</TitleShortDateFormat>
<DateRangeFormat>MM月dd日</DateRangeFormat>
<To></To>
<Type>类型</Type>

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();
}