diff --git a/Billing.Shared/Helper.cs b/Billing.Shared/Helper.cs index 87b9abe..5c35dcd 100644 --- a/Billing.Shared/Helper.cs +++ b/Billing.Shared/Helper.cs @@ -1,6 +1,7 @@ using System; using System.Globalization; using Xamarin.Essentials; +using Xamarin.Forms; namespace Billing { @@ -73,5 +74,45 @@ namespace Billing } return color; } + + public static bool IsSameDay(DateTime day1, DateTime day2) + { + return day1.Year == day2.Year && day1.DayOfYear == day2.DayOfYear; + } + + public static DateTime FirstDay(DateTime date) + { + var week = date.DayOfWeek; + if (week == DayOfWeek.Sunday) + { + return date; + } + return date.AddDays(-(int)week); + } + + public static BindableProperty Create(string name, TResult defaultValue = default, PropertyValueChanged propertyChanged = null) + where TOwner : BindableObject + { + if (propertyChanged == null) + { + return BindableProperty.Create(name, typeof(TResult), typeof(TOwner), defaultValue: defaultValue); + } + return BindableProperty.Create(name, typeof(TResult), typeof(TOwner), + defaultValue: defaultValue, + propertyChanged: (obj, old, @new) => + { + if (old != null && !(old is TResult)) + { + return; + } + if (@new != null && !(@new is TResult)) + { + return; + } + propertyChanged((TOwner)obj, (TResult)old, (TResult)@new); + }); + } + + public delegate void PropertyValueChanged(TOwner obj, TResult old, TResult @new); } } \ No newline at end of file diff --git a/Billing.Shared/Themes/BaseTheme.cs b/Billing.Shared/Themes/BaseTheme.cs index 4c4ad78..b87fde4 100644 --- a/Billing.Shared/Themes/BaseTheme.cs +++ b/Billing.Shared/Themes/BaseTheme.cs @@ -7,6 +7,7 @@ namespace Billing.Themes { public static Color CurrentPrimaryColor => (Color)Application.Current.Resources[PrimaryColor]; + public const string FontSemiBold = nameof(FontSemiBold); public const string FontBold = nameof(FontBold); public const string WindowBackgroundColor = nameof(WindowBackgroundColor); @@ -29,6 +30,7 @@ namespace Billing.Themes protected void InitResources() { var regularFontFamily = Definition.GetRegularFontFamily(); + Add(FontSemiBold, Definition.GetSemiBoldFontFamily()); Add(FontBold, Definition.GetBoldFontFamily()); Add(PrimaryColor, PrimaryMauiColor); @@ -76,21 +78,18 @@ namespace Billing.Themes new Setter { Property = TimePicker.FontFamilyProperty, Value = regularFontFamily } } }); - Add(new Style(typeof(Button)) - { - Setters = - { - new Setter { Property = Button.TextColorProperty, Value = SecondaryMauiColor }, - new Setter { Property = Button.FontFamilyProperty, Value = regularFontFamily }, - new Setter { Property = VisualElement.BackgroundColorProperty, Value = PrimaryMauiColor }, - new Setter { Property = Button.PaddingProperty, Value = new Thickness(14, 10) } - } - }); Add(new Style(typeof(TintImage)) { Setters = { - new Setter { Property = TintImage.PrimaryColorProperty, Value = PrimaryMauiColor } + new Setter { Property = TintHelper.TintColorProperty, Value = PrimaryMauiColor } + } + }); + Add(new Style(typeof(TintImageButton)) + { + Setters = + { + new Setter { Property = TintHelper.TintColorProperty, Value = PrimaryMauiColor } } }); } diff --git a/Billing.Shared/UI/BillingDate.xaml b/Billing.Shared/UI/BillingDate.xaml index d0d6d18..65d611d 100644 --- a/Billing.Shared/UI/BillingDate.xaml +++ b/Billing.Shared/UI/BillingDate.xaml @@ -25,7 +25,7 @@ TextColor="{DynamicResource TextColor}" FontFamily="{TemplateBinding BillingDay.FontFamily}" Opacity="{TemplateBinding BillingDay.TextOpacity}"/> - @@ -40,7 +40,7 @@ TextColor="{DynamicResource RedColor}" FontFamily="{TemplateBinding BillingDay.FontFamily}" Opacity="{TemplateBinding BillingDay.TextOpacity}"/> - diff --git a/Billing.Shared/UI/BillingDate.xaml.cs b/Billing.Shared/UI/BillingDate.xaml.cs index ec547cc..7517abd 100644 --- a/Billing.Shared/UI/BillingDate.xaml.cs +++ b/Billing.Shared/UI/BillingDate.xaml.cs @@ -7,13 +7,13 @@ namespace Billing.UI { #region UI Properties - public static readonly BindableProperty SundayProperty = BindableProperty.Create(nameof(Sunday), typeof(BillingDay), typeof(BillingDate)); - public static readonly BindableProperty MondayProperty = BindableProperty.Create(nameof(Monday), typeof(BillingDay), typeof(BillingDate)); - public static readonly BindableProperty TuesdayProperty = BindableProperty.Create(nameof(Tuesday), typeof(BillingDay), typeof(BillingDate)); - public static readonly BindableProperty WednesdayProperty = BindableProperty.Create(nameof(Wednesday), typeof(BillingDay), typeof(BillingDate)); - public static readonly BindableProperty ThursdayProperty = BindableProperty.Create(nameof(Thursday), typeof(BillingDay), typeof(BillingDate)); - public static readonly BindableProperty FridayProperty = BindableProperty.Create(nameof(Friday), typeof(BillingDay), typeof(BillingDate)); - public static readonly BindableProperty SaturdayProperty = BindableProperty.Create(nameof(Saturday), typeof(BillingDay), typeof(BillingDate)); + public static readonly BindableProperty SundayProperty = Helper.Create(nameof(Sunday)); + public static readonly BindableProperty MondayProperty = Helper.Create(nameof(Monday)); + public static readonly BindableProperty TuesdayProperty = Helper.Create(nameof(Tuesday)); + public static readonly BindableProperty WednesdayProperty = Helper.Create(nameof(Wednesday)); + public static readonly BindableProperty ThursdayProperty = Helper.Create(nameof(Thursday)); + public static readonly BindableProperty FridayProperty = Helper.Create(nameof(Friday)); + public static readonly BindableProperty SaturdayProperty = Helper.Create(nameof(Saturday)); public BillingDay Sunday => (BillingDay)GetValue(SundayProperty); public BillingDay Monday => (BillingDay)GetValue(MondayProperty); @@ -39,38 +39,36 @@ namespace Billing.UI }; } - public static readonly BindableProperty LocatedDateProperty = BindableProperty.Create(nameof(LocatedDate), typeof(DateTime), typeof(BillingDate), propertyChanged: OnLocatedDatePropertyChanged); - public static readonly BindableProperty SelectedDateProperty = BindableProperty.Create(nameof(SelectedDate), typeof(DateTime), typeof(BillingDate), propertyChanged: OnSelectedDatePropertyChanged); + public static readonly BindableProperty LocatedDateProperty = Helper.Create(nameof(LocatedDate), propertyChanged: OnLocatedDatePropertyChanged); + public static readonly BindableProperty SelectedDateProperty = Helper.Create(nameof(SelectedDate), propertyChanged: OnSelectedDatePropertyChanged); - private static void OnLocatedDatePropertyChanged(BindableObject obj, object old, object @new) + private static void OnLocatedDatePropertyChanged(BillingDate billingDate, DateTime old, DateTime date) { - if (obj is BillingDate billingDate && @new is DateTime date) + var week = (int)date.DayOfWeek; + var tmpDate = date.AddDays(-week); + for (var i = 0; i < 7; i++) { - var week = (int)date.DayOfWeek; - var tmpDate = date.AddDays(-week); - for (var i = 0; i < 7; i++) - { - var prop = GetWeekProperty(i); - var day = new BillingDay(tmpDate); - billingDate.SetValue(prop, day); - tmpDate = tmpDate.AddDays(1); - } + var day = new BillingDay(tmpDate); + billingDate[i] = day; + tmpDate = tmpDate.AddDays(1); } } - private static void OnSelectedDatePropertyChanged(BindableObject obj, object old, object @new) + private static void OnSelectedDatePropertyChanged(BillingDate billingDate, DateTime old, DateTime selected) { - if (obj is BillingDate billingDate && @new is DateTime selected) + for (var i = 0; i < 7; i++) { - for (var i = 0; i < 7; i++) - { - var prop = GetWeekProperty(i); - var day = (BillingDay)billingDate.GetValue(prop); - day.Refresh(selected); - } + var day = billingDate[i]; + day.Refresh(selected); } } + public BillingDay this[int index] + { + get => (BillingDay)GetValue(GetWeekProperty(index)); + set => SetValue(GetWeekProperty(index), value); + } + public DateTime LocatedDate { get => (DateTime)GetValue(LocatedDateProperty); @@ -99,13 +97,26 @@ namespace Billing.UI public void SetDateTime(DateTime selectedDate, DateTime? locatedDate = null) { + if (Helper.IsSameDay(selectedDate, SelectedDate)) + { + return; + } + DateTime located; if (locatedDate != null) { - LocatedDate = locatedDate.Value; + located = Helper.FirstDay(locatedDate.Value); } else { - LocatedDate = selectedDate; + located = Helper.FirstDay(selectedDate); + } + if (LocatedDate != located) + { + LocatedDate = located; + } + else + { + RestoreState(this[(int)selectedDate.DayOfWeek]); } SelectedDate = selectedDate; DateSelected?.Invoke(this, new DateEventArgs(selectedDate)); @@ -114,43 +125,48 @@ namespace Billing.UI private void OnDayChanged(object o) { var selected = SelectedDate; - if (o is BillingDay day && (selected.Year != day.Date.Year || selected.DayOfYear != day.Date.DayOfYear)) + if (o is BillingDay day && !Helper.IsSameDay(selected, day.Date)) { - for (var i = 0; i < 7; i++) - { - var d = (BillingDay)GetValue(GetWeekProperty(i)); - if (d.IsSelected) - { - this.AbortAnimation("unselected"); - this.Animate("unselected", v => - { - d.Opacity = v; - }, - start: 1, end: 0, - easing: Easing.CubicOut, - finished: (v, b) => - { - d.Opacity = 0; - d.IsSelected = false; - }); - } - } + RestoreState(day); SelectedDate = day.Date; - this.AbortAnimation("selected"); - this.Animate("selected", v => - { - day.Opacity = v; - }, - start: 0, end: 1, - easing: Easing.CubicOut, - finished: (v, b) => - { - day.Opacity = 1; - }); DateSelected?.Invoke(this, new DateEventArgs(day.Date)); } } + private void RestoreState(BillingDay day) + { + for (var i = 0; i < 7; i++) + { + var d = (BillingDay)GetValue(GetWeekProperty(i)); + if (d.IsSelected) + { + this.AbortAnimation("unselected"); + this.Animate("unselected", v => + { + d.Opacity = v; + }, + start: 1, end: 0, + easing: Easing.CubicOut, + finished: (v, b) => + { + d.Opacity = 0; + d.IsSelected = false; + }); + } + } + this.AbortAnimation("selected"); + this.Animate("selected", v => + { + day.Opacity = v; + }, + start: 0, end: 1, + easing: Easing.CubicOut, + finished: (v, b) => + { + day.Opacity = 1; + }); + } + private void OnPanUpdated(object sender, PanUpdatedEventArgs e) { if (e.StatusType == GestureStatus.Started) @@ -176,7 +192,6 @@ namespace Billing.UI x1 = null; var ms = (DateTime.Now - lastDate).TotalMilliseconds; var speed = totalX / ms; - Helper.Debug($"completed, speed: {speed}"); if (speed < -0.7) { LocatedDate = LocatedDate.AddDays(7); @@ -185,7 +200,7 @@ namespace Billing.UI { LocatedDate = LocatedDate.AddDays(-7); } - OnSelectedDatePropertyChanged(this, null, SelectedDate); + OnSelectedDatePropertyChanged(this, default, SelectedDate); } } } @@ -202,50 +217,37 @@ namespace Billing.UI public class BillingDayView : ContentView { - public static readonly BindableProperty BillingDayProperty = BindableProperty.Create(nameof(BillingDay), typeof(BillingDay), typeof(BillingDayView)); - public static readonly BindableProperty CommandProperty = BindableProperty.Create(nameof(Command), typeof(Command), typeof(BillingDayView)); + public static readonly BindableProperty BillingDayProperty = Helper.Create(nameof(BillingDay)); public BillingDay BillingDay { get => (BillingDay)GetValue(BillingDayProperty); set => SetValue(BillingDayProperty, value); } - public Command Command - { - get => (Command)GetValue(CommandProperty); - set => SetValue(CommandProperty, value); - } } public class BillingDay : BindableObject { - 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.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); + public static readonly BindableProperty DateProperty = Helper.Create(nameof(Date), propertyChanged: OnDatePropertyChanged); + public static readonly BindableProperty TextProperty = Helper.Create(nameof(Text)); + public static readonly BindableProperty FontFamilyProperty = Helper.Create(nameof(FontFamily), defaultValue: Definition.GetRegularFontFamily()); + public static readonly BindableProperty IsSelectedProperty = Helper.Create(nameof(IsSelected), defaultValue: false); + public static readonly BindableProperty OpacityProperty = Helper.Create(nameof(Opacity), defaultValue: 1.0); + public static readonly BindableProperty TextOpacityProperty = Helper.Create(nameof(TextOpacity), defaultValue: 1.0); - private static void OnDatePropertyChanged(BindableObject obj, object old, object @new) + private static void OnDatePropertyChanged(BillingDay day, DateTime old, DateTime date) { - if (obj is BillingDay day && @new is DateTime date) + if (date.Day == 1) { - if (date.Day == 1) - { - day.SetValue(TextProperty, date.ToString("MMM")); - } - else - { - day.SetValue(TextProperty, date.Day.ToString()); - } + day.SetValue(TextProperty, date.ToString("MMM")); + } + else + { + day.SetValue(TextProperty, date.Day.ToString()); } } - public DateTime Date - { - get => (DateTime)GetValue(DateProperty); - set => SetValue(DateProperty, value); - } + public DateTime Date => (DateTime)GetValue(DateProperty); public string Text => (string)GetValue(TextProperty); public string FontFamily => (string)GetValue(FontFamilyProperty); public bool IsSelected @@ -262,15 +264,15 @@ namespace Billing.UI public BillingDay(DateTime date) { - Date = date; + SetValue(DateProperty, date); } public void Refresh(DateTime selected) { var date = Date; - if (date.Year == selected.Year && date.DayOfYear == selected.DayOfYear) + if (Helper.IsSameDay(date, selected)) { - SetValue(IsSelectedProperty, true); + IsSelected = true; SetValue(FontFamilyProperty, Definition.GetBoldFontFamily()); } else diff --git a/Billing.Shared/UI/CustomControl.cs b/Billing.Shared/UI/CustomControl.cs index 0f69c6a..d32550f 100644 --- a/Billing.Shared/UI/CustomControl.cs +++ b/Billing.Shared/UI/CustomControl.cs @@ -3,17 +3,19 @@ using Xamarin.Forms; namespace Billing.UI { - public class TintImage : Image + public class TintHelper { - public static readonly BindableProperty PrimaryColorProperty = BindableProperty.Create(nameof(PrimaryColor), typeof(Color?), typeof(TintImage)); + public const string TintColor = nameof(TintColor); + public static readonly BindableProperty TintColorProperty = BindableProperty.CreateAttached(TintColor, typeof(Color?), typeof(TintHelper), null); - public Color? PrimaryColor - { - get => (Color?)GetValue(PrimaryColorProperty); - set => SetValue(PrimaryColorProperty, value); - } + public static void SetTintColor(BindableObject obj, Color? color) => obj.SetValue(TintColorProperty, color); + public static Color? GetTintColor(BindableObject obj) => (Color?)obj.GetValue(TintColorProperty); } + public class TintImage : Image { } + + public class TintImageButton : ImageButton { } + public class LongPressButton : Button { public event EventHandler LongPressed; diff --git a/Billing.Shared/UI/Definition.cs b/Billing.Shared/UI/Definition.cs index 9e04726..9f82ad7 100644 --- a/Billing.Shared/UI/Definition.cs +++ b/Billing.Shared/UI/Definition.cs @@ -14,6 +14,7 @@ namespace Billing.UI public static string PrimaryColorKey = "PrimaryColor"; public static partial (string main, long build) GetVersion(); public static partial string GetRegularFontFamily(); + public static partial string GetSemiBoldFontFamily(); public static partial string GetBoldFontFamily(); public static partial string GetBrandsFontFamily(); } diff --git a/Billing.Shared/UI/OptionsCells.cs b/Billing.Shared/UI/OptionsCells.cs index 1f87ce2..9a4e1dd 100644 --- a/Billing.Shared/UI/OptionsCells.cs +++ b/Billing.Shared/UI/OptionsCells.cs @@ -1,6 +1,5 @@ using Billing.Themes; using System; -using System.Threading.Tasks; using Xamarin.Forms; namespace Billing.UI @@ -44,8 +43,8 @@ namespace Billing.UI ColumnDefinitions = { new ColumnDefinition { Width = GridLength.Auto }, - new ColumnDefinition { Width = new GridLength(.3, GridUnitType.Star) }, - new ColumnDefinition { Width = new GridLength(.7, GridUnitType.Star) } + new ColumnDefinition { Width = new GridLength(.35, GridUnitType.Star) }, + new ColumnDefinition { Width = new GridLength(.65, GridUnitType.Star) } }, Children = { @@ -220,7 +219,7 @@ namespace Billing.UI Margin = new Thickness(6, 0) } .Binding(Image.SourceProperty, nameof(ImageSource)) - .Binding(TintImage.PrimaryColorProperty, nameof(TintColor)), + .Binding(TintHelper.TintColorProperty, nameof(TintColor)), new TintImage { @@ -270,7 +269,7 @@ namespace Billing.UI protected override View Content => new OptionDatePicker { HorizontalOptions = LayoutOptions.End, - VerticalOptions = LayoutOptions.Center + VerticalOptions = LayoutOptions.Fill } .Binding(DatePicker.DateProperty, nameof(Date), mode: BindingMode.TwoWay) .DynamicResource(DatePicker.TextColorProperty, BaseTheme.TextColor) @@ -290,7 +289,7 @@ namespace Billing.UI protected override View Content => new OptionTimePicker { HorizontalOptions = LayoutOptions.End, - VerticalOptions = LayoutOptions.Center + VerticalOptions = LayoutOptions.Fill } .Binding(TimePicker.TimeProperty, nameof(Time), mode: BindingMode.TwoWay) .DynamicResource(TimePicker.TextColorProperty, BaseTheme.TextColor) @@ -329,7 +328,8 @@ namespace Billing.UI { HorizontalOptions = LayoutOptions.Fill, HorizontalTextAlignment = TextAlignment.End, - VerticalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Fill, + VerticalTextAlignment = TextAlignment.Center, ReturnType = ReturnType.Next } .Binding(Entry.TextProperty, nameof(Text), mode: BindingMode.TwoWay) diff --git a/Billing.Shared/Views/AccountPage.xaml b/Billing.Shared/Views/AccountPage.xaml index 041e140..e15b997 100644 --- a/Billing.Shared/Views/AccountPage.xaml +++ b/Billing.Shared/Views/AccountPage.xaml @@ -28,9 +28,9 @@ - + + ColumnDefinitions=".35*, .65*" Padding="10"> diff --git a/Billing.Shared/Views/BillPage.xaml b/Billing.Shared/Views/BillPage.xaml index 7ea309c..8c3543f 100644 --- a/Billing.Shared/Views/BillPage.xaml +++ b/Billing.Shared/Views/BillPage.xaml @@ -3,6 +3,7 @@ xmlns:r="clr-namespace:Billing.Languages" xmlns:ui="clr-namespace:Billing.UI" xmlns:v="clr-namespace:Billing.Views" + xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Billing.Views.BillPage" x:DataType="v:BillPage" @@ -22,23 +23,34 @@ - - - + + + - + - + diff --git a/Billing.Shared/Views/BillPage.xaml.cs b/Billing.Shared/Views/BillPage.xaml.cs index 083de4a..6560468 100644 --- a/Billing.Shared/Views/BillPage.xaml.cs +++ b/Billing.Shared/Views/BillPage.xaml.cs @@ -1,4 +1,3 @@ -using Billing.Languages; using Billing.Models; using Billing.UI; using System; @@ -13,12 +12,19 @@ namespace Billing.Views { public partial class BillPage : BillingPage { - private static readonly BindableProperty SelectedDateProperty = BindableProperty.Create(nameof(SelectedDate), typeof(DateTime), typeof(BillPage)); - private static readonly BindableProperty BillsProperty = BindableProperty.Create(nameof(Bills), typeof(List), typeof(BillPage)); - private static readonly BindableProperty NoBillsProperty = BindableProperty.Create(nameof(NoBills), typeof(bool), typeof(BillPage)); - private static readonly BindableProperty IncomeProperty = BindableProperty.Create(nameof(Income), typeof(decimal), typeof(BillPage)); - private static readonly BindableProperty SpendingProperty = BindableProperty.Create(nameof(Spending), typeof(decimal), typeof(BillPage)); - private static readonly BindableProperty BalanceProperty = BindableProperty.Create(nameof(Balance), typeof(decimal), typeof(BillPage)); + private static readonly DateTime dateNow = DateTime.Today; + + private static readonly BindableProperty SelectedDateProperty = Helper.Create(nameof(SelectedDate), defaultValue: dateNow, propertyChanged: OnSelectedDateChanged); + private static readonly BindableProperty BillsProperty = Helper.Create, BillPage>(nameof(Bills)); + private static readonly BindableProperty NoBillsProperty = Helper.Create(nameof(NoBills)); + private static readonly BindableProperty IncomeProperty = Helper.Create(nameof(Income)); + private static readonly BindableProperty SpendingProperty = Helper.Create(nameof(Spending)); + private static readonly BindableProperty BalanceProperty = Helper.Create(nameof(Balance)); + + private static void OnSelectedDateChanged(BillPage page, DateTime old, DateTime @new) + { + page.titleDatePicker.Unfocus(); + } public DateTime SelectedDate { @@ -35,20 +41,21 @@ namespace Billing.Views public decimal Spending => (decimal)GetValue(SpendingProperty); public decimal Balance => (decimal)GetValue(BalanceProperty); + public Command TitleDateTap { get; } public Command TitleLongPressed { get; } public Command EditBilling { get; } public Command DeleteBilling { get; } public BillPage() { + TitleDateTap = new Command(OnTitleDateTapped); TitleLongPressed = new Command(OnTitleDateLongPressed); EditBilling = new Command(OnEditBilling); DeleteBilling = new Command(OnDeleteBilling); - SelectedDate = DateTime.Now; InitializeComponent(); - billingDate.SetDateTime(DateTime.Now); + billingDate.SetDateTime(dateNow); } private void OnDateSelected(object sender, DateEventArgs e) @@ -57,10 +64,7 @@ namespace Billing.Views 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); + var bills = App.Bills.Where(b => Helper.IsSameDay(b.CreateTime, e.Date)); Bills = new List(bills.OrderBy(b => b.CreateTime).Select(b => WrapBill(b))); RefreshBalance(Bills); MainThread.BeginInvokeOnMainThread(async () => await scrollView.ScrollToAsync(0, 0, true)); @@ -98,9 +102,19 @@ namespace Billing.Views bill.Wallet = App.Accounts.FirstOrDefault(a => a.Id == bill.Bill.WalletId)?.Name; } + private void OnTitleDateTapped() + { + titleDatePicker.Focus(); + } + + private void TitlePicker_DateSelected(object sender, DateChangedEventArgs e) + { + billingDate.SetDateTime(e.NewDate); + } + private void OnTitleDateLongPressed() { - billingDate.SetDateTime(DateTime.Now); + billingDate.SetDateTime(DateTime.Today); } private async void OnEditBilling(object o) diff --git a/Billing.Shared/Views/CategoryPage.xaml b/Billing.Shared/Views/CategoryPage.xaml index bf8c825..b113626 100644 --- a/Billing.Shared/Views/CategoryPage.xaml +++ b/Billing.Shared/Views/CategoryPage.xaml @@ -32,7 +32,7 @@ CommandParameter="{Binding .}"/>