Skip to content

Commit

Permalink
Add initial episode details page nad show count in the conte details …
Browse files Browse the repository at this point in the history
…pill
  • Loading branch information
aetherstrata committed Feb 11, 2024
1 parent 14aca65 commit 4b4b21d
Show file tree
Hide file tree
Showing 25 changed files with 445 additions and 95 deletions.
1 change: 1 addition & 0 deletions .idea/.idea.Aosta/.idea/avalonia.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Aosta.Ava/Aosta.Ava/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

<Application.DataTemplates>
<StaticResource ResourceKey="Localizable"/>
<StaticResource ResourceKey="SeasonInfoPill"/>
<StaticResource ResourceKey="AnimeInfoPill"/>
<StaticResource ResourceKey="EpisodeCountInfoPill"/>
<StaticResource ResourceKey="InfoPill"/>
<local:ViewLocator />
</Application.DataTemplates>
Expand Down
6 changes: 3 additions & 3 deletions Aosta.Ava/Aosta.Ava/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public partial class App : Application
{
private ILogger _logger = null!;

public const string Version = "0.0.1";
public const string VERSION = "0.0.1";

public override void Initialize()
{
Expand All @@ -57,11 +57,11 @@ public override void OnFrameworkInitializationCompleted()
.Build())
.RegisterViewsForViewModels(Assembly.GetExecutingAssembly());

var language = LanguageKey.Load().OrDefault(LanguageKey.DEFAULT).Language;
var language = LanguageKey.Load().Language;
Localizer.Instance.Language = language;
_logger.Information("Loaded language {LanguageCode}", language.GetLanguageCode());

var themeKey = ThemeKey.Load().OrDefault(ThemeKey.DEFAULT);
var themeKey = ThemeKey.Load();
RequestedThemeVariant = themeKey.Theme;
_logger.Information("Loaded theme {Variant}", themeKey.Key);

Expand Down
10 changes: 6 additions & 4 deletions Aosta.Ava/Aosta.Ava/Assets/Localization/en-US.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"App.Version": "Version {0}",

"AnimeDetails.EpisodesList.Header": "Episodes",
"AnimeDetails.Synopsis.Header": "Synopsis",
"AnimeDetails.ToolTip.AddToRealm": "Add this anime to your watchlist",
"AnimeList.Header.NoAnime" : "The list is empty",
"AnimeList.Header.AnimeCount" : "{0} Anime",
Expand Down Expand Up @@ -31,12 +29,16 @@

"Label.All": "All",
"Label.ContentType": "Type",
"Label.Episode.Number": "Episode #{0}",
"Label.Episodes": "Episodes",
"Label.LoadMore": "Load more",
"Label.LocalizationLookupError": "Localization not found for {0}",
"Label.NotAvailable.Long" : "Not available",
"Label.NotAvailable.Short" : "N/A",
"Label.Season": "Season",
"Label.Online": "Online",
"Label.Score": "Score",
"Label.Season": "Season",
"Label.Synopsis": "Synopsis",
"Label.Year": "Year",

"Enum.AiringStatus.Airing": "Airing",
Expand All @@ -50,7 +52,7 @@
"Enum.AnimeAgeRatingFilter.R": "Mature",
"Enum.AnimeAgeRatingFilter.RX": "Hentai",

"Enum.AnimeType.TvAnime": "TV",
"Enum.AnimeType.TV": "TV",
"Enum.AnimeType.TvSpecial": "TV Special",
"Enum.AnimeType.OVA" : "OVA",
"Enum.AnimeType.Movie": "Movie",
Expand Down
10 changes: 6 additions & 4 deletions Aosta.Ava/Aosta.Ava/Assets/Localization/it-IT.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"App.Version": "Versione {0}",

"AnimeDetails.EpisodesList.Header": "Episodi",
"AnimeDetails.Synopsis.Header": "Sinossi",
"AnimeDetails.ToolTip.AddToRealm": "Aggiungi questo anime alla tua lista",
"AnimeList.Header.NoAnime" : "La lista è vuota",
"AnimeList.Header.AnimeCount" : "{0} Anime",
Expand Down Expand Up @@ -30,12 +28,16 @@

"Label.All": "Tutti",
"Label.ContentType": "Tipo",
"Label.Episode.Number": "Episodio n.{0}",
"Label.Episodes": "Episodi",
"Label.LoadMore": "Carica altro",
"Label.LocalizationLookupError": "Localizzazione non trovata per {0}",
"Label.NotAvailable.Long" : "Non disponibile",
"Label.NotAvailable.Short" : "N/D",
"Label.Season": "Stagione",
"Label.Online": "Online",
"Label.Score": "Voto",
"Label.Season": "Stagione",
"Label.Synopsis": "Sinossi",
"Label.Year": "Anno",

"Enum.AnimeAgeRatingFilter.G": "Adatto a tutti",
Expand All @@ -49,7 +51,7 @@
"Enum.AiringStatus.Complete": "Completato",
"Enum.AiringStatus.Upcoming": "In arrivo",

"Enum.AnimeType.TvAnime": "TV",
"Enum.AnimeType.TV": "TV",
"Enum.AnimeType.TvSpecial": "Speciale TV",
"Enum.AnimeType.OVA" : "OVA",
"Enum.AnimeType.Movie": "Film",
Expand Down
83 changes: 76 additions & 7 deletions Aosta.Ava/Aosta.Ava/Assets/Resources/DataTemplates.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,80 @@
xmlns:async="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
xmlns:card="clr-namespace:Aosta.Ava.ViewModels.Card"
xmlns:localize="clr-namespace:Aosta.Ava.Localization"
xmlns:details="clr-namespace:Aosta.Ava.ViewModels.Details">
xmlns:vm="clr-namespace:Aosta.Ava.ViewModels"
xmlns:detailsPill="clr-namespace:Aosta.Ava.ViewModels.DetailsPill">
<!-- Add Resources Here -->


<DataTemplate x:Key="Localizable" DataType="localize:ILocalized">
<TextBlock Text="{Binding Localized}" />
</DataTemplate>

<DataTemplate x:Key="SeasonInfoPill" DataType="details:AnimeSeasonInfoPill">
<DataTemplate x:Key="AnimeInfoPill" DataType="detailsPill:AnimePill">
<Border Background="{DynamicResource AccentButtonBackground}"
Margin="15"
Padding="0, 15"
CornerRadius="15">
<Grid ColumnDefinitions="2*,3*,2*"
<Grid ColumnDefinitions="2*,3*,3*,2*"
RowDefinitions="Auto,Auto">
<TextBlock Grid.Row="0" Grid.Column="0"
Text="{localize:Localize Label.Score}"
FontWeight="Bold"
FontSize="18" />
<TextBlock Grid.Row="0" Grid.Column="1"
Text="{localize:Localize Label.Season}"
Text="{localize:Localize Label.Episodes}"
FontWeight="Bold"
FontSize="18" />
<TextBlock Grid.Row="0" Grid.Column="2"
Text="{localize:Localize Label.Season}"
FontWeight="Bold"
FontSize="18" />
<TextBlock Grid.Row="0" Grid.Column="3"
Text="{localize:Localize Label.ContentType}"
FontWeight="Bold"
FontSize="18" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Score}" />
<TextBlock Grid.Row="1" Grid.Column="1">
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Episodes}" />
<TextBlock Grid.Row="1" Grid.Column="2">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} | {1}">
<Binding Path="Season.Localized" />
<Binding Path="Year" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="3" Text="{Binding Type.Localized}" />
<Grid.Styles>
<Style Selector="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource AccentButtonForeground}" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
</Grid.Styles>
</Grid>
</Border>
</DataTemplate>

