diff --git a/AMC.Model/Models/Library.cs b/AMC.Model/Models/Library.cs new file mode 100644 index 0000000..21f35a6 --- /dev/null +++ b/AMC.Model/Models/Library.cs @@ -0,0 +1,8 @@ + +namespace AMC.Model.Models +{ + public class Library + { + public List Albums { get; set; } + } +} diff --git a/AMC.Model/Models/Song.cs b/AMC.Model/Models/Song.cs index 5c55dc8..7ae595c 100644 --- a/AMC.Model/Models/Song.cs +++ b/AMC.Model/Models/Song.cs @@ -1,4 +1,5 @@ -namespace AMC.Model.Models { +namespace AMC.Model.Models +{ public class Song { public int Id { get; set; } diff --git a/AMC.View/AMC.View.csproj b/AMC.View/AMC.View.csproj index c9ad4b9..8eb9a2b 100644 --- a/AMC.View/AMC.View.csproj +++ b/AMC.View/AMC.View.csproj @@ -49,7 +49,14 @@ - + + + + + + + + @@ -82,6 +89,16 @@ MSBuild:Compile + + MSBuild:Compile + + + MSBuild:Compile + + + + + diff --git a/AMC.View/App.xaml.cs b/AMC.View/App.xaml.cs index d855210..4675ecb 100644 --- a/AMC.View/App.xaml.cs +++ b/AMC.View/App.xaml.cs @@ -1,6 +1,4 @@ -using System.Globalization; - -namespace AMC.View; +namespace AMC.View; public partial class App : Application { diff --git a/AMC.View/AppShell.xaml b/AMC.View/AppShell.xaml index 3e3e366..4e2e6ce 100644 --- a/AMC.View/AppShell.xaml +++ b/AMC.View/AppShell.xaml @@ -3,12 +3,12 @@ x:Class="AMC.View.AppShell" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" - xmlns:local="clr-namespace:AMC.View" + xmlns:local="clr-namespace:AMC.View.Views" Shell.FlyoutBehavior="Disabled"> + ContentTemplate="{DataTemplate local:LibraryPage}" + Route="LibraryPage" /> diff --git a/AMC.View/Controls/LibraryCategoryItem.xaml b/AMC.View/Controls/LibraryCategoryItem.xaml new file mode 100644 index 0000000..25a7156 --- /dev/null +++ b/AMC.View/Controls/LibraryCategoryItem.xaml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/AMC.View/Controls/LibraryCategoryItem.xaml.cs b/AMC.View/Controls/LibraryCategoryItem.xaml.cs new file mode 100644 index 0000000..16817a7 --- /dev/null +++ b/AMC.View/Controls/LibraryCategoryItem.xaml.cs @@ -0,0 +1,50 @@ + +namespace AMC.View.Controls +{ + public partial class LibraryCategoryItem : ContentView + { + public static readonly BindableProperty CategoryTextProperty = BindableProperty.Create( + propertyName: nameof(CategoryText), + returnType: typeof(string), + declaringType: typeof(LibraryCategoryItem), + defaultValue: "", + propertyChanged: CategoryTextChanged); + + public static readonly BindableProperty IconSourceProperty = BindableProperty.Create( + propertyName: nameof(IconSource), + returnType: typeof(ImageSource), + declaringType: typeof(LibraryCategoryItem), + defaultValue: null, + propertyChanged: IconSourceChanged); + + public LibraryCategoryItem() + { + InitializeComponent(); + } + + public string CategoryText + { + get => (string)GetValue(CategoryTextProperty); + set => SetValue(CategoryTextProperty, value); + } + + public ImageSource IconSource + { + get => (ImageSource)GetValue(IconSourceProperty); + set => SetValue(IconSourceProperty, value); + } + + private static void CategoryTextChanged(BindableObject bindable, object oldValue, object newValue) + { + var control = (LibraryCategoryItem)bindable; + control.CategoryLabel.Text = (string)newValue; + } + + private static void IconSourceChanged(BindableObject bindable, object oldValue, object newValue) + { + var control = (LibraryCategoryItem)bindable; + control.IconImage.Source = (ImageSource)newValue; + } + } + +} diff --git a/AMC.View/Converters/SongsInfoConverter.cs b/AMC.View/Converters/SongsInfoConverter.cs index 6a63476..7c0a1a3 100644 --- a/AMC.View/Converters/SongsInfoConverter.cs +++ b/AMC.View/Converters/SongsInfoConverter.cs @@ -8,8 +8,8 @@ namespace AMC.View.Converters public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var (songCount, totalDuration) = (ValueTuple)value; - var songLabel = songCount == 1 ? Strings.SongsLabelSingular : Strings.SongsLabelPlural; - var minutesLabel = totalDuration == 1 ? Strings.MinutesLabelSingular : Strings.MinutesLabelPlural; + var songLabel = int.Abs(songCount) < 2 ? Strings.SongsLabelSingular : Strings.SongsLabelPlural; + var minutesLabel = int.Abs(totalDuration) < 2 ? Strings.MinutesLabelSingular : Strings.MinutesLabelPlural; return string.Format( "{0} {1}, {2} {3}", songCount, diff --git a/AMC.View/MainPage.xaml b/AMC.View/MainPage.xaml deleted file mode 100644 index 113fea4..0000000 --- a/AMC.View/MainPage.xaml +++ /dev/null @@ -1,12 +0,0 @@ - - - -