first test-flight version
This commit is contained in:
		@@ -1,7 +1,6 @@
 | 
			
		||||
using Billing.Languages;
 | 
			
		||||
using Billing.Models;
 | 
			
		||||
using Billing.Themes;
 | 
			
		||||
using Billing.Views;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
@@ -26,9 +25,26 @@ namespace Billing.UI
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class NegativeConverter : IValueConverter
 | 
			
		||||
    {
 | 
			
		||||
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 | 
			
		||||
        {
 | 
			
		||||
            if (value is bool b)
 | 
			
		||||
            {
 | 
			
		||||
                return !b;
 | 
			
		||||
            }
 | 
			
		||||
            return value;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class MoneyConverter : IValueConverter
 | 
			
		||||
    {
 | 
			
		||||
        public bool MarkVisible { get; set; } = true;
 | 
			
		||||
        public bool MarkVisible { get; set; }
 | 
			
		||||
        public bool Absolute { get; set; }
 | 
			
		||||
 | 
			
		||||
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 | 
			
		||||
@@ -89,14 +105,13 @@ namespace Billing.UI
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class UIBillConverter : IValueConverter
 | 
			
		||||
    public class TimeConverter : IValueConverter
 | 
			
		||||
    {
 | 
			
		||||
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 | 
			
		||||
        {
 | 
			
		||||
            if (value is UIBill bill)
 | 
			
		||||
            if (value is DateTime time)
 | 
			
		||||
            {
 | 
			
		||||
                var time = bill.DateCreation.ToString("HH:mm");
 | 
			
		||||
                return $"{time} ({bill.Wallet})";
 | 
			
		||||
                return time.ToString("HH:mm");
 | 
			
		||||
            }
 | 
			
		||||
            return string.Empty;
 | 
			
		||||
        }
 | 
			
		||||
@@ -152,6 +167,7 @@ namespace Billing.UI
 | 
			
		||||
            { "appstore", "\uf370" },
 | 
			
		||||
            { "apple-pay", "\uf416" },
 | 
			
		||||
            { "btc", "\uf15a" },
 | 
			
		||||
            { "buffer", "\uf837" },
 | 
			
		||||
            { "jcb", "\uf24b" },
 | 
			
		||||
            { "master-card", "\uf1f1" },
 | 
			
		||||
            { "visa", "\uf1f0" },
 | 
			
		||||
 
 | 
			
		||||
@@ -29,4 +29,35 @@ namespace Billing.UI
 | 
			
		||||
            LongPressed?.Invoke(this, EventArgs.Empty);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class LongPressGrid : Grid
 | 
			
		||||
    {
 | 
			
		||||
        public static readonly BindableProperty LongCommandProperty = BindableProperty.Create(nameof(LongCommand), typeof(Command), typeof(LongPressGrid));
 | 
			
		||||
        public static readonly BindableProperty LongCommandParameterProperty = BindableProperty.Create(nameof(LongCommandParameter), typeof(object), typeof(LongPressGrid));
 | 
			
		||||
 | 
			
		||||
        public Command LongCommand
 | 
			
		||||
        {
 | 
			
		||||
            get => (Command)GetValue(LongCommandProperty);
 | 
			
		||||
            set => SetValue(LongCommandProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
        public object LongCommandParameter
 | 
			
		||||
        {
 | 
			
		||||
            get => GetValue(LongCommandParameterProperty);
 | 
			
		||||
            set => SetValue(LongCommandParameterProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void TriggerLongPress()
 | 
			
		||||
        {
 | 
			
		||||
            var command = LongCommand;
 | 
			
		||||
            if (command == null)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            var parameter = LongCommandParameter;
 | 
			
		||||
            if (command.CanExecute(parameter))
 | 
			
		||||
            {
 | 
			
		||||
                command.Execute(parameter);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -11,6 +11,8 @@ namespace Billing.UI
 | 
			
		||||
{
 | 
			
		||||
    public static partial class Definition
 | 
			
		||||
    {
 | 
			
		||||
        public static string PrimaryColorKey = "PrimaryColor";
 | 
			
		||||
        public static partial (string main, long build) GetVersion();
 | 
			
		||||
        public static partial string GetCascadiaRegularFontFamily();
 | 
			
		||||
        public static partial string GetCascadiaBoldFontFamily();
 | 
			
		||||
        public static partial string GetRobotoCondensedRegularFontFamily();
 | 
			
		||||
@@ -84,6 +86,13 @@ namespace Billing.UI
 | 
			
		||||
        {
 | 
			
		||||
            await page.DisplayAlert(title ?? page.Title, message, Resource.Ok);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static async Task<bool> ShowConfirm(this Page page, string message)
 | 
			
		||||
        {
 | 
			
		||||
            var yes = Resource.Yes;
 | 
			
		||||
            var result = await page.DisplayActionSheet(message, Resource.No, yes);
 | 
			
		||||
            return result == yes;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static class ModelExtensionHelper
 | 
			
		||||
 
 | 
			
		||||
@@ -182,7 +182,7 @@ namespace Billing.UI
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    lastHeight = rowHeight + spacing;
 | 
			
		||||
                    lastHeight += rowHeight + spacing;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            lastSizeRequest = new SizeRequest(new Size(widthConstraint, lastHeight));
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,7 @@ namespace Billing.UI
 | 
			
		||||
 | 
			
		||||
        public ItemSelectPage(IEnumerable<T> source)
 | 
			
		||||
        {
 | 
			
		||||
            var iconConverter = new IconConverter();
 | 
			
		||||
            var content = new ListView
 | 
			
		||||
            {
 | 
			
		||||
                ItemsSource = source,
 | 
			
		||||
@@ -30,7 +31,7 @@ namespace Billing.UI
 | 
			
		||||
                                Aspect = Aspect.AspectFit,
 | 
			
		||||
                                VerticalOptions = LayoutOptions.Center
 | 
			
		||||
                            }
 | 
			
		||||
                            .Binding(Image.SourceProperty, "Icon"),
 | 
			
		||||
                            .Binding(Image.SourceProperty, "Icon", converter: iconConverter),
 | 
			
		||||
 | 
			
		||||
                            new Label
 | 
			
		||||
                            {
 | 
			
		||||
@@ -51,11 +52,12 @@ namespace Billing.UI
 | 
			
		||||
            Content = content;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void List_ItemTapped(object sender, ItemTappedEventArgs e)
 | 
			
		||||
        private async void List_ItemTapped(object sender, ItemTappedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            if (e.Item is T t)
 | 
			
		||||
            {
 | 
			
		||||
                ItemTapped?.Invoke(this, t);
 | 
			
		||||
                await Navigation.PopAsync();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,8 @@ namespace Billing.UI
 | 
			
		||||
{
 | 
			
		||||
    public class OptionEntry : Entry { }
 | 
			
		||||
    public class OptionEditor : Editor { }
 | 
			
		||||
    public class OptionDatePicker : DatePicker { }
 | 
			
		||||
    public class OptionTimePicker : TimePicker { }
 | 
			
		||||
 | 
			
		||||
    public abstract class OptionCell : ViewCell
 | 
			
		||||
    {
 | 
			
		||||
@@ -163,7 +165,6 @@ namespace Billing.UI
 | 
			
		||||
            {
 | 
			
		||||
                new Label
 | 
			
		||||
                {
 | 
			
		||||
                    HorizontalOptions = LayoutOptions.End,
 | 
			
		||||
                    VerticalOptions = LayoutOptions.Center
 | 
			
		||||
                }
 | 
			
		||||
                .Binding(Label.TextProperty, nameof(Detail))
 | 
			
		||||
@@ -207,7 +208,6 @@ namespace Billing.UI
 | 
			
		||||
                {
 | 
			
		||||
                    WidthRequest = 26,
 | 
			
		||||
                    HeightRequest = 20,
 | 
			
		||||
                    HorizontalOptions = LayoutOptions.End,
 | 
			
		||||
                    VerticalOptions = LayoutOptions.Center,
 | 
			
		||||
                    Margin = new Thickness(6, 0)
 | 
			
		||||
                }
 | 
			
		||||
@@ -248,6 +248,46 @@ namespace Billing.UI
 | 
			
		||||
        .Binding(Switch.IsToggledProperty, nameof(IsToggled), mode: BindingMode.TwoWay);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class OptionDatePickerCell : OptionCell
 | 
			
		||||
    {
 | 
			
		||||
        public static readonly BindableProperty DateProperty = BindableProperty.Create(nameof(Date), typeof(DateTime), typeof(OptionDatePickerCell));
 | 
			
		||||
 | 
			
		||||
        public DateTime Date
 | 
			
		||||
        {
 | 
			
		||||
            get => (DateTime)GetValue(DateProperty);
 | 
			
		||||
            set => SetValue(DateProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override View Content => new OptionDatePicker
 | 
			
		||||
        {
 | 
			
		||||
            HorizontalOptions = LayoutOptions.End,
 | 
			
		||||
            VerticalOptions = LayoutOptions.Center
 | 
			
		||||
        }
 | 
			
		||||
        .Binding(DatePicker.DateProperty, nameof(Date), mode: BindingMode.TwoWay)
 | 
			
		||||
        .DynamicResource(DatePicker.TextColorProperty, BaseTheme.TextColor)
 | 
			
		||||
        .DynamicResource(VisualElement.BackgroundColorProperty, BaseTheme.OptionTintColor);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class OptionTimePickerCell : OptionCell
 | 
			
		||||
    {
 | 
			
		||||
        public static readonly BindableProperty TimeProperty = BindableProperty.Create(nameof(Time), typeof(TimeSpan), typeof(OptionTimePickerCell));
 | 
			
		||||
 | 
			
		||||
        public TimeSpan Time
 | 
			
		||||
        {
 | 
			
		||||
            get => (TimeSpan)GetValue(TimeProperty);
 | 
			
		||||
            set => SetValue(TimeProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override View Content => new OptionTimePicker
 | 
			
		||||
        {
 | 
			
		||||
            HorizontalOptions = LayoutOptions.End,
 | 
			
		||||
            VerticalOptions = LayoutOptions.Center
 | 
			
		||||
        }
 | 
			
		||||
        .Binding(TimePicker.TimeProperty, nameof(Time), mode: BindingMode.TwoWay)
 | 
			
		||||
        .DynamicResource(TimePicker.TextColorProperty, BaseTheme.TextColor)
 | 
			
		||||
        .DynamicResource(VisualElement.BackgroundColorProperty, BaseTheme.OptionTintColor);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class OptionEntryCell : OptionCell
 | 
			
		||||
    {
 | 
			
		||||
        public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(OptionEntryCell));
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user