diff --git a/Pixiview.Android/Pixiview.Android.csproj b/Pixiview.Android/Pixiview.Android.csproj index 4269866..20a4453 100644 --- a/Pixiview.Android/Pixiview.Android.csproj +++ b/Pixiview.Android/Pixiview.Android.csproj @@ -55,7 +55,7 @@ - + 12.0.3 diff --git a/Pixiview.Android/Properties/AndroidManifest.xml b/Pixiview.Android/Properties/AndroidManifest.xml index 6df914d..2b2f321 100644 --- a/Pixiview.Android/Properties/AndroidManifest.xml +++ b/Pixiview.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/Pixiview.iOS.OpenExtension/Info.plist b/Pixiview.iOS.OpenExtension/Info.plist index 466947f..3f49fb8 100644 --- a/Pixiview.iOS.OpenExtension/Info.plist +++ b/Pixiview.iOS.OpenExtension/Info.plist @@ -14,8 +14,6 @@ 6.0 CFBundlePackageType XPC! - CFBundleVersion - 2 MinimumOSVersion 13.4 NSExtension @@ -31,6 +29,8 @@ com.apple.share-services CFBundleShortVersionString - 1.0.511 + 1.0.513 + CFBundleVersion + 3 diff --git a/Pixiview.iOS/Info.plist b/Pixiview.iOS/Info.plist index d962109..54c2bf4 100644 --- a/Pixiview.iOS/Info.plist +++ b/Pixiview.iOS/Info.plist @@ -79,8 +79,8 @@ CFBundleShortVersionString - 1.0.511 + 1.0.513 CFBundleVersion - 2 + 3 diff --git a/Pixiview.iOS/Pixiview.iOS.csproj b/Pixiview.iOS/Pixiview.iOS.csproj index ba7184c..d5e188a 100644 --- a/Pixiview.iOS/Pixiview.iOS.csproj +++ b/Pixiview.iOS/Pixiview.iOS.csproj @@ -143,7 +143,7 @@ - + diff --git a/Pixiview.iOS/Renderers/SegmentedControlRenderer.cs b/Pixiview.iOS/Renderers/SegmentedControlRenderer.cs index c56a1ca..d4aacfe 100644 --- a/Pixiview.iOS/Renderers/SegmentedControlRenderer.cs +++ b/Pixiview.iOS/Renderers/SegmentedControlRenderer.cs @@ -114,7 +114,7 @@ namespace Pixiview.iOS.Renderers var tintColor = element.TintColor; if (tintColor == default) { - return UIColor.QuaternaryLabelColor; + return UIColor.SystemGray6Color; } else { diff --git a/Pixiview/Illust/FavoritesPage.xaml.cs b/Pixiview/Illust/FavoritesPage.xaml.cs index 2dd45f4..75a4c19 100644 --- a/Pixiview/Illust/FavoritesPage.xaml.cs +++ b/Pixiview/Illust/FavoritesPage.xaml.cs @@ -5,6 +5,7 @@ using System.Windows.Input; using Pixiview.Resources; using Pixiview.Utils; using Xamarin.Essentials; +using Xamarin.Forms; namespace Pixiview.Illust { @@ -25,7 +26,11 @@ namespace Pixiview.Illust protected override void OnAppearing() { //base.OnAppearing(); - Reload(); + Device.StartTimer(TimeSpan.FromMilliseconds(200), () => + { + Reload(); + return false; + }); } protected override IEnumerable DoGetIllustList(IllustItem[] data, ICommand command) diff --git a/Pixiview/Illust/IllustCollectionPage.cs b/Pixiview/Illust/IllustCollectionPage.cs index 23569fb..f968fbb 100644 --- a/Pixiview/Illust/IllustCollectionPage.cs +++ b/Pixiview/Illust/IllustCollectionPage.cs @@ -15,6 +15,7 @@ namespace Pixiview.Illust { public abstract class FavoriteIllustCollectionPage : IllustCollectionPage { } public abstract class IllustDataCollectionPage : IllustCollectionPage { } + public abstract class IllustRankingDataCollectionPage : IllustCollectionPage { } public abstract class IllustUserDataCollectionPage : IllustCollectionPage { } public interface IIllustCollectionPage @@ -132,20 +133,38 @@ namespace Pixiview.Illust { base.OnSizeAllocated(width, height); int columns; + var oldMargin = PanelTopMargin; + Thickness newMargin; + if (StyleDefinition.IsFullscreenDevice) + { + newMargin = width > height ? + AppShell.HalfNavigationBarOffset : + AppShell.NavigationBarOffset; + } + else if (isPhone) + { + newMargin = width > height ? + StyleDefinition.TopOffset16 : + StyleDefinition.TopOffset32; + } + else + { + // TODO ipad + newMargin = StyleDefinition.TopOffset32; + } if (width > height) { - PanelTopMargin = StyleDefinition.IsFullscreenDevice ? - AppShell.HalfNavigationBarOffset : - StyleDefinition.TopOffset16; columns = isPhone ? 4 : 6; } else { - PanelTopMargin = StyleDefinition.IsFullscreenDevice ? - AppShell.NavigationBarOffset : - StyleDefinition.TopOffset32; columns = isPhone ? 2 : 4; } + if (oldMargin != newMargin) + { + PanelTopMargin = newMargin; + OnPanelTopMarginChanged(oldMargin, newMargin); + } if (Columns != columns) { Columns = columns; @@ -162,6 +181,11 @@ namespace Pixiview.Illust var page = new ViewIllustPage(illust, IsFavoriteVisible); Navigation.PushAsync(page); } + protected virtual void DoIllustsLoaded(IllustCollection collection) + { + IllustCollection = collection; + Illusts = collection; + } protected void StartLoad(bool force = false) { @@ -227,16 +251,33 @@ namespace Pixiview.Illust .Binding(IsVisibleProperty, nameof(IllustItem.IsPageVisible)) .DynamicResource(Label.FontFamilyProperty, ThemeBase.IconSolidFontFamily); + // label: is anime + var anime = new RoundLabel + { + Text = StyleDefinition.IconPlay, + BackgroundColor = StyleDefinition.ColorDeepShadow, + Margin = new Thickness(0, 0, 6, 6), + Padding = new Thickness(12, 9, 0, 0), + WidthRequest = 36, + HeightRequest = 36, + CornerRadius = 18, + HorizontalOptions = LayoutOptions.End, + VerticalOptions = LayoutOptions.End, + FontSize = StyleDefinition.FontSizeTitle, + TextColor = Color.White + } + .Binding(IsVisibleProperty, nameof(IllustItem.IsAnimeVisible)) + .DynamicResource(Label.FontFamilyProperty, ThemeBase.IconSolidFontFamily); + // label: title var title = new Label { Padding = new Thickness(8, 2), HorizontalOptions = LayoutOptions.FillAndExpand, + VerticalOptions = LayoutOptions.Center, LineBreakMode = LineBreakMode.TailTruncation, FontSize = StyleDefinition.FontSizeSmall - } - .Binding(Label.TextProperty, nameof(IllustItem.Title)) - .DynamicResource(Label.TextColorProperty, ThemeBase.TextColor); + }.DynamicResource(Label.TextColorProperty, ThemeBase.TextColor); // label: favorite var favorite = new Label @@ -266,24 +307,34 @@ namespace Pixiview.Illust Content = new Grid { HorizontalOptions = LayoutOptions.Fill, + RowSpacing = 0, RowDefinitions = { new RowDefinition().Binding(RowDefinition.HeightProperty, nameof(IllustItem.ImageHeight)), - new RowDefinition { Height = GridLength.Auto } + new RowDefinition { Height = 30 } }, Children = { image, r18, pages, - title, + anime, - // stacklayout: user - new StackLayout + // stacklayout: title + new Grid { - Orientation = StackOrientation.Horizontal, + ColumnDefinitions = + { + new ColumnDefinition(), + new ColumnDefinition { Width = 20 } + }, + VerticalOptions = LayoutOptions.Center, Padding = new Thickness(0, 0, 8, 0), - Children = { title, favorite } + Children = + { + title.Binding(Label.TextProperty, nameof(IllustItem.Title)), + favorite.GridColumn(1) + } } .GridRow(1) } @@ -302,23 +353,31 @@ namespace Pixiview.Illust Content = new Grid { HorizontalOptions = LayoutOptions.Fill, + RowSpacing = 0, RowDefinitions = { new RowDefinition().Binding(RowDefinition.HeightProperty, nameof(IllustItem.ImageHeight)), - new RowDefinition { Height = GridLength.Auto }, - new RowDefinition { Height = GridLength.Auto } + new RowDefinition { Height = 30 }, + new RowDefinition { Height = 40 } }, Children = { image, r18, pages, - title.GridRow(1), + anime, + + title.Binding(Label.TextProperty, nameof(IllustItem.RankTitle)).GridRow(1), // stacklayout: user - new StackLayout + new Grid { - Orientation = StackOrientation.Horizontal, + ColumnDefinitions = + { + new ColumnDefinition { Width = 30 }, + new ColumnDefinition(), + new ColumnDefinition { Width = 20 } + }, Padding = new Thickness(8, 0, 8, 8), Children = { @@ -340,10 +399,11 @@ namespace Pixiview.Illust FontSize = StyleDefinition.FontSizeMicro } .Binding(Label.TextProperty, nameof(IllustItem.UserName)) - .DynamicResource(Label.TextColorProperty, ThemeBase.SubTextColor), + .DynamicResource(Label.TextColorProperty, ThemeBase.SubTextColor) + .GridColumn(1), // label: favorite - favorite + favorite.GridColumn(2) } } .GridRow(2) @@ -367,7 +427,9 @@ namespace Pixiview.Illust } if (force && IsFavoriteVisible) { - LastUpdated = DateTime.Now; + var now = DateTime.Now; + LastUpdated = now; + lastUpdated = now; } var data = DoGetIllustList(illustData, commandIllustImageTapped).Where(i => i != null); @@ -385,8 +447,7 @@ namespace Pixiview.Illust item.IsFavorite = favorites.Any(i => i.Id == item.Id); } } - IllustCollection = collection; - Illusts = collection; + DoIllustsLoaded(collection); IsLoading = false; DoLoadImages(collection); @@ -474,11 +535,20 @@ namespace Pixiview.Illust public List Illusts { get; set; } } + public enum IllustType + { + Illust = 0, + Manga = 1, + Anime = 2 + } + [JsonObject(MemberSerialization.OptIn)] public class IllustItem : BindableObject { public static readonly BindableProperty TitleProperty = BindableProperty.Create( nameof(Title), typeof(string), typeof(IllustItem)); + public static readonly BindableProperty RankTitleProperty = BindableProperty.Create( + nameof(RankTitle), typeof(string), typeof(IllustItem)); public static readonly BindableProperty ImageProperty = BindableProperty.Create( nameof(Image), typeof(ImageSource), typeof(IllustItem)); public static readonly BindableProperty ProfileImageProperty = BindableProperty.Create( @@ -487,6 +557,8 @@ namespace Pixiview.Illust nameof(ImageHeight), typeof(GridLength), typeof(IllustItem), GridLength.Auto); public static readonly BindableProperty IsFavoriteProperty = BindableProperty.Create( nameof(IsFavorite), typeof(bool), typeof(IllustItem)); + public static readonly BindableProperty IsPlayingProperty = BindableProperty.Create( + nameof(IsPlaying), typeof(bool), typeof(IllustItem)); [JsonProperty] public string Title @@ -494,6 +566,11 @@ namespace Pixiview.Illust get => (string)GetValue(TitleProperty); set => SetValue(TitleProperty, value); } + public string RankTitle + { + get => (string)GetValue(RankTitleProperty); + set => SetValue(RankTitleProperty, value); + } public ImageSource Image { get => (ImageSource)GetValue(ImageProperty); @@ -514,6 +591,11 @@ namespace Pixiview.Illust get => (bool)GetValue(IsFavoriteProperty); set => SetValue(IsFavoriteProperty, value); } + public bool IsPlaying + { + get => (bool)GetValue(IsPlayingProperty); + set => SetValue(IsPlayingProperty, value); + } public ICommand IllustTapped { get; set; } [JsonProperty] @@ -540,8 +622,19 @@ namespace Pixiview.Illust get => ImageHeight.IsAuto ? -1 : ImageHeight.Value; set => ImageHeight = value > 0 ? value : GridLength.Auto; } + [JsonProperty] + public int YesRank { get; set; } + [JsonProperty] + public int RatingCount { get; set; } + [JsonProperty] + public int ViewCount { get; set; } + [JsonProperty] + public long UploadTimestamp { get; set; } + [JsonProperty] + public IllustType IllustType { get; set; } public string PageCountText => $"{StyleDefinition.IconLayer} {PageCount}"; public bool IsPageVisible => PageCount > 1; + public bool IsAnimeVisible => IllustType == IllustType.Anime; } } diff --git a/Pixiview/Illust/RankingPage.xaml b/Pixiview/Illust/RankingPage.xaml index 6b3cb15..f6abfb8 100644 --- a/Pixiview/Illust/RankingPage.xaml +++ b/Pixiview/Illust/RankingPage.xaml @@ -1,31 +1,86 @@  - + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + +