fix issue

This commit is contained in:
gaoyuan 2022-03-03 22:34:18 +08:00
parent 526da1ede8
commit bc5cf4afa5
5 changed files with 25 additions and 18 deletions

View File

@ -43,7 +43,8 @@
Text="{Binding Liability, Converter={StaticResource moneyConverter}}"/>
</Grid>
</Grid>
<ui:GroupStackLayout x:Name="groupLayout" ItemsSource="{Binding Accounts}" Margin="0, 10, 0, 0" GroupHeight="40">
<ui:GroupStackLayout x:Name="groupLayout" ItemsSource="{Binding Accounts}" Margin="0, 10, 0, 0"
GroupHeight="36" RowHeight="44">
<ui:GroupStackLayout.GroupHeaderTemplate>
<DataTemplate x:DataType="v:AccountGrouping">
<StackLayout Orientation="Horizontal" Padding="10, 0" VerticalOptions="End">

View File

@ -46,8 +46,8 @@ namespace Billing.Views
AddToAccountGroup(account);
}
}
groupLayout.Refresh(accounts);
RefreshBalance(true);
groupLayout.Refresh(accounts);
}
private void RefreshBalance(bool calc = false)
@ -127,8 +127,8 @@ namespace Billing.Views
{
accounts.Remove(group);
}
groupLayout.Refresh(accounts);
RefreshBalance();
groupLayout.Refresh(accounts);
_ = Task.Run(App.WriteAccounts);
}
@ -144,8 +144,8 @@ namespace Billing.Views
App.Accounts.Add(e.Account);
AddToAccountGroup(e.Account);
}
groupLayout.Refresh(accounts);
RefreshBalance(!add);
groupLayout.Refresh(accounts);
Task.Run(App.WriteAccounts);
}

View File

@ -23,12 +23,13 @@
<Shell.TitleView>
<Grid ColumnSpacing="16" ColumnDefinitions="20, *">
<ui:TintImage Source="calendar.png" WidthRequest="20" HeightRequest="20" VerticalOptions="Center"/>
<ui:LongPressButton Grid.Column="1" Text="{Binding SelectedDate, Converter={StaticResource titleDateConverter}}"
TextColor="{DynamicResource PrimaryColor}"
HorizontalOptions="{OnPlatform iOS=Center, Android=Start}"
FontFamily="{DynamicResource RobotoCondensedFontBold}"
FontAttributes="Bold" FontSize="20" VerticalOptions="Center"
LongPressed="OnTitleDateLongPressed"/>
<ui:LongPressGrid Grid.Column="1" HorizontalOptions="{OnPlatform iOS=Center, Android=Start}"
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>
</Shell.TitleView>

View File

@ -33,11 +33,13 @@ namespace Billing.Views
public decimal Spending => (decimal)GetValue(SpendingProperty);
public decimal Balance => (decimal)GetValue(BalanceProperty);
public Command TitleLongPressed { get; }
public Command EditBilling { get; }
public Command DeleteBilling { get; }
public BillPage()
{
TitleLongPressed = new Command(OnTitleDateLongPressed);
EditBilling = new Command(OnEditBilling);
DeleteBilling = new Command(OnDeleteBilling);
@ -50,12 +52,15 @@ namespace Billing.Views
{
SelectedDate = e.Date;
var bills = App.Bills.Where(b =>
b.CreateTime.Year == e.Date.Year &&
b.CreateTime.Month == e.Date.Month &&
b.CreateTime.Day == e.Date.Day);
Bills = new List<UIBill>(bills.Select(b => WrapBill(b)));
RefreshBalance(Bills);
Task.Run(() =>
{
var bills = App.Bills.Where(b =>
b.CreateTime.Year == e.Date.Year &&
b.CreateTime.Month == e.Date.Month &&
b.CreateTime.Day == e.Date.Day);
Bills = new List<UIBill>(bills.Select(b => WrapBill(b)));
RefreshBalance(Bills);
});
}
private void RefreshBalance(List<UIBill> bills)
@ -89,7 +94,7 @@ namespace Billing.Views
bill.Wallet = App.Accounts.FirstOrDefault(a => a.Id == bill.Bill.WalletId)?.Name;
}
private void OnTitleDateLongPressed(object sender, EventArgs e)
private void OnTitleDateLongPressed()
{
billingDate.SetDateTime(DateTime.Now);
}

View File

@ -10,7 +10,7 @@
Title="{r:Text Settings}"
BindingContext="{x:Reference settingPage}">
<TableView Intent="Settings" RowHeight="44">
<TableView Intent="Settings" RowHeight="36">
<TableSection Title="{r:Text About}">
<ui:OptionTextCell Title="{r:Text Version}"
Detail="{Binding Version}"/>