<DataTemplate x:Key="EpisodeCountInfoPill" DataType="detailsPill:EpisodesPill">
<Border Background="{DynamicResource AccentButtonBackground}"
Margin="15"
Padding="0, 15"
CornerRadius="15">
<Grid ColumnDefinitions="2*,3*,2*"
RowDefinitions="Auto,Auto">
<TextBlock Grid.Row="0" Grid.Column="0"
Text="{localize:Localize Label.Score}"
FontWeight="Bold"
FontSize="18" />
<TextBlock Grid.Row="0" Grid.Column="1"
Text="{localize:Localize Label.Score}"
FontWeight="Bold"
FontSize="18" />
<TextBlock Grid.Row="0" Grid.Column="2"
Text="{localize:Localize Label.ContentType}"
FontWeight="Bold"
FontSize="18" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Score}" />
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Episodes}" />
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding Type.Localized}" />
<Grid.Styles>
<Style Selector="TextBlock">
Expand All @@ -51,7 +89,7 @@
</Border>
</DataTemplate>

<DataTemplate x:Key="InfoPill" DataType="details:InfoPill">
<DataTemplate x:Key="InfoPill" DataType="detailsPill:InfoPill">
<Border Background="{DynamicResource AccentButtonBackground}"
Margin="15"
Padding="0, 15"
Expand All @@ -70,7 +108,7 @@
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding Type.Localized}" />
<Grid.Styles>
<Style Selector="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource AccentButtonForeground}"/>
<Setter Property="Foreground" Value="{DynamicResource AccentButtonForeground}" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
</Grid.Styles>
Expand Down Expand Up @@ -124,4 +162,35 @@
Stretch="UniformToFill" />
</Button>
</DataTemplate>

<DataTemplate x:Key="JikanEpisodeEntry" DataType="vm:JikanEpisodeEntry">
<Button Command="{Binding GoToDetails}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Padding="5"
Margin="0">
<Grid RowDefinitions="Auto">
<TextBlock Grid.Row="0"
HorizontalAlignment="Left">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}. {1}">
<Binding Path="Number" />
<Binding Path="Title" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<StackPanel Grid.Row="0"
Spacing="5"
Orientation="Horizontal"
HorizontalAlignment="Right">
<TextBlock Text="F"
Foreground="Crimson"
IsVisible="{Binding Filler}" />
<TextBlock Text="R"
Foreground="Crimson"
IsVisible="{Binding Recap}" />
</StackPanel>
</Grid>
</Button>
</DataTemplate>
</ResourceDictionary>
14 changes: 10 additions & 4 deletions Aosta.Ava/Aosta.Ava/Extensions/JikanExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using Aosta.Ava.Localization;
using Aosta.Jikan.Enums;
using Aosta.Jikan.Models.Response;
using Aosta.Jikan.Query.Enums;

