ui fix
This commit is contained in:
@ -14,6 +14,10 @@ namespace Billing.UI
|
|||||||
{
|
{
|
||||||
if (value is DateTime date)
|
if (value is DateTime date)
|
||||||
{
|
{
|
||||||
|
if (date.Year <= 1900)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return date.ToString(Resource.TitleDateFormat);
|
return date.ToString(Resource.TitleDateFormat);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
@ -12,11 +12,9 @@ namespace Billing.Views
|
|||||||
{
|
{
|
||||||
public partial class BillPage : BillingPage
|
public partial class BillPage : BillingPage
|
||||||
{
|
{
|
||||||
private static readonly DateTime dateNow = DateTime.Today;
|
private static readonly BindableProperty SelectedDateProperty = Helper.Create<DateTime, BillPage>(nameof(SelectedDate), propertyChanged: OnSelectedDateChanged);
|
||||||
|
|
||||||
private static readonly BindableProperty SelectedDateProperty = Helper.Create<DateTime, BillPage>(nameof(SelectedDate), defaultValue: dateNow, propertyChanged: OnSelectedDateChanged);
|
|
||||||
private static readonly BindableProperty BillsProperty = Helper.Create<List<UIBill>, BillPage>(nameof(Bills));
|
private static readonly BindableProperty BillsProperty = Helper.Create<List<UIBill>, BillPage>(nameof(Bills));
|
||||||
private static readonly BindableProperty NoBillsProperty = Helper.Create<bool, BillPage>(nameof(NoBills));
|
private static readonly BindableProperty NoBillsProperty = Helper.Create<bool, BillPage>(nameof(NoBills), defaultValue: true);
|
||||||
private static readonly BindableProperty IncomeProperty = Helper.Create<decimal, BillPage>(nameof(Income));
|
private static readonly BindableProperty IncomeProperty = Helper.Create<decimal, BillPage>(nameof(Income));
|
||||||
private static readonly BindableProperty SpendingProperty = Helper.Create<decimal, BillPage>(nameof(Spending));
|
private static readonly BindableProperty SpendingProperty = Helper.Create<decimal, BillPage>(nameof(Spending));
|
||||||
private static readonly BindableProperty BalanceProperty = Helper.Create<decimal, BillPage>(nameof(Balance));
|
private static readonly BindableProperty BalanceProperty = Helper.Create<decimal, BillPage>(nameof(Balance));
|
||||||
@ -46,6 +44,8 @@ namespace Billing.Views
|
|||||||
public Command EditBilling { get; }
|
public Command EditBilling { get; }
|
||||||
public Command DeleteBilling { get; }
|
public Command DeleteBilling { get; }
|
||||||
|
|
||||||
|
private bool initialized;
|
||||||
|
|
||||||
public BillPage()
|
public BillPage()
|
||||||
{
|
{
|
||||||
TitleDateTap = new Command(OnTitleDateTapped);
|
TitleDateTap = new Command(OnTitleDateTapped);
|
||||||
@ -54,8 +54,15 @@ namespace Billing.Views
|
|||||||
DeleteBilling = new Command(OnDeleteBilling);
|
DeleteBilling = new Command(OnDeleteBilling);
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
billingDate.SetDateTime(dateNow);
|
public override void OnLoaded()
|
||||||
|
{
|
||||||
|
if (!initialized)
|
||||||
|
{
|
||||||
|
initialized = true;
|
||||||
|
billingDate.SetDateTime(DateTime.Today);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDateSelected(object sender, DateEventArgs e)
|
private void OnDateSelected(object sender, DateEventArgs e)
|
||||||
@ -109,7 +116,10 @@ namespace Billing.Views
|
|||||||
|
|
||||||
private void TitlePicker_DateSelected(object sender, DateChangedEventArgs e)
|
private void TitlePicker_DateSelected(object sender, DateChangedEventArgs e)
|
||||||
{
|
{
|
||||||
billingDate.SetDateTime(e.NewDate);
|
if (e.NewDate.Year > 1900)
|
||||||
|
{
|
||||||
|
billingDate.SetDateTime(e.NewDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTitleDateLongPressed()
|
private void OnTitleDateLongPressed()
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
<Compile Include="Renderers\OptionEditorRenderer.cs" />
|
<Compile Include="Renderers\OptionEditorRenderer.cs" />
|
||||||
<Compile Include="SplashActivity.cs" />
|
<Compile Include="SplashActivity.cs" />
|
||||||
<Compile Include="Renderers\TintImageButtonRenderer.cs" />
|
<Compile Include="Renderers\TintImageButtonRenderer.cs" />
|
||||||
|
<Compile Include="Renderers\BillingPageRenderer.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidAsset Include="Assets\fa-brands-400.ttf" />
|
<AndroidAsset Include="Assets\fa-brands-400.ttf" />
|
||||||
|
25
Billing/Billing.Android/Renderers/BillingPageRenderer.cs
Normal file
25
Billing/Billing.Android/Renderers/BillingPageRenderer.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Android.Content;
|
||||||
|
using Billing.Droid.Renderers;
|
||||||
|
using Billing.UI;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Platform.Android;
|
||||||
|
|
||||||
|
[assembly: ExportRenderer(typeof(BillingPage), typeof(BillingPageRenderer))]
|
||||||
|
namespace Billing.Droid.Renderers
|
||||||
|
{
|
||||||
|
public class BillingPageRenderer : PageRenderer
|
||||||
|
{
|
||||||
|
public BillingPageRenderer(Context context) : base(context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAttachedToWindow()
|
||||||
|
{
|
||||||
|
base.OnAttachedToWindow();
|
||||||
|
if (Element is BillingPage page)
|
||||||
|
{
|
||||||
|
page.OnLoaded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user