diff --git a/Pixiview.Android/Pixiview.Android.csproj b/Pixiview.Android/Pixiview.Android.csproj index c0e89aa..488a753 100644 --- a/Pixiview.Android/Pixiview.Android.csproj +++ b/Pixiview.Android/Pixiview.Android.csproj @@ -79,6 +79,7 @@ + diff --git a/Pixiview.Android/Renderers/AdaptedPageRenderer.cs b/Pixiview.Android/Renderers/AdaptedPageRenderer.cs new file mode 100644 index 0000000..a99eef8 --- /dev/null +++ b/Pixiview.Android/Renderers/AdaptedPageRenderer.cs @@ -0,0 +1,43 @@ +using Android.Content; +using Pixiview.Droid.Renderers; +using Pixiview.UI; +using Xamarin.Forms; +using Xamarin.Forms.Platform.Android; + +[assembly: ExportRenderer(typeof(AdaptedPage), typeof(AdaptedPageRenderer))] +namespace Pixiview.Droid.Renderers +{ + public class AdaptedPageRenderer : PageRenderer + { + public AdaptedPageRenderer(Context context) : base(context) + { + } + + protected override void OnAttachedToWindow() + { + base.OnAttachedToWindow(); + + if (Element is AdaptedPage page) + { + page.OnLoad(); + } + } + + protected override void Dispose(bool disposing) + { + if (Element is AdaptedPage page) + { + page.OnUnload(); + } + + base.Dispose(disposing); + } + + //protected override void OnDetachedFromWindow() + //{ + // App.DebugPrint("detached from window"); + + // base.OnDetachedFromWindow(); + //} + } +} diff --git a/Pixiview/Illust/FavoritesPage.xaml b/Pixiview/Illust/FavoritesPage.xaml index 8bfd2c1..b82fe5e 100644 --- a/Pixiview/Illust/FavoritesPage.xaml +++ b/Pixiview/Illust/FavoritesPage.xaml @@ -18,12 +18,5 @@ Margin="16" RowSpacing="16" ColumnSpacing="16" ItemTemplate="{StaticResource cardView}"/> - - - diff --git a/Pixiview/Illust/FavoritesPage.xaml.cs b/Pixiview/Illust/FavoritesPage.xaml.cs index b56b66f..c1a48a6 100644 --- a/Pixiview/Illust/FavoritesPage.xaml.cs +++ b/Pixiview/Illust/FavoritesPage.xaml.cs @@ -43,7 +43,16 @@ namespace Pixiview.Illust { return null; } - return favorites.Illusts.ToArray(); + var illusts = favorites.Illusts; + for (var i = 0; i < illusts.Count; i++) + { + var item = illusts[i]; + if (item.RankTitle == null) + { + item.RankTitle = item.Title; + } + } + return illusts.ToArray(); } public void Reload(bool force = false) diff --git a/Pixiview/Illust/IllustCollectionPage.cs b/Pixiview/Illust/IllustCollectionPage.cs index ff26838..d47fc14 100644 --- a/Pixiview/Illust/IllustCollectionPage.cs +++ b/Pixiview/Illust/IllustCollectionPage.cs @@ -312,7 +312,7 @@ namespace Pixiview.Illust Margin = 0, CornerRadius = 10, ShadowColor = StyleDefinition.ColorLightShadow, - ShadowOffset = new Size(2, 2), + ShadowOffset = new Size(1, 1), Content = new Grid { HorizontalOptions = LayoutOptions.Fill, @@ -358,7 +358,7 @@ namespace Pixiview.Illust Margin = 0, CornerRadius = 10, ShadowColor = StyleDefinition.ColorLightShadow, - ShadowOffset = new Size(2, 2), + ShadowOffset = new Size(1, 1), Content = new Grid { HorizontalOptions = LayoutOptions.Fill, @@ -427,6 +427,7 @@ namespace Pixiview.Illust protected void DoLoadIllusts(bool force = false) { + App.DebugPrint($"start loading data, force: {force}"); illustData = DoLoadIllustData(force); if (illustData == null) { diff --git a/Pixiview/Illust/RankingPage.xaml.cs b/Pixiview/Illust/RankingPage.xaml.cs index 5d5539f..7b44108 100644 --- a/Pixiview/Illust/RankingPage.xaml.cs +++ b/Pixiview/Illust/RankingPage.xaml.cs @@ -98,13 +98,32 @@ namespace Pixiview.Illust InitializeComponent(); gridFilter.TranslationY = -100; panelFilter.TranslationY = -100; + } + public override void OnLoad() + { + SegmentDate = Preferences.Get(Configs.QueryModeKey, 0); + SegmentType = Preferences.Get(Configs.QueryTypeKey, 0); lastQueryKey = QueryKey; - queryDate = null; // $"{now.Year}{now.Month:00}{now.Day:00}"; + queryDate = Preferences.Get(Configs.QueryDateKey, null); currentPage = 1; - datePicker.MinimumDate = new DateTime(2007, 9, 13); MaximumDate = DateTime.Now; + + App.DebugPrint("page loaded."); + } + + protected override void OnDisappearing() + { + base.OnDisappearing(); + + // saving state + Preferences.Set(Configs.QueryModeKey, SegmentDate); + Preferences.Set(Configs.QueryTypeKey, SegmentType); + if (queryDate != null) + { + Preferences.Set(Configs.QueryDateKey, queryDate); + } } protected override void DoIllustsLoaded(IllustCollection collection) diff --git a/Pixiview/Resources/Languages/zh-CN.xml b/Pixiview/Resources/Languages/zh-CN.xml index 2ac36a5..6864f02 100644 --- a/Pixiview/Resources/Languages/zh-CN.xml +++ b/Pixiview/Resources/Languages/zh-CN.xml @@ -36,6 +36,7 @@ 保存原图 分享 浏览用户 + 相关推荐 成功保存图片到照片库。 原图已保存,是否继续? 无法识别该 URL。 diff --git a/Pixiview/Resources/ResourceHelper.cs b/Pixiview/Resources/ResourceHelper.cs index 273873e..7a800f0 100644 --- a/Pixiview/Resources/ResourceHelper.cs +++ b/Pixiview/Resources/ResourceHelper.cs @@ -20,6 +20,7 @@ namespace Pixiview.Resources public static string SaveOriginal => GetResource(nameof(SaveOriginal)); public static string Share => GetResource(nameof(Share)); public static string UserDetail => GetResource(nameof(UserDetail)); + public static string RelatedIllusts => GetResource(nameof(RelatedIllusts)); public static string SaveSuccess => GetResource(nameof(SaveSuccess)); public static string AlreadySavedQuestion => GetResource(nameof(AlreadySavedQuestion)); public static string InvalidUrl => GetResource(nameof(InvalidUrl)); diff --git a/Pixiview/UI/CardView.cs b/Pixiview/UI/CardView.cs index 6802a5f..1730b2f 100644 --- a/Pixiview/UI/CardView.cs +++ b/Pixiview/UI/CardView.cs @@ -10,7 +10,7 @@ namespace Pixiview.UI public static readonly BindableProperty ShadowColorProperty = BindableProperty.Create( nameof(ShadowColor), typeof(Color), typeof(CardView)); public static readonly BindableProperty ShadowRadiusProperty = BindableProperty.Create( - nameof(ShadowRadius), typeof(float), typeof(CardView), 5f); + nameof(ShadowRadius), typeof(float), typeof(CardView), 3f); public static readonly BindableProperty ShadowOffsetProperty = BindableProperty.Create( nameof(ShadowOffset), typeof(Size), typeof(CardView)); public static readonly BindableProperty RankProperty = BindableProperty.Create( diff --git a/Pixiview/UI/StyleDefinition.cs b/Pixiview/UI/StyleDefinition.cs index a5c05ed..b1bba58 100644 --- a/Pixiview/UI/StyleDefinition.cs +++ b/Pixiview/UI/StyleDefinition.cs @@ -41,7 +41,7 @@ namespace Pixiview.UI public const string IconLove = "\uf004"; public const string IconOption = "\uf013"; public const string IconFavorite = "\uf02e"; - public const string IconShare = "\uf35d"; + public const string IconShare = "\uf1e0"; public const string IconCaretDown = "\uf0d7"; //public const string IconCaretUp = "\uf0d8"; public const string IconCircleCheck = "\uf058"; diff --git a/Pixiview/Utils/Stores.cs b/Pixiview/Utils/Stores.cs index 05c23b3..7b24632 100644 --- a/Pixiview/Utils/Stores.cs +++ b/Pixiview/Utils/Stores.cs @@ -407,6 +407,9 @@ namespace Pixiview.Utils public const string IsProxiedKey = "isProxied"; public const string HostKey = "host"; public const string PortKey = "port"; + public const string QueryModeKey = "query_mode"; + public const string QueryTypeKey = "query_type"; + public const string QueryDateKey = "query_date"; public const int MaxThreads = 3; public const string Referer = "https://www.pixiv.net/"; @@ -434,7 +437,7 @@ namespace Pixiview.Utils //public const string AcceptEncoding = "gzip, deflate"; public const string AcceptLanguage = "zh-cn"; -#if !TEST +#if TEST public const string UserId = "53887721"; public const string Cookie = "PHPSESSID=5sn8n049j5c18l0tlj91qrjhesgddhjv; " +