diff --git a/Pixiview.iOS.OpenExtension/Info.plist b/Pixiview.iOS.OpenExtension/Info.plist
index 3f49fb8..b623152 100644
--- a/Pixiview.iOS.OpenExtension/Info.plist
+++ b/Pixiview.iOS.OpenExtension/Info.plist
@@ -29,8 +29,8 @@
com.apple.share-services
CFBundleShortVersionString
- 1.0.513
+ 1.0.514
CFBundleVersion
- 3
+ 4
diff --git a/Pixiview.iOS/Info.plist b/Pixiview.iOS/Info.plist
index 54c2bf4..220e760 100644
--- a/Pixiview.iOS/Info.plist
+++ b/Pixiview.iOS/Info.plist
@@ -79,8 +79,8 @@
CFBundleShortVersionString
- 1.0.513
+ 1.0.514
CFBundleVersion
- 3
+ 4
diff --git a/Pixiview.iOS/Renderers/AppShellRenderer.cs b/Pixiview.iOS/Renderers/AppShellRenderer.cs
index 4c39d54..aca7a8b 100644
--- a/Pixiview.iOS/Renderers/AppShellRenderer.cs
+++ b/Pixiview.iOS/Renderers/AppShellRenderer.cs
@@ -20,6 +20,7 @@ namespace Pixiview.iOS.Renderers
if (renderer is ShellSectionRenderer sr && Element is AppShell shell)
{
shell.SetNavigationBarHeight(sr.NavigationBar.Frame.Height);
+ shell.SetStatusBarHeight(UIApplication.SharedApplication.StatusBarFrame.Height);
}
return renderer;
}
diff --git a/Pixiview.iOS/Renderers/BlurryPanelRenderer.cs b/Pixiview.iOS/Renderers/BlurryPanelRenderer.cs
index 053de1f..16a723e 100644
--- a/Pixiview.iOS/Renderers/BlurryPanelRenderer.cs
+++ b/Pixiview.iOS/Renderers/BlurryPanelRenderer.cs
@@ -32,6 +32,7 @@ namespace Pixiview.iOS.Renderers
if (e.NewElement != null)
{
+ e.NewElement.BackgroundColor = Color.Default;
if (Control == null)
{
var blur = UIBlurEffect.FromStyle(UIBlurEffectStyle.SystemMaterial);
diff --git a/Pixiview/Illust/FavoritesPage.xaml.cs b/Pixiview/Illust/FavoritesPage.xaml.cs
index 75a4c19..b56b66f 100644
--- a/Pixiview/Illust/FavoritesPage.xaml.cs
+++ b/Pixiview/Illust/FavoritesPage.xaml.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Windows.Input;
using Pixiview.Resources;
using Pixiview.Utils;
using Xamarin.Essentials;
@@ -33,13 +31,9 @@ namespace Pixiview.Illust
});
}
- protected override IEnumerable DoGetIllustList(IllustItem[] data, ICommand command)
+ protected override IEnumerable DoGetIllustList(IllustItem[] data)
{
- return data.Select(i =>
- {
- i.IllustTapped = command;
- return i;
- });
+ return data;
}
protected override IllustItem[] DoLoadIllustData(bool force)
diff --git a/Pixiview/Illust/IllustCollectionPage.cs b/Pixiview/Illust/IllustCollectionPage.cs
index 37a239d..ff26838 100644
--- a/Pixiview/Illust/IllustCollectionPage.cs
+++ b/Pixiview/Illust/IllustCollectionPage.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using System.Windows.Input;
using Newtonsoft.Json;
using Pixiview.Resources;
using Pixiview.UI;
@@ -56,12 +55,12 @@ namespace Pixiview.Illust
public IllustCollection IllustCollection { get; set; }
protected virtual bool IsFavoriteVisible => true;
- protected virtual bool IsLazyload => false;
+ protected readonly Command commandIllustImageTapped;
protected DateTime lastUpdated;
+ protected double topOffset;
private T illustData;
private readonly ParallelOptions parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = Configs.MaxThreads };
- private readonly Command commandIllustImageTapped;
public IllustCollectionPage()
{
@@ -71,6 +70,10 @@ namespace Pixiview.Illust
private void IllustImageTapped(IllustItem illust)
{
+ if (illust == null)
+ {
+ return;
+ }
Start(() => OnIllustImageTapped(illust));
}
@@ -89,18 +92,11 @@ namespace Pixiview.Illust
if (lastUpdated != LastUpdated)
{
- if (IsLazyload)
- {
- Device.StartTimer(TimeSpan.FromMilliseconds(200), () =>
- {
- StartLoad();
- return false;
- });
- }
- else
+ Device.StartTimer(TimeSpan.FromMilliseconds(200), () =>
{
StartLoad();
- }
+ return false;
+ });
}
else if (IsFavoriteVisible && IllustCollection != null)
{
@@ -133,6 +129,7 @@ namespace Pixiview.Illust
{
base.OnSizeAllocated(width, height);
int columns;
+#if __IOS__
var oldMargin = PanelTopMargin;
Thickness newMargin;
if (StyleDefinition.IsFullscreenDevice)
@@ -140,22 +137,26 @@ namespace Pixiview.Illust
newMargin = width > height ?
AppShell.HalfNavigationBarOffset :
AppShell.NavigationBarOffset;
+ topOffset = width > height ?
+ AppShell.NavigationBarOffset.Top :
+ AppShell.TotalBarOffset.Top;
}
else if (isPhone)
{
-#if __IOS__
newMargin = width > height ?
StyleDefinition.TopOffset16 :
StyleDefinition.TopOffset32;
-#elif __ANDROID__
- newMargin = default;
-#endif
+ topOffset = width > height ?
+ StyleDefinition.TopOffset32.Top :
+ AppShell.TotalBarOffset.Top;
}
else
{
- // TODO ipad
- newMargin = StyleDefinition.TopOffset32;
+ // ipad
+ newMargin = StyleDefinition.TopOffset37;
+ topOffset = AppShell.TotalBarOffset.Top;
}
+#endif
if (width > height)
{
columns = isPhone ? 4 : 6;
@@ -164,11 +165,13 @@ namespace Pixiview.Illust
{
columns = isPhone ? 2 : 4;
}
+#if __IOS__
if (oldMargin != newMargin)
{
PanelTopMargin = newMargin;
OnPanelTopMarginChanged(oldMargin, newMargin);
}
+#endif
if (Columns != columns)
{
Columns = columns;
@@ -179,7 +182,7 @@ namespace Pixiview.Illust
#endregion
protected abstract T DoLoadIllustData(bool force);
- protected abstract IEnumerable DoGetIllustList(T data, ICommand command);
+ protected abstract IEnumerable DoGetIllustList(T data);
protected virtual void OnIllustImageTapped(IllustItem illust)
{
var page = new ViewIllustPage(illust, IsFavoriteVisible);
@@ -217,9 +220,11 @@ namespace Pixiview.Illust
Aspect = Aspect.AspectFill,
GestureRecognizers =
{
- new TapGestureRecognizer()
- .Binding(TapGestureRecognizer.CommandProperty, nameof(IllustItem.IllustTapped))
- .Binding(TapGestureRecognizer.CommandParameterProperty, ".")
+ new TapGestureRecognizer
+ {
+ Command = commandIllustImageTapped
+ }
+ .Binding(TapGestureRecognizer.CommandParameterProperty, ".")
}
}
.Binding(Image.SourceProperty, nameof(IllustItem.Image));
@@ -436,7 +441,7 @@ namespace Pixiview.Illust
lastUpdated = now;
}
- var data = DoGetIllustList(illustData, commandIllustImageTapped).Where(i => i != null);
+ var data = DoGetIllustList(illustData).Where(i => i != null);
var collection = new IllustCollection(data);
if (IsFavoriteVisible)
@@ -493,6 +498,13 @@ namespace Pixiview.Illust
#endregion
}
+ public enum ScrollDirection
+ {
+ Stop,
+ Up,
+ Down
+ }
+
public class IllustCollection : List
{
private static IllustCollection empty;
@@ -546,13 +558,29 @@ namespace Pixiview.Illust
Anime = 2
}
- [JsonObject(MemberSerialization.OptIn)]
- public class IllustItem : BindableObject
+ public interface IIllustUser
{
- //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));
+ string UserId { get; }
+ string UserName { get; }
+ ImageSource ProfileImage { get; }
+ }
+
+ [JsonObject(MemberSerialization.OptIn)]
+ public class IllustItem : BindableObject, IIllustUser
+ {
+ private static IllustItem empty;
+ public static IllustItem Empty
+ {
+ get
+ {
+ if (empty == null)
+ {
+ empty = new IllustItem();
+ }
+ return empty;
+ }
+ }
+
public static readonly BindableProperty ImageProperty = BindableProperty.Create(
nameof(Image), typeof(ImageSource), typeof(IllustItem));
public static readonly BindableProperty ProfileImageProperty = BindableProperty.Create(
@@ -561,20 +589,10 @@ 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 { get; set; }
- //{
- // get => (string)GetValue(TitleProperty);
- // set => SetValue(TitleProperty, value);
- //}
public string RankTitle { get; set; }
- //{
- // get => (string)GetValue(RankTitleProperty);
- // set => SetValue(RankTitleProperty, value);
- //}
public ImageSource Image
{
get => (ImageSource)GetValue(ImageProperty);
@@ -596,11 +614,6 @@ namespace Pixiview.Illust
set => SetValue(IsFavoriteProperty, value);
}
public bool IsPlaying { get; set; }
- //{
- // get => (bool)GetValue(IsPlayingProperty);
- // set => SetValue(IsPlayingProperty, value);
- //}
- public ICommand IllustTapped { get; set; }
[JsonProperty]
public string Id { get; set; }
diff --git a/Pixiview/OptionPage.xaml b/Pixiview/OptionPage.xaml
index 16fe1bc..9baf3ee 100644
--- a/Pixiview/OptionPage.xaml
+++ b/Pixiview/OptionPage.xaml
@@ -6,7 +6,7 @@
x:Class="Pixiview.OptionPage"
Title="{r:Text Option}">
+ BackgroundColor="{DynamicResource OptionBackColor}">
height ?
+ AppShell.NavigationBarOffset :
+ AppShell.TotalBarOffset;
+ }
+ else if (isPhone)
+ {
+ PageTopMargin = width > height ?
+ StyleDefinition.TopOffset32 :
+ AppShell.TotalBarOffset;
+ }
+ else
+ {
+ PageTopMargin = AppShell.TotalBarOffset;
+ }
+ }
+ }
+#endif
+
public virtual void OnPageTopMarginChanged(Thickness old, Thickness @new)
{
PageTopMarginChanged?.Invoke(this, new ThicknessEventArgs
diff --git a/Pixiview/UI/StyleDefinition.cs b/Pixiview/UI/StyleDefinition.cs
index 2be3425..d2c6400 100644
--- a/Pixiview/UI/StyleDefinition.cs
+++ b/Pixiview/UI/StyleDefinition.cs
@@ -10,6 +10,7 @@ namespace Pixiview.UI
public static readonly Thickness ScreenBottomPadding;
public static readonly Thickness TopOffset16 = new Thickness(0, 16, 0, 0);
public static readonly Thickness TopOffset32 = new Thickness(0, 32, 0, 0);
+ public static readonly Thickness TopOffset37 = new Thickness(0, 37, 0, 0);
public static readonly Color ColorLightShadow = Color.FromRgba(0, 0, 0, 0x20);
public static readonly Color ColorDeepShadow = Color.FromRgba(0, 0, 0, 0x50);
public static readonly Color ColorRedBackground = Color.FromRgb(0xfd, 0x43, 0x63);
@@ -42,13 +43,15 @@ namespace Pixiview.UI
public const string IconFavorite = "\uf02e";
public const string IconShare = "\uf35d";
public const string IconCaretDown = "\uf0d7";
- public const string IconCaretUp = "\uf0d8";
+ //public const string IconCaretUp = "\uf0d8";
public const string IconCircleCheck = "\uf058";
public const string IconPlay = "\uf04b";
+ public const string IconMore = "\uf142";
static StyleDefinition()
{
- if (IsFullscreenDevice)
+ _ = IsFullscreenDevice;
+ if (_isBottomPadding)
{
if (DeviceInfo.Idiom == DeviceIdiom.Phone)
{
@@ -61,6 +64,7 @@ namespace Pixiview.UI
}
}
+ private static bool _isBottomPadding;
private static bool? _isFullscreenDevice;
public static bool IsFullscreenDevice
{
@@ -78,6 +82,7 @@ namespace Pixiview.UI
{
// iPhone X
_isFullscreenDevice = true;
+ _isBottomPadding = true;
}
else if (model.StartsWith("iPhone"))
{
@@ -85,7 +90,9 @@ namespace Pixiview.UI
if (vs.Length == 2 && int.TryParse(vs[0], out int main) && int.TryParse(vs[1], out int sub))
{
// iPhone X/XS/XR or iPhone 11
- _isFullscreenDevice = (main == 10 && sub >= 6) || (main > 10);
+ var flag = (main == 10 && sub >= 6) || (main > 10);
+ _isFullscreenDevice = flag;
+ _isBottomPadding = flag;
}
else
{
@@ -95,18 +102,21 @@ namespace Pixiview.UI
else if (model.StartsWith("iPad8,"))
{
// iPad 11-inch or 12.9-inch (3rd+)
- _isFullscreenDevice = true;
+ //_isFullscreenDevice = true;
+ _isBottomPadding = true;
}
#if DEBUG
else
{
// iPad or Simulator
var name = DeviceInfo.Name;
- _isFullscreenDevice = name.StartsWith("iPhone X")
+ var flag = name.StartsWith("iPhone X")
|| name.StartsWith("iPhone 11")
|| name.StartsWith("iPad Pro (11-inch)")
|| name.StartsWith("iPad Pro (12.9-inch) (3rd generation)")
|| name.StartsWith("iPad Pro (12.9-inch) (4th generation)");
+ _isFullscreenDevice = flag;
+ _isBottomPadding = flag;
}
#endif
}
@@ -117,6 +127,7 @@ namespace Pixiview.UI
#else
// TODO:
_isFullscreenDevice = false;
+ _isBottomPadding = false;
#endif
if (_isFullscreenDevice == null)
{
diff --git a/Pixiview/UI/Theme/DarkTheme.cs b/Pixiview/UI/Theme/DarkTheme.cs
index 521b91b..b736eaa 100644
--- a/Pixiview/UI/Theme/DarkTheme.cs
+++ b/Pixiview/UI/Theme/DarkTheme.cs
@@ -34,8 +34,9 @@ namespace Pixiview.UI.Theme
Add(SubTextColor, Color.LightGray);
Add(CardBackgroundColor, Color.FromRgb(0x33, 0x33, 0x33));
Add(MaskColor, Color.FromRgba(0xff, 0xff, 0xff, 0x50));
- Add(NavColor, Color.Black);
+ Add(NavColor, Color.FromRgb(0x11, 0x11, 0x11));
Add(NavSelectedColor, Color.FromRgb(0x22, 0x22, 0x22));
+ Add(OptionBackColor, Color.Black);
Add(OptionTintColor, Color.FromRgb(0x11, 0x11, 0x11));
}
}
diff --git a/Pixiview/UI/Theme/LightTheme.cs b/Pixiview/UI/Theme/LightTheme.cs
index a068ce9..146d513 100644
--- a/Pixiview/UI/Theme/LightTheme.cs
+++ b/Pixiview/UI/Theme/LightTheme.cs
@@ -36,6 +36,7 @@ namespace Pixiview.UI.Theme
Add(MaskColor, Color.FromRgba(0, 0, 0, 0x50));
Add(NavColor, Color.FromRgb(0xf0, 0xf0, 0xf0));
Add(NavSelectedColor, Color.LightGray);
+ Add(OptionBackColor, Color.FromRgb(0xf0, 0xf0, 0xf0));
Add(OptionTintColor, Color.White);
}
}
diff --git a/Pixiview/UI/Theme/ThemeBase.cs b/Pixiview/UI/Theme/ThemeBase.cs
index 6ca2aa7..fb1f8f1 100644
--- a/Pixiview/UI/Theme/ThemeBase.cs
+++ b/Pixiview/UI/Theme/ThemeBase.cs
@@ -13,7 +13,9 @@ namespace Pixiview.UI.Theme
public const string FontIconOption = nameof(FontIconOption);
public const string FontIconFavorite = nameof(FontIconFavorite);
public const string FontIconShare = nameof(FontIconShare);
+ public const string FontIconMore = nameof(FontIconMore);
public const string IconCircleCheck = nameof(IconCircleCheck);
+ public const string IconCaretDown = nameof(IconCaretDown);
public const string StatusBarStyle = nameof(StatusBarStyle);
public const string WindowColor = nameof(WindowColor);
@@ -24,6 +26,7 @@ namespace Pixiview.UI.Theme
public const string MaskColor = nameof(MaskColor);
public const string NavColor = nameof(NavColor);
public const string NavSelectedColor = nameof(NavSelectedColor);
+ public const string OptionBackColor = nameof(OptionBackColor);
public const string OptionTintColor = nameof(OptionTintColor);
public const string IconLightFontFamily = nameof(IconLightFontFamily);
@@ -53,8 +56,10 @@ namespace Pixiview.UI.Theme
Add(FontIconOption, GetSolidIcon(StyleDefinition.IconOption, solidFontFamily));
Add(FontIconFavorite, GetSolidIcon(StyleDefinition.IconFavorite, solidFontFamily));
Add(FontIconShare, GetSolidIcon(StyleDefinition.IconShare, solidFontFamily));
+ Add(FontIconMore, GetSolidIcon(StyleDefinition.IconMore, regularFontFamily));
Add(IconCircleCheck, StyleDefinition.IconCircleCheck);
+ Add(IconCaretDown, StyleDefinition.IconCaretDown);
}
private FontImageSource GetSolidIcon(string icon, string family, Color color = default)
diff --git a/Pixiview/Utils/EnvironmentService.cs b/Pixiview/Utils/EnvironmentService.cs
index d77a1fc..1bff761 100644
--- a/Pixiview/Utils/EnvironmentService.cs
+++ b/Pixiview/Utils/EnvironmentService.cs
@@ -50,6 +50,10 @@ namespace Pixiview.Utils
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
Droid.MainActivity.Main.SetStatusBarColor(color.ToAndroid());
+ Droid.MainActivity.Main.Window.DecorView.SystemUiVisibility =
+ App.CurrentTheme == Xamarin.Essentials.AppTheme.Dark ?
+ Android.Views.StatusBarVisibility.Visible :
+ (Android.Views.StatusBarVisibility)Android.Views.SystemUiFlags.LightStatusBar;
}
#endif
}
diff --git a/Pixiview/Utils/Extensions.cs b/Pixiview/Utils/Extensions.cs
index cacc70b..dd65ad6 100644
--- a/Pixiview/Utils/Extensions.cs
+++ b/Pixiview/Utils/Extensions.cs
@@ -34,6 +34,12 @@ namespace Pixiview.Utils
Grid.SetColumn(view, column);
return view;
}
+
+ public static T GridColumnSpan(this T view, int columnSpan) where T : BindableObject
+ {
+ Grid.SetColumnSpan(view, columnSpan);
+ return view;
+ }
}
public static class Screen
diff --git a/Pixiview/Utils/IllustData.cs b/Pixiview/Utils/IllustData.cs
index 44e794b..8ff2985 100644
--- a/Pixiview/Utils/IllustData.cs
+++ b/Pixiview/Utils/IllustData.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Pixiview.Illust;
+using Xamarin.Forms;
namespace Pixiview.Utils
{
@@ -44,7 +45,7 @@ namespace Pixiview.Utils
public string x540;
}
- public IllustItem ConvertToItem()
+ public IllustItem ConvertToItem(ImageSource image = null)
{
return new IllustItem
{
@@ -52,6 +53,7 @@ namespace Pixiview.Utils
Title = illustTitle,
RankTitle = illustTitle,
IllustType = (IllustType)illustType,
+ Image = image,
ImageUrl = urls?.x360 ?? url,
IsRestrict = xRestrict == 1,
ProfileUrl = profileImageUrl,
diff --git a/Pixiview/Utils/Stores.cs b/Pixiview/Utils/Stores.cs
index d8c616f..05c23b3 100644
--- a/Pixiview/Utils/Stores.cs
+++ b/Pixiview/Utils/Stores.cs
@@ -16,7 +16,7 @@ namespace Pixiview.Utils
public static readonly string PersonalFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
#if __IOS__
public static readonly string CacheFolder = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
-#elif __ANDROID__
+#else
public static readonly string CacheFolder = FileSystem.CacheDirectory;
#endif
@@ -153,7 +153,7 @@ namespace Pixiview.Utils
}
else
{
- App.DebugError("read", $"file not found: {file}");
+ //App.DebugError("read", $"file not found: {file}");
return default;
}
try
@@ -434,16 +434,18 @@ namespace Pixiview.Utils
//public const string AcceptEncoding = "gzip, deflate";
public const string AcceptLanguage = "zh-cn";
- //public const string UserId = "53887721";
- //public const string Cookie =
- // "PHPSESSID=5sn8n049j5c18l0tlj91qrjhesgddhjv; " +
- // "a_type=0; b_type=1; c_type=29; d_type=2; " +
- // "p_ab_d_id=1021624041; p_ab_id=2; p_ab_id_2=0; " +
- // "privacy_policy_agreement=2; " +
- // "login_ever=yes; " +
- // "__cfduid=d84153bf70ae67315a8bc297299d39eb61588856027; " +
- // "first_visit_datetime_pc=2020-05-07+21%3A53%3A47; " +
- // "yuid_b=MYkIJXc";
+#if !TEST
+ public const string UserId = "53887721";
+ public const string Cookie =
+ "PHPSESSID=5sn8n049j5c18l0tlj91qrjhesgddhjv; " +
+ "a_type=0; b_type=1; c_type=29; d_type=2; " +
+ "p_ab_d_id=1021624041; p_ab_id=2; p_ab_id_2=0; " +
+ "privacy_policy_agreement=2; " +
+ "login_ever=yes; " +
+ "__cfduid=d84153bf70ae67315a8bc297299d39eb61588856027; " +
+ "first_visit_datetime_pc=2020-05-07+21%3A53%3A47; " +
+ "yuid_b=MYkIJXc";
+#else
public const string UserId = "2603358";
public const string Cookie =
"PHPSESSID=2603358_VHyGPeRaz7LpeoFkRsHvjXIpApCMb56a; " +
@@ -454,6 +456,7 @@ namespace Pixiview.Utils
"__cfduid=d9fa2d4d1ddd30db85ebb519f9855d2561587806747; " +
"first_visit_datetime_pc=2019-10-29+22%3A05%3A30; " +
"yuid_b=NgcXQWQ";
+#endif
public static string GetThumbnailUrl(string url)
{