💄 Finish album detail view

pull/1/head
Alexis Drai 2 years ago
parent a8dd472e6e
commit a985873ac0

@ -8,6 +8,9 @@
public string CoverImage { get; set; }
public string Genre { get; set; }
public int Year { get; set; }
public DateTime ReleaseDate { get; set; }
public int CopyrightYear { get; set; }
public string ProducerBlurb { get; set; }
public List<Song> Songs { get; set; }
}

@ -4,6 +4,12 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<Style TargetType="Label" x:Key="FooterLabel">
<Setter Property="FontSize" Value="12" />
<Setter Property="TextColor" Value="{StaticResource Gray}" />
<Setter Property="HorizontalTextAlignment" Value="Start" />
</Style>
<Style TargetType="ActivityIndicator">
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
</Style>

@ -10,29 +10,23 @@ namespace AD_MAUI.ViewModel
private readonly Album album = new();
public int Id { get => album.Id; }
public int Id => album.Id;
public string Title
{
get => album.Title;
}
public string Title => album.Title;
public string Artist
{
get => album.Artist;
}
public string Artist => album.Artist;
public string CoverImage
{
get => album.CoverImage;
}
public string CoverImage => album.CoverImage;
public string Details
{
get => $"{album.Genre} · {album.Year}";
}
public string Details => $"{album.Genre} · {album.Year}";
public string ReleaseDate => album.ReleaseDate.ToString("d MMMM yyyy");
public string SongsInfo => $"{album.Songs.Count} songs, {album.Songs.Sum(song => song.Duration) / 60} minutes";
public string CopyrightInfo => $"℗ {album.CopyrightYear} {album.ProducerBlurb}";
public ReadOnlyObservableCollection<SongViewModel> Songs { get => new(songs); }
public ReadOnlyObservableCollection<SongViewModel> Songs => new(songs);
private readonly ObservableCollection<SongViewModel> songs;
@ -48,6 +42,9 @@ namespace AD_MAUI.ViewModel
CoverImage = "macroblank.png",
Genre = "Test genre",
Year = 1970,
ReleaseDate = new DateTime(1970, 01, 01),
CopyrightYear = 1996,
ProducerBlurb = "Test Records Ltd",
Songs = new List<Song>
{
new Song { Id = 1, Title = "Test Song 1", Duration = 210 },

@ -9,20 +9,11 @@ namespace AD_MAUI.ViewModel
public event PropertyChangedEventHandler? PropertyChanged;
public string Title
{
get => song.Title;
}
public string Title => song.Title;
public int Duration
{
get => song.Duration;
}
public int Duration => song.Duration;
public int? Index
{
get => song?.Index;
}
public int? Index => song?.Index;
public SongViewModel(Song? song)
{

@ -13,6 +13,10 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Image Source="{Binding CoverImage}"
@ -64,13 +68,15 @@
Margin="8"
Grid.Row="3" />
<CollectionView ItemsSource="{Binding Songs}" Grid.Row="4">
<CollectionView ItemsSource="{Binding Songs}"
Margin="0,0,0,16"
Grid.Row="4">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="local:SongViewModel">
<StackLayout>
<Grid Margin="0,8,0,0">
<Grid Margin="0,8,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="36"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
@ -79,6 +85,8 @@
FontSize="16"
TextColor="{StaticResource Gray}"
Margin="0,0,8,0"
HorizontalTextAlignment="Center"
HorizontalOptions="Center"
Grid.Column="0"/>
<Label Text="{Binding Title}"
@ -99,11 +107,23 @@
<BoxView HeightRequest="1"
Color="{StaticResource Gray300}"
HorizontalOptions="FillAndExpand"
Margin="16,0,8,0"/>
Margin="36,0,8,0"/>
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Label Text="{Binding ReleaseDate}"
Style="{StaticResource FooterLabel}"
Grid.Row="5" />
<Label Text="{Binding SongsInfo}"
Style="{StaticResource FooterLabel}"
Grid.Row="6" />
<Label Text="{Binding CopyrightInfo}"
Style="{StaticResource FooterLabel}"
Grid.Row="7" />
</Grid>
</ScrollView>
</ContentPage>

Loading…
Cancel
Save