namespace Aosta.Ava.Extensions;
Expand All @@ -13,8 +14,8 @@ public static class JikanExtensions
{
public static LocalizedString Localize(this AnimeType e) => e switch
{
AnimeType.TV => new LocalizedString("Enum.AnimeType.TvAnime"),
AnimeType.TVSpecial => new LocalizedString("Enum.AnimeType.TvSpecial"),
AnimeType.TV => new LocalizedString("Enum.AnimeType.TV"),
AnimeType.TVSpecial => new LocalizedString("Enum.AnimeType.TVSpecial"),
AnimeType.OVA => new LocalizedString("Enum.AnimeType.OVA"),
AnimeType.Movie => new LocalizedString("Enum.AnimeType.Movie"),
AnimeType.Special => new LocalizedString("Enum.AnimeType.Special"),
Expand Down Expand Up @@ -49,8 +50,8 @@ public static class JikanExtensions
public static LocalizedData<AnimeTypeFilter> LocalizeWithData(this AnimeTypeFilter filter) => filter switch
{
AnimeTypeFilter.All => new LocalizedData<AnimeTypeFilter>(filter, "Label.All"),
AnimeTypeFilter.TV => new LocalizedData<AnimeTypeFilter>(filter, "Enum.AnimeType.TvAnime"),
AnimeTypeFilter.TVSpecial => new LocalizedData<AnimeTypeFilter>(filter, "Enum.AnimeType.TvSpecial"),
AnimeTypeFilter.TV => new LocalizedData<AnimeTypeFilter>(filter, "Enum.AnimeType.TV"),
AnimeTypeFilter.TVSpecial => new LocalizedData<AnimeTypeFilter>(filter, "Enum.AnimeType.TVSpecial"),
AnimeTypeFilter.OVA => new LocalizedData<AnimeTypeFilter>(filter, "Enum.AnimeType.OVA"),
AnimeTypeFilter.Movie => new LocalizedData<AnimeTypeFilter>(filter, "Enum.AnimeType.Movie"),
AnimeTypeFilter.Special => new LocalizedData<AnimeTypeFilter>(filter, "Enum.AnimeType.Special"),
Expand Down Expand Up @@ -83,4 +84,9 @@ public static class JikanExtensions
AnimeAgeRatingFilter.RX => new LocalizedData<AnimeAgeRatingFilter>(filter, "Enum.AnimeAgeRatingFilter.RX"),
_ => throw new ArgumentOutOfRangeException(nameof(filter), filter, null)
};

public static LocalizedString LocalizeEpisodeNumber(this AnimeEpisodeResponse response)
{
return new LocalizedString("Label.Episode.Number", response.MalId);
}
}
26 changes: 15 additions & 11 deletions Aosta.Ava/Aosta.Ava/Pages/HomePage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,27 @@
x:DataType="vm:HomePageViewModel">

<ScrollViewer VerticalScrollBarVisibility="Hidden">
<Grid RowDefinitions="Auto,Auto,Auto,Auto">
<Grid RowDefinitions="Auto,Auto,Auto,Auto"
Margin="0, 10, 0, 15">
<Button Grid.Row="0"
Command="{Binding GoToSettings}"
HorizontalAlignment="Right"
Margin="20,10"
Margin="20,0"
Theme="{StaticResource TransparentButton}">
<controls:FontIcon Glyph="{StaticResource SettingGlyph}"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="26"/>
</Button>
<TextBlock Grid.Row="0"

<!-- Seasonal anime -->
<TextBlock Grid.Row="2"
Margin="20, 10"
FontWeight="Bold"
FontSize="36"
Text="{localize:Localize HomePage.TopAnime.Header}" />
<ScrollViewer Grid.Row="1">
Text="{localize:Localize HomePage.SeasonalAnime.Header}" />
<ScrollViewer Grid.Row="3">
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ItemsSource="{Binding TopAnimes}"
ItemsSource="{Binding CurrentAnimes}"
ItemTemplate="{StaticResource JikanAnimeCard}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
Expand All @@ -46,14 +49,15 @@
</ListBox>
</ScrollViewer>

<TextBlock Grid.Row="2"
Margin="20, 10"
<!-- Top anime -->
<TextBlock Grid.Row="0"
Margin="20, 0"
FontWeight="Bold"
FontSize="36"
Text="{localize:Localize HomePage.SeasonalAnime.Header}" />
<ScrollViewer Grid.Row="3">
Text="{localize:Localize HomePage.TopAnime.Header}" />
<ScrollViewer Grid.Row="1">
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ItemsSource="{Binding CurrentAnimes}"
ItemsSource="{Binding TopAnimes}"
ItemTemplate="{StaticResource JikanAnimeCard}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
Expand Down
Loading

0 comments on commit 4b4b21d

Please sign in to comment.