fix issue

This commit is contained in:
gaoyuan
2022-03-07 21:31:27 +08:00
parent c3718d9d6c
commit 4076b2c9ed
19 changed files with 114 additions and 29 deletions

View File

@ -21,13 +21,15 @@
<ContentPage.Content>
<TableView Intent="Settings" HasUnevenRows="True">
<TableSection Title=" ">
<ui:OptionEditorCell Height="120" Icon="pencil.png" FontSize="20" Keyboard="Text"
<ui:OptionEditorCell x:Name="editorName" Height="120" Icon="pencil.png"
FontSize="20" Keyboard="Text"
Title="{r:Text AccountName}"
Text="{Binding AccountName, Mode=TwoWay}"
Placeholder="{r:Text AccountNamePlaceholder}"/>
<ui:OptionImageCell Height="44" Icon="face.png"
Title="{r:Text Icon}"
ImageSource="{Binding AccountIcon, Converter={StaticResource iconConverter}}"
TintColor="{DynamicResource PrimaryColor}"
Command="{Binding SelectIcon}"/>
<ui:OptionSelectCell Height="44" Icon="project.png"
Title="{r:Text Category}"

View File

@ -73,6 +73,17 @@ namespace Billing.Views
InitializeComponent();
}
private bool focused;
public override void OnLoaded()
{
if (!focused)
{
focused = true;
editorName.SetFocus();
}
}
private async void OnCheckAccount()
{
if (Tap.IsBusy)

View File

@ -16,7 +16,8 @@
<ContentPage.Content>
<TableView Intent="Settings" HasUnevenRows="True">
<TableSection Title=" ">
<ui:OptionEditorCell Height="120" Icon="yuan.png" FontSize="20" Keyboard="Numeric"
<ui:OptionEditorCell x:Name="editorAmount" Height="120" Icon="yuan.png"
FontSize="20" Keyboard="Numeric"
Text="{Binding Amount, Mode=TwoWay}"
Placeholder="0.00"/>
</TableSection>

View File

@ -116,6 +116,17 @@ namespace Billing.Views
}
}
private bool focused;
public override void OnLoaded()
{
if (!focused)
{
focused = true;
editorAmount.SetFocus();
}
}
private async void OnCheckBill()
{
if (Tap.IsBusy)

View File

@ -20,7 +20,8 @@
<ContentPage.Content>
<TableView Intent="Settings" HasUnevenRows="True">
<TableSection Title=" ">
<ui:OptionEditorCell Height="120" Icon="pencil.png" FontSize="20" Keyboard="Text"
<ui:OptionEditorCell x:Name="editorName" Height="120" Icon="pencil.png"
FontSize="20" Keyboard="Text"
Title="{r:Text Name}"
Text="{Binding CategoryName, Mode=TwoWay}"
Placeholder="{r:Text NamePlaceholder}"/>

View File

@ -58,7 +58,7 @@ namespace Billing.Views
if (category.TintColor == Color.Transparent ||
category.TintColor == default)
{
TintColor = (Color)Application.Current.Resources[BaseTheme.PrimaryColor];
TintColor = BaseTheme.CurrentPrimaryColor;
}
else
{
@ -67,7 +67,7 @@ namespace Billing.Views
}
else
{
TintColor = (Color)Application.Current.Resources[BaseTheme.PrimaryColor];
TintColor = BaseTheme.CurrentPrimaryColor;
}
TintColorString = Helper.WrapColorString(TintColor.ToHex());
@ -77,6 +77,17 @@ namespace Billing.Views
InitializeComponent();
}
private bool focused;
public override void OnLoaded()
{
if (!focused)
{
focused = true;
editorName.SetFocus();
}
}
private void ColorPicker_ColorChanged(object sender, Color e)
{
TintColor = e;
@ -91,6 +102,8 @@ namespace Billing.Views
}
using (Tap.Start())
{
var currentColor = BaseTheme.CurrentPrimaryColor;
var tintColor = TintColor;
var category = App.Categories.FirstOrDefault(c => c.Id == categoryId);
if (category == null)
{
@ -99,8 +112,8 @@ namespace Billing.Views
Id = -1,
Name = CategoryName,
Icon = CategoryIcon,
TintColor = TintColor,
ParentId = parent?.Id ?? -1,
TintColor = tintColor == currentColor ? Color.Transparent : tintColor,
ParentId = parent?.Id,
Type = parent?.Type ?? CategoryType.Spending
});
}
@ -108,7 +121,7 @@ namespace Billing.Views
{
category.Name = CategoryName;
category.Icon = CategoryIcon;
category.TintColor = TintColor;
category.TintColor = tintColor == currentColor ? Color.Transparent : tintColor;
CategoryChecked?.Invoke(this, category);
}
await Navigation.PopAsync();

View File

@ -13,7 +13,7 @@
</ContentPage.Resources>
<ScrollView>
<ui:GroupStackLayout x:Name="groupLayout" ItemsSource="{Binding Categories}" Margin="0, 10, 0, 0"
<ui:GroupStackLayout x:Name="groupLayout" ItemsSource="{Binding Categories}" Padding="0, 10, 0, 0"
GroupHeight="36" RowHeight="44">
<ui:GroupStackLayout.GroupHeaderTemplate>
<DataTemplate x:DataType="v:CategoryGrouping">

View File

@ -26,14 +26,15 @@ namespace Billing.Views
public Command Tapped { get; }
private readonly int parentId;
private readonly Category parent;
public CategoryPage(int pid = -1)
{
parentId = pid;
var category = App.Categories.FirstOrDefault(c => c.Id == pid);
Title = category?.Name ?? Resource.CategoryManage;
parent = App.Categories.FirstOrDefault(c => c.Id == pid);
Title = parent?.Name ?? Resource.CategoryManage;
if (category != null)
if (parent != null)
{
SetValue(IsTopCategoryProperty, false);
Categories = App.Categories.Where(c => c.ParentId == pid).Select(c => WrapCategory(c)).ToList();
@ -68,7 +69,7 @@ namespace Billing.Views
Name = category.Name,
IsTopCategory = IsTopCategory,
TintColor = category.TintColor == Color.Transparent || category.TintColor == default ?
(Color)Application.Current.Resources[BaseTheme.PrimaryColor] :
BaseTheme.CurrentPrimaryColor :
category.TintColor
};
}
@ -81,7 +82,7 @@ namespace Billing.Views
}
using (Tap.Start())
{
var page = new AddCategoryPage();
var page = new AddCategoryPage(parent: parent);
page.CategoryChecked += OnCategoryChecked;
await Navigation.PushAsync(page);
}
@ -189,7 +190,9 @@ namespace Billing.Views
{
c.Name = c.Category.Name;
c.Icon = c.Category.Icon;
c.TintColor = c.Category.TintColor;
c.TintColor = c.Category.TintColor == Color.Transparent || c.Category.TintColor == default ?
BaseTheme.CurrentPrimaryColor :
c.Category.TintColor;
}
}

View File

@ -17,7 +17,7 @@
<Grid ColumnDefinitions=".5*, .5*">
<ScrollView>
<ui:GroupStackLayout ItemsSource="{Binding TopCategories}" Margin="0, 10, 0, 0"
<ui:GroupStackLayout ItemsSource="{Binding TopCategories}" Padding="0, 10, 0, 0"
GroupHeight="36" RowHeight="44">
<ui:GroupStackLayout.GroupHeaderTemplate>
<DataTemplate x:DataType="v:CategoryGrouping">
@ -48,7 +48,7 @@
</ScrollView>
<ScrollView Grid.Column="1">
<ui:GroupStackLayout ItemsSource="{Binding SubCategories}" Margin="0, 10, 0, 0" RowHeight="44" Padding="0, 40, 0, 0">
<ui:GroupStackLayout ItemsSource="{Binding SubCategories}" RowHeight="44" Padding="0, 50, 0, 0">
<ui:GroupStackLayout.ItemTemplate>
<DataTemplate x:DataType="v:UICategory">
<Grid Padding="20, 0, 10, 0" ColumnSpacing="10" ColumnDefinitions="Auto, *"

View File

@ -36,7 +36,7 @@ namespace Billing.Views
public CategorySelectPage(int id)
{
categoryId = id;
defaultColor = (Color)Application.Current.Resources[BaseTheme.PrimaryColor];
defaultColor = BaseTheme.CurrentPrimaryColor;
TapTopCategory = new Command(OnTopCategoryTapped);
TapSubCategory = new Command(OnSubCategoryTapped);

View File

@ -16,7 +16,7 @@
<Grid RowDefinitions="*, Auto">
<ScrollView>
<ui:WrapLayout ItemsSource="{Binding IconsSource}" Margin="10">
<ui:WrapLayout ItemsSource="{Binding IconsSource}" Padding="10">
<BindableLayout.ItemTemplate>
<DataTemplate x:DataType="v:BillingIcon">
<Grid WidthRequest="60" HeightRequest="60">