UI adjustment, add json proxy
This commit is contained in:
parent
134affddaa
commit
6b28ade15a
@ -80,6 +80,8 @@
|
|||||||
<Compile Include="Renderers\SegmentedControlRenderer.cs" />
|
<Compile Include="Renderers\SegmentedControlRenderer.cs" />
|
||||||
<Compile Include="Effects\LongPressEffectImplement.cs" />
|
<Compile Include="Effects\LongPressEffectImplement.cs" />
|
||||||
<Compile Include="Renderers\OptionEntryRenderer.cs" />
|
<Compile Include="Renderers\OptionEntryRenderer.cs" />
|
||||||
|
<Compile Include="Renderers\AppShellSection\AppAppearanceTracker.cs" />
|
||||||
|
<Compile Include="Renderers\BlurryPanelRenderer.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
|
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
|
||||||
|
@ -85,6 +85,7 @@ namespace Pixiview.iOS.Renderers
|
|||||||
}
|
}
|
||||||
if (Element is AdaptedPage page)
|
if (Element is AdaptedPage page)
|
||||||
{
|
{
|
||||||
|
AppShell.Current?.SetStatusBarHeight(UIApplication.SharedApplication.StatusBarFrame.Height);
|
||||||
page.OnOrientationChanged((Orientation)lastOrientation);
|
page.OnOrientationChanged((Orientation)lastOrientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,28 +16,10 @@ namespace Pixiview.iOS.Renderers
|
|||||||
|
|
||||||
protected override IShellSectionRenderer CreateShellSectionRenderer(ShellSection shellSection)
|
protected override IShellSectionRenderer CreateShellSectionRenderer(ShellSection shellSection)
|
||||||
{
|
{
|
||||||
var renderer = new AppShellSectionRenderer(this);
|
var renderer = base.CreateShellSectionRenderer(shellSection); // new AppShellSectionRenderer(this);
|
||||||
if (renderer is ShellSectionRenderer sr && Element is AppShell shell)
|
if (renderer is ShellSectionRenderer sr && Element is AppShell shell)
|
||||||
{
|
{
|
||||||
shell.SetNavigationBarHeight(
|
shell.SetNavigationBarHeight(sr.NavigationBar.Frame.Height);
|
||||||
sr.NavigationBar.Frame.Height,
|
|
||||||
UIApplication.SharedApplication.StatusBarFrame.Height);
|
|
||||||
}
|
|
||||||
return renderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
[SuppressMessage("Code Notifications", "XI0002:Notifies you from using newer Apple APIs when targeting an older OS version", Justification = "<Pending>")]
|
|
||||||
protected override IShellItemRenderer CreateShellItemRenderer(ShellItem item)
|
|
||||||
{
|
|
||||||
var renderer = base.CreateShellItemRenderer(item);
|
|
||||||
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
|
|
||||||
{
|
|
||||||
if (renderer.ViewController is UITabBarController controller)
|
|
||||||
{
|
|
||||||
var tabBar = controller.TabBar;
|
|
||||||
tabBar.TintColor = UIColor.LabelColor;
|
|
||||||
tabBar.UnselectedItemTintColor = UIColor.SecondaryLabelColor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
@ -52,6 +34,11 @@ namespace Pixiview.iOS.Renderers
|
|||||||
return new AppShellTabBarAppearanceTracker();
|
return new AppShellTabBarAppearanceTracker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override IShellNavBarAppearanceTracker CreateNavBarAppearanceTracker()
|
||||||
|
{
|
||||||
|
return new AppShellNavBarAppearanceTracker();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateBackgroundColor()
|
protected override void UpdateBackgroundColor()
|
||||||
{
|
{
|
||||||
NativeView.BackgroundColor = Color.Transparent.ToUIColor();
|
NativeView.BackgroundColor = Color.Transparent.ToUIColor();
|
||||||
@ -76,73 +63,6 @@ namespace Pixiview.iOS.Renderers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AppShellTabBarAppearanceTracker : IShellTabBarAppearanceTracker
|
|
||||||
{
|
|
||||||
UIColor _defaultBarTint;
|
|
||||||
UIColor _defaultTint;
|
|
||||||
UIColor _defaultUnselectedTint;
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ResetAppearance(UITabBarController controller)
|
|
||||||
{
|
|
||||||
if (_defaultTint == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var tabBar = controller.TabBar;
|
|
||||||
tabBar.BarTintColor = _defaultBarTint;
|
|
||||||
tabBar.TintColor = _defaultTint;
|
|
||||||
tabBar.UnselectedItemTintColor = _defaultUnselectedTint;
|
|
||||||
}
|
|
||||||
|
|
||||||
[SuppressMessage("Code Notifications", "XI0002:Notifies you from using newer Apple APIs when targeting an older OS version", Justification = "<Pending>")]
|
|
||||||
public void SetAppearance(UITabBarController controller, ShellAppearance appearance)
|
|
||||||
{
|
|
||||||
IShellAppearanceElement appearanceElement = appearance;
|
|
||||||
//var backgroundColor = appearanceElement.EffectiveTabBarBackgroundColor;
|
|
||||||
var unselectedColor = appearanceElement.EffectiveTabBarUnselectedColor;
|
|
||||||
var tintColor = appearanceElement.EffectiveTabBarForegroundColor; // appearanceElement.EffectiveTabBarTitleColor;
|
|
||||||
|
|
||||||
var tabBar = controller.TabBar;
|
|
||||||
//bool operatingSystemSupportsUnselectedTint = Forms.IsiOS10OrNewer;
|
|
||||||
|
|
||||||
if (_defaultTint == null)
|
|
||||||
{
|
|
||||||
_defaultBarTint = tabBar.BarTintColor;
|
|
||||||
_defaultTint = tabBar.TintColor;
|
|
||||||
|
|
||||||
//if (operatingSystemSupportsUnselectedTint)
|
|
||||||
{
|
|
||||||
_defaultUnselectedTint = tabBar.UnselectedItemTintColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (!backgroundColor.IsDefault)
|
|
||||||
// tabBar.BarTintColor = backgroundColor.ToUIColor();
|
|
||||||
|
|
||||||
if (!tintColor.IsDefault)
|
|
||||||
tabBar.TintColor = tintColor.ToUIColor();
|
|
||||||
//if (operatingSystemSupportsUnselectedTint)
|
|
||||||
{
|
|
||||||
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
|
|
||||||
{
|
|
||||||
//tabBar.UnselectedItemTintColor = UIColor.TertiaryLabelColor;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!unselectedColor.IsDefault)
|
|
||||||
tabBar.UnselectedItemTintColor = unselectedColor.ToUIColor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateLayout(UITabBarController controller)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AppShellSectionRenderer : ShellSectionRenderer
|
public class AppShellSectionRenderer : ShellSectionRenderer
|
||||||
{
|
{
|
||||||
public AppShellSectionRenderer(IShellContext context) : base(context)
|
public AppShellSectionRenderer(IShellContext context) : base(context)
|
||||||
|
86
Pixiview.iOS/Renderers/BlurryPanelRenderer.cs
Normal file
86
Pixiview.iOS/Renderers/BlurryPanelRenderer.cs
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
using CoreAnimation;
|
||||||
|
using Pixiview.iOS.Renderers;
|
||||||
|
using Pixiview.UI;
|
||||||
|
using UIKit;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Platform.iOS;
|
||||||
|
|
||||||
|
[assembly: ExportRenderer(typeof(BlurryPanel), typeof(BlurryPanelRenderer))]
|
||||||
|
namespace Pixiview.iOS.Renderers
|
||||||
|
{
|
||||||
|
public class BlurryPanelRenderer : ViewRenderer<BlurryPanel, UIVisualEffectView>
|
||||||
|
{
|
||||||
|
private UIVisualEffectView nativeControl;
|
||||||
|
private CALayer bottom;
|
||||||
|
|
||||||
|
protected override void OnElementChanged(ElementChangedEventArgs<BlurryPanel> e)
|
||||||
|
{
|
||||||
|
base.OnElementChanged(e);
|
||||||
|
|
||||||
|
if (e.OldElement != null)
|
||||||
|
{
|
||||||
|
if (bottom != null)
|
||||||
|
{
|
||||||
|
if (bottom.SuperLayer != null)
|
||||||
|
{
|
||||||
|
bottom.RemoveFromSuperLayer();
|
||||||
|
}
|
||||||
|
bottom.Dispose();
|
||||||
|
bottom = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.NewElement != null)
|
||||||
|
{
|
||||||
|
if (Control == null)
|
||||||
|
{
|
||||||
|
var blur = UIBlurEffect.FromStyle(UIBlurEffectStyle.SystemMaterial);
|
||||||
|
nativeControl = new UIVisualEffectView(blur)
|
||||||
|
{
|
||||||
|
Frame = Frame
|
||||||
|
};
|
||||||
|
SetNativeControl(nativeControl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LayoutSubviews()
|
||||||
|
{
|
||||||
|
base.LayoutSubviews();
|
||||||
|
|
||||||
|
if (nativeControl != null)
|
||||||
|
{
|
||||||
|
if (bottom == null)
|
||||||
|
{
|
||||||
|
bottom = new CALayer
|
||||||
|
{
|
||||||
|
BackgroundColor = UIColor.White.CGColor,
|
||||||
|
ShadowColor = UIColor.Black.CGColor,
|
||||||
|
ShadowOpacity = 1.0f
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (bottom.SuperLayer == null)
|
||||||
|
{
|
||||||
|
nativeControl.Layer.InsertSublayer(bottom, 0);
|
||||||
|
}
|
||||||
|
bottom.Frame = new CoreGraphics.CGRect(0, Frame.Height - 5, Frame.Width, 5);
|
||||||
|
nativeControl.Frame = Frame;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (bottom != null)
|
||||||
|
{
|
||||||
|
if (bottom.SuperLayer != null)
|
||||||
|
{
|
||||||
|
bottom.RemoveFromSuperLayer();
|
||||||
|
}
|
||||||
|
bottom.Dispose();
|
||||||
|
bottom = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using Pixiview.iOS.Renderers;
|
||||||
using Pixiview.iOS.Renderers;
|
|
||||||
using Pixiview.UI;
|
using Pixiview.UI;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Platform.iOS;
|
using Xamarin.Forms.Platform.iOS;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -9,9 +9,11 @@ namespace Pixiview
|
|||||||
public static new AppShell Current => Shell.Current as AppShell;
|
public static new AppShell Current => Shell.Current as AppShell;
|
||||||
|
|
||||||
public static Thickness NavigationBarOffset { get; private set; }
|
public static Thickness NavigationBarOffset { get; private set; }
|
||||||
|
public static Thickness HalfNavigationBarOffset { get; private set; }
|
||||||
public static Thickness TotalBarOffset { get; private set; }
|
public static Thickness TotalBarOffset { get; private set; }
|
||||||
|
|
||||||
public event EventHandler<BarHeightEventArgs> NavigationBarHeightChanged;
|
public event EventHandler<BarHeightEventArgs> NavigationBarHeightChanged;
|
||||||
|
public event EventHandler<BarHeightEventArgs> StatusBarHeightChanged;
|
||||||
|
|
||||||
public AppShell()
|
public AppShell()
|
||||||
{
|
{
|
||||||
@ -20,15 +22,24 @@ namespace Pixiview
|
|||||||
App.DebugPrint($"folder: {Stores.PersonalFolder}");
|
App.DebugPrint($"folder: {Stores.PersonalFolder}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNavigationBarHeight(double height, double statusHeight)
|
public void SetNavigationBarHeight(double height)
|
||||||
{
|
{
|
||||||
NavigationBarOffset = new Thickness(0, height, 0, 0);
|
NavigationBarOffset = new Thickness(0, height, 0, 0);
|
||||||
TotalBarOffset = new Thickness(0, height + statusHeight, 0, 0);
|
HalfNavigationBarOffset = new Thickness(0, height / 2, 0, 0);
|
||||||
|
|
||||||
NavigationBarHeightChanged?.Invoke(this, new BarHeightEventArgs
|
NavigationBarHeightChanged?.Invoke(this, new BarHeightEventArgs
|
||||||
{
|
{
|
||||||
NavigationBarHeight = height,
|
NavigationBarHeight = height
|
||||||
StatusBarHeight = statusHeight
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetStatusBarHeight(double height)
|
||||||
|
{
|
||||||
|
TotalBarOffset = new Thickness(0, NavigationBarOffset.Top + height, 0, 0);
|
||||||
|
|
||||||
|
StatusBarHeightChanged?.Invoke(this, new BarHeightEventArgs
|
||||||
|
{
|
||||||
|
StatusBarHeight = height
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ namespace Pixiview.Illust
|
|||||||
public IllustCollection IllustCollection { get; set; }
|
public IllustCollection IllustCollection { get; set; }
|
||||||
|
|
||||||
protected virtual bool IsFavoriteVisible => true;
|
protected virtual bool IsFavoriteVisible => true;
|
||||||
|
protected virtual bool IsLazyload => false;
|
||||||
protected DateTime lastUpdated;
|
protected DateTime lastUpdated;
|
||||||
|
|
||||||
private T illustData;
|
private T illustData;
|
||||||
@ -87,9 +88,20 @@ namespace Pixiview.Illust
|
|||||||
|
|
||||||
if (lastUpdated != LastUpdated)
|
if (lastUpdated != LastUpdated)
|
||||||
{
|
{
|
||||||
StartLoad();
|
if (IsLazyload)
|
||||||
|
{
|
||||||
|
Device.StartTimer(TimeSpan.FromMilliseconds(200), () =>
|
||||||
|
{
|
||||||
|
StartLoad();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StartLoad();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (IsFavoriteVisible)
|
else if (IsFavoriteVisible && IllustCollection != null)
|
||||||
{
|
{
|
||||||
var favorites = Stores.Favorites;
|
var favorites = Stores.Favorites;
|
||||||
foreach (var item in IllustCollection)
|
foreach (var item in IllustCollection)
|
||||||
@ -120,13 +132,19 @@ namespace Pixiview.Illust
|
|||||||
{
|
{
|
||||||
base.OnSizeAllocated(width, height);
|
base.OnSizeAllocated(width, height);
|
||||||
int columns;
|
int columns;
|
||||||
if (isPhone)
|
if (width > height)
|
||||||
{
|
{
|
||||||
columns = width > height ? 4 : 2;
|
PanelTopMargin = StyleDefinition.IsFullscreenDevice ?
|
||||||
|
AppShell.HalfNavigationBarOffset :
|
||||||
|
StyleDefinition.TopOffset16;
|
||||||
|
columns = isPhone ? 4 : 6;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
columns = width > height ? 6 : 4;
|
PanelTopMargin = StyleDefinition.IsFullscreenDevice ?
|
||||||
|
AppShell.NavigationBarOffset :
|
||||||
|
StyleDefinition.TopOffset32;
|
||||||
|
columns = isPhone ? 2 : 4;
|
||||||
}
|
}
|
||||||
if (Columns != columns)
|
if (Columns != columns)
|
||||||
{
|
{
|
||||||
|
@ -5,21 +5,24 @@
|
|||||||
xmlns:u="clr-namespace:Pixiview.UI"
|
xmlns:u="clr-namespace:Pixiview.UI"
|
||||||
xmlns:r="clr-namespace:Pixiview.Resources"
|
xmlns:r="clr-namespace:Pixiview.Resources"
|
||||||
x:Class="Pixiview.Illust.RankingPage"
|
x:Class="Pixiview.Illust.RankingPage"
|
||||||
BackgroundColor="{DynamicResource WindowColor}">
|
BackgroundColor="{DynamicResource WindowColor}"
|
||||||
|
Shell.NavBarHasShadow="False">
|
||||||
<ContentPage.ToolbarItems>
|
<ContentPage.ToolbarItems>
|
||||||
<ToolbarItem Order="Primary" Clicked="Refresh_Clicked"
|
<ToolbarItem Order="Primary" Clicked="Refresh_Clicked"
|
||||||
IconImageSource="{DynamicResource FontIconRefresh}"/>
|
IconImageSource="{DynamicResource FontIconRefresh}"/>
|
||||||
</ContentPage.ToolbarItems>
|
</ContentPage.ToolbarItems>
|
||||||
<Grid Padding="{Binding PageTopMargin}">
|
<Grid>
|
||||||
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||||
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
||||||
HorizontalOptions="Fill" Column="{Binding Columns}"
|
HorizontalOptions="Fill" Column="{Binding Columns}"
|
||||||
Margin="16, 10, 16, 16" RowSpacing="16" ColumnSpacing="16"
|
Margin="16, 62, 16, 16" RowSpacing="16" ColumnSpacing="16"
|
||||||
ItemTemplate="{StaticResource cardView}"/>
|
ItemTemplate="{StaticResource cardView}"/>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<SearchBar Placeholder="{r:Text Search}" VerticalOptions="Start"
|
<u:BlurryPanel VerticalOptions="Start" HeightRequest="50" Margin="{Binding PanelTopMargin}"/>
|
||||||
Margin="0, -46, 0, 0" HeightRequest="50"
|
<SearchBar Placeholder="{r:Text Search}" HeightRequest="50"
|
||||||
BackgroundColor="{DynamicResource WindowColor}"
|
VerticalOptions="Start"
|
||||||
|
Margin="{Binding PageTopMargin}"
|
||||||
|
BackgroundColor="Transparent"
|
||||||
CancelButtonColor="{DynamicResource TintColor}"
|
CancelButtonColor="{DynamicResource TintColor}"
|
||||||
Text="{Binding Keywords, Mode=TwoWay}"
|
Text="{Binding Keywords, Mode=TwoWay}"
|
||||||
SearchButtonPressed="SearchBar_SearchButtonPressed"
|
SearchButtonPressed="SearchBar_SearchButtonPressed"
|
||||||
|
@ -26,28 +26,7 @@ namespace Pixiview.Illust
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnOrientationChanged(Orientation orientation)
|
protected override bool IsLazyload => true;
|
||||||
{
|
|
||||||
switch (orientation)
|
|
||||||
{
|
|
||||||
case Orientation.Portrait:
|
|
||||||
PageTopMargin = new Thickness(0, AppShell.TotalBarOffset.Top + 50, 0, 0);
|
|
||||||
break;
|
|
||||||
case Orientation.PortraitUpsideDown:
|
|
||||||
//PageTopMargin = isPhone ?
|
|
||||||
// new Thickness(0, AppShell.NavigationBarOffset.Top + 50, 0, 0) :
|
|
||||||
// new Thickness(0, AppShell.TotalBarOffset.Top + 50, 0, 0);
|
|
||||||
//break;
|
|
||||||
case Orientation.Unknown:
|
|
||||||
case Orientation.LandscapeLeft:
|
|
||||||
case Orientation.LandscapeRight:
|
|
||||||
default:
|
|
||||||
PageTopMargin = isPhone ?
|
|
||||||
new Thickness(0, AppShell.NavigationBarOffset.Top + 50, 0, 0) :
|
|
||||||
new Thickness(0, AppShell.TotalBarOffset.Top + 50, 0, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override IEnumerable<IllustItem> DoGetIllustList(IllustData data, ICommand command)
|
protected override IEnumerable<IllustItem> DoGetIllustList(IllustData data, ICommand command)
|
||||||
{
|
{
|
||||||
|
@ -11,14 +11,15 @@
|
|||||||
<ToolbarItem Order="Primary" Clicked="Refresh_Clicked"
|
<ToolbarItem Order="Primary" Clicked="Refresh_Clicked"
|
||||||
IconImageSource="{DynamicResource FontIconRefresh}"/>
|
IconImageSource="{DynamicResource FontIconRefresh}"/>
|
||||||
</ContentPage.ToolbarItems>
|
</ContentPage.ToolbarItems>
|
||||||
<Grid Padding="{Binding PageTopMargin}">
|
<Grid>
|
||||||
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||||
|
|
||||||
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
||||||
HorizontalOptions="Fill" Column="{Binding Columns}"
|
HorizontalOptions="Fill" Column="{Binding Columns}"
|
||||||
Margin="16, 6, 16, 16" RowSpacing="16" ColumnSpacing="16"
|
Margin="16" RowSpacing="16" ColumnSpacing="16"
|
||||||
ItemTemplate="{StaticResource cardView}"/>
|
ItemTemplate="{StaticResource cardView}"/>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<Grid Margin="0, -40, 0, 0" VerticalOptions="Start" HeightRequest="40">
|
<!--<Grid Margin="0, -40, 0, 0" VerticalOptions="Start" HeightRequest="40">
|
||||||
<u:SegmentedControl VerticalOptions="Center" HorizontalOptions="Center"
|
<u:SegmentedControl VerticalOptions="Center" HorizontalOptions="Center"
|
||||||
HeightRequest="30"
|
HeightRequest="30"
|
||||||
BackgroundColor="{DynamicResource WindowColor}"
|
BackgroundColor="{DynamicResource WindowColor}"
|
||||||
@ -30,7 +31,7 @@
|
|||||||
<u:SegmentedControlOption Text="{r:Text ByUser}"/>
|
<u:SegmentedControlOption Text="{r:Text ByUser}"/>
|
||||||
</u:SegmentedControl.Children>
|
</u:SegmentedControl.Children>
|
||||||
</u:SegmentedControl>
|
</u:SegmentedControl>
|
||||||
</Grid>
|
</Grid>-->
|
||||||
<Frame HasShadow="False" Margin="0" Padding="20" CornerRadius="8"
|
<Frame HasShadow="False" Margin="0" Padding="20" CornerRadius="8"
|
||||||
IsVisible="{Binding IsLoading}"
|
IsVisible="{Binding IsLoading}"
|
||||||
HorizontalOptions="Center" VerticalOptions="Center"
|
HorizontalOptions="Center" VerticalOptions="Center"
|
||||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Pixiview.UI;
|
|
||||||
using Pixiview.Utils;
|
using Pixiview.Utils;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
@ -32,29 +31,6 @@ namespace Pixiview.Illust
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnOrientationChanged(Orientation orientation)
|
|
||||||
{
|
|
||||||
switch (orientation)
|
|
||||||
{
|
|
||||||
case Orientation.Portrait:
|
|
||||||
PageTopMargin = new Thickness(0, AppShell.TotalBarOffset.Top + 40, 0, 0);
|
|
||||||
break;
|
|
||||||
case Orientation.PortraitUpsideDown:
|
|
||||||
//PageTopMargin = isPhone ?
|
|
||||||
// new Thickness(0, AppShell.NavigationBarOffset.Top + 40, 0, 0) :
|
|
||||||
// new Thickness(0, AppShell.TotalBarOffset.Top + 40, 0, 0);
|
|
||||||
//break;
|
|
||||||
case Orientation.Unknown:
|
|
||||||
case Orientation.LandscapeLeft:
|
|
||||||
case Orientation.LandscapeRight:
|
|
||||||
default:
|
|
||||||
PageTopMargin = isPhone ?
|
|
||||||
new Thickness(0, AppShell.NavigationBarOffset.Top + 40, 0, 0) :
|
|
||||||
new Thickness(0, AppShell.TotalBarOffset.Top + 40, 0, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override IEnumerable<IllustItem> DoGetIllustList(IllustData data, ICommand command)
|
protected override IEnumerable<IllustItem> DoGetIllustList(IllustData data, ICommand command)
|
||||||
{
|
{
|
||||||
if (SegmentIndex == 1)
|
if (SegmentIndex == 1)
|
||||||
|
@ -90,6 +90,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)UI\Theme\DarkTheme.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)UI\Theme\DarkTheme.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)UI\Theme\LightTheme.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)UI\Theme\LightTheme.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)UI\Theme\ThemeBase.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)UI\Theme\ThemeBase.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)UI\BlurryPanel.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="$(MSBuildThisFileDirectory)Illust\" />
|
<Folder Include="$(MSBuildThisFileDirectory)Illust\" />
|
||||||
|
@ -10,12 +10,19 @@ namespace Pixiview.UI
|
|||||||
{
|
{
|
||||||
public static readonly BindableProperty PageTopMarginProperty = BindableProperty.Create(
|
public static readonly BindableProperty PageTopMarginProperty = BindableProperty.Create(
|
||||||
nameof(PageTopMargin), typeof(Thickness), typeof(AdaptedPage));
|
nameof(PageTopMargin), typeof(Thickness), typeof(AdaptedPage));
|
||||||
|
public static readonly BindableProperty PanelTopMarginProperty = BindableProperty.Create(
|
||||||
|
nameof(PanelTopMargin), typeof(Thickness), typeof(AdaptedPage));
|
||||||
|
|
||||||
public Thickness PageTopMargin
|
public Thickness PageTopMargin
|
||||||
{
|
{
|
||||||
get => (Thickness)GetValue(PageTopMarginProperty);
|
get => (Thickness)GetValue(PageTopMarginProperty);
|
||||||
protected set => SetValue(PageTopMarginProperty, value);
|
protected set => SetValue(PageTopMarginProperty, value);
|
||||||
}
|
}
|
||||||
|
public Thickness PanelTopMargin
|
||||||
|
{
|
||||||
|
get => (Thickness)GetValue(PanelTopMarginProperty);
|
||||||
|
protected set => SetValue(PanelTopMarginProperty, value);
|
||||||
|
}
|
||||||
public Orientation CurrentOrientation { get; private set; }
|
public Orientation CurrentOrientation { get; private set; }
|
||||||
|
|
||||||
public event EventHandler Load;
|
public event EventHandler Load;
|
||||||
@ -48,13 +55,18 @@ namespace Pixiview.UI
|
|||||||
PageTopMargin = AppShell.TotalBarOffset;
|
PageTopMargin = AppShell.TotalBarOffset;
|
||||||
break;
|
break;
|
||||||
case Orientation.PortraitUpsideDown:
|
case Orientation.PortraitUpsideDown:
|
||||||
//PageTopMargin = isPhone ? AppShell.NavigationBarOffset : AppShell.TotalBarOffset;
|
|
||||||
//break;
|
|
||||||
case Orientation.Unknown:
|
case Orientation.Unknown:
|
||||||
case Orientation.LandscapeLeft:
|
case Orientation.LandscapeLeft:
|
||||||
case Orientation.LandscapeRight:
|
case Orientation.LandscapeRight:
|
||||||
default:
|
default:
|
||||||
PageTopMargin = isPhone ? AppShell.NavigationBarOffset : AppShell.TotalBarOffset;
|
if (StyleDefinition.IsFullscreenDevice)
|
||||||
|
{
|
||||||
|
PageTopMargin = AppShell.NavigationBarOffset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PageTopMargin = isPhone ? StyleDefinition.TopOffset32 : AppShell.TotalBarOffset;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
OrientationChanged?.Invoke(this, new OrientationEventArgs { CurrentOrientation = orientation });
|
OrientationChanged?.Invoke(this, new OrientationEventArgs { CurrentOrientation = orientation });
|
||||||
|
8
Pixiview/UI/BlurryPanel.cs
Normal file
8
Pixiview/UI/BlurryPanel.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Pixiview.UI
|
||||||
|
{
|
||||||
|
public class BlurryPanel : ContentView
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,8 @@ namespace Pixiview.UI
|
|||||||
public const double FontSizeTitle = 18.0;
|
public const double FontSizeTitle = 18.0;
|
||||||
|
|
||||||
public static readonly Thickness ScreenBottomPadding;
|
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 Color ColorLightShadow = Color.FromRgba(0, 0, 0, 0x20);
|
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 ColorDeepShadow = Color.FromRgba(0, 0, 0, 0x50);
|
||||||
public static readonly Color ColorRedBackground = Color.FromRgb(0xfd, 0x43, 0x63);
|
public static readonly Color ColorRedBackground = Color.FromRgb(0xfd, 0x43, 0x63);
|
||||||
|
@ -29,7 +29,7 @@ namespace Pixiview.UI.Theme
|
|||||||
{
|
{
|
||||||
Add(StatusBarStyle, StatusBarStyles.WhiteText);
|
Add(StatusBarStyle, StatusBarStyles.WhiteText);
|
||||||
Add(WindowColor, Color.Black);
|
Add(WindowColor, Color.Black);
|
||||||
Add(TintColor, Color.FromRgb(0x00, 0x96, 0xfa));
|
Add(TintColor, Color.FromRgb(0x94, 0x95, 0x9a));
|
||||||
Add(TextColor, Color.White);
|
Add(TextColor, Color.White);
|
||||||
Add(SubTextColor, Color.LightGray);
|
Add(SubTextColor, Color.LightGray);
|
||||||
Add(CardBackgroundColor, Color.FromRgb(0x33, 0x33, 0x33));
|
Add(CardBackgroundColor, Color.FromRgb(0x33, 0x33, 0x33));
|
||||||
|
@ -29,7 +29,7 @@ namespace Pixiview.UI.Theme
|
|||||||
{
|
{
|
||||||
Add(StatusBarStyle, StatusBarStyles.DarkText);
|
Add(StatusBarStyle, StatusBarStyles.DarkText);
|
||||||
Add(WindowColor, Color.White);
|
Add(WindowColor, Color.White);
|
||||||
Add(TintColor, Color.FromRgb(0x00, 0x96, 0xfa)); // 0x7f, 0x99, 0xc6
|
Add(TintColor, Color.FromRgb(0x87, 0x87, 0x8b)); // 0x7f, 0x99, 0xc6
|
||||||
Add(TextColor, Color.Black);
|
Add(TextColor, Color.Black);
|
||||||
Add(SubTextColor, Color.DimGray);
|
Add(SubTextColor, Color.DimGray);
|
||||||
Add(CardBackgroundColor, Color.FromRgb(0xf0, 0xf3, 0xf3));
|
Add(CardBackgroundColor, Color.FromRgb(0xf0, 0xf3, 0xf3));
|
||||||
|
@ -118,10 +118,10 @@ namespace Pixiview.Utils
|
|||||||
{
|
{
|
||||||
headers.Referrer = new Uri(referer);
|
headers.Referrer = new Uri(referer);
|
||||||
}
|
}
|
||||||
headers.Add("user-agent", Configs.UserAgent);
|
headers.Add("User-Agent", Configs.UserAgent);
|
||||||
headers.Add("accept", Configs.AcceptJson);
|
headers.Add("Accept", Configs.AcceptJson);
|
||||||
headers.Add("cookie", Configs.Cookie);
|
headers.Add("Cookie", Configs.Cookie);
|
||||||
headers.Add("x-user-id", Configs.UserId);
|
headers.Add("X-User-Id", Configs.UserId);
|
||||||
});
|
});
|
||||||
if (response == null)
|
if (response == null)
|
||||||
{
|
{
|
||||||
@ -393,8 +393,8 @@ namespace Pixiview.Utils
|
|||||||
var response = Download(url, headers =>
|
var response = Download(url, headers =>
|
||||||
{
|
{
|
||||||
headers.Referrer = new Uri(Configs.Referer);
|
headers.Referrer = new Uri(Configs.Referer);
|
||||||
headers.Add("user-agent", Configs.UserAgent);
|
headers.Add("User-Agent", Configs.UserAgent);
|
||||||
headers.Add("accept", Configs.AcceptImage);
|
headers.Add("Accept", Configs.AcceptImage);
|
||||||
});
|
});
|
||||||
if (response == null)
|
if (response == null)
|
||||||
{
|
{
|
||||||
@ -444,7 +444,8 @@ namespace Pixiview.Utils
|
|||||||
var proxy = Configs.Proxy;
|
var proxy = Configs.Proxy;
|
||||||
var handler = new HttpClientHandler
|
var handler = new HttpClientHandler
|
||||||
{
|
{
|
||||||
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
|
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
|
||||||
|
UseCookies = false
|
||||||
};
|
};
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
{
|
{
|
||||||
@ -460,13 +461,14 @@ namespace Pixiview.Utils
|
|||||||
{
|
{
|
||||||
using (var request = new HttpRequestMessage(HttpMethod.Get, uri.PathAndQuery)
|
using (var request = new HttpRequestMessage(HttpMethod.Get, uri.PathAndQuery)
|
||||||
{
|
{
|
||||||
Version = new Version(2, 0),
|
Version = new Version(2, 0)
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
var headers = request.Headers;
|
var headers = request.Headers;
|
||||||
headerAction(headers);
|
headerAction(headers);
|
||||||
headers.Add("accept-language", Configs.AcceptLanguage);
|
headers.Add("x-reverse", "yes");
|
||||||
headers.Add("accept-encoding", Configs.AcceptEncoding);
|
headers.Add("Accept-Language", Configs.AcceptLanguage);
|
||||||
|
//headers.Add("Accept-Encoding", Configs.AcceptEncoding);
|
||||||
return client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).Result;
|
return client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).Result;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -479,34 +481,48 @@ namespace Pixiview.Utils
|
|||||||
public const string HostKey = "host";
|
public const string HostKey = "host";
|
||||||
public const string PortKey = "port";
|
public const string PortKey = "port";
|
||||||
|
|
||||||
public static WebProxy Proxy;
|
|
||||||
|
|
||||||
public const int MaxThreads = 3;
|
public const int MaxThreads = 3;
|
||||||
public const string Referer = "https://www.pixiv.net/";
|
public const string Referer = "https://www.pixiv.net/";
|
||||||
public const string UrlIllustList = "https://www.pixiv.net/ajax/top/illust?mode=all&lang=zh";
|
|
||||||
public const string UrlIllust = "https://www.pixiv.net/artworks/{0}";
|
public static WebProxy Proxy;
|
||||||
|
private static string Prefix => Proxy == null ?
|
||||||
|
"https://hk.tsanie.us/reverse/" :
|
||||||
|
"https://www.pixiv.net/";
|
||||||
|
|
||||||
public const string SuffixPreload = " id=\"meta-preload-data\" content='";
|
public const string SuffixPreload = " id=\"meta-preload-data\" content='";
|
||||||
public const int SuffixPreloadLength = 33; // SuffixPreload.Length
|
public const int SuffixPreloadLength = 33; // SuffixPreload.Length
|
||||||
public const string UrlIllustUserAll = "https://www.pixiv.net/ajax/user/{0}/profile/all?lang=zh";
|
public static string UrlIllustList => Prefix + "ajax/top/illust?mode=all&lang=zh";
|
||||||
public const string UrlIllustUserArtworks = "https://www.pixiv.net/ajax/user/{0}/profile/illusts?{1}work_category=illustManga&is_first_page={2}&lang=zh";
|
public static string UrlIllust = Prefix + "artworks/{0}";
|
||||||
public const string UrlIllustUser = "https://www.pixiv.net/users/{0}/artworks";
|
public static string UrlIllustUserAll = Prefix + "ajax/user/{0}/profile/all?lang=zh";
|
||||||
public const string UrlIllustPage = "https://www.pixiv.net/ajax/illust/{0}/pages?lang=zh";
|
public static string UrlIllustUserArtworks = Prefix + "ajax/user/{0}/profile/illusts?{1}work_category=illustManga&is_first_page={2}&lang=zh";
|
||||||
|
public static string UrlIllustUser = Prefix + "users/{0}/artworks";
|
||||||
|
public static string UrlIllustPage = Prefix + "ajax/illust/{0}/pages?lang=zh";
|
||||||
public const string UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36";
|
public const string UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36";
|
||||||
public const string AcceptImage = "image/png,image/svg+xml,image/*;q=0.8,video/*;q=0.8,*/*;q=0.5";
|
public const string AcceptImage = "image/png,image/svg+xml,image/*;q=0.8,video/*;q=0.8,*/*;q=0.5";
|
||||||
public const string AcceptJson = "application/json";
|
public const string AcceptJson = "application/json";
|
||||||
public const string AcceptEncoding = "gzip, deflate";
|
//public const string AcceptEncoding = "gzip, deflate";
|
||||||
public const string AcceptLanguage = "zh-cn";
|
public const string AcceptLanguage = "zh-cn";
|
||||||
|
|
||||||
public const string UserId = "2603358";
|
//public const string UserId = "2603358";
|
||||||
|
//public const string Cookie =
|
||||||
|
// "PHPSESSID=2603358_VHyGPeRaz7LpeoFkRsHvjXIpApCMb56a; " +
|
||||||
|
// "a_type=0; b_type=1; c_type=31; d_type=2; " +
|
||||||
|
// "p_ab_id=2; p_ab_id_2=6; p_ab_d_id=1155161977; " +
|
||||||
|
// "privacy_policy_agreement=2; " +
|
||||||
|
// "login_ever=yes; " +
|
||||||
|
// "__cfduid=d9fa2d4d1ddd30db85ebb519f9855d2561587806747; " +
|
||||||
|
// "first_visit_datetime_pc=2019-10-29+22%3A05%3A30; " +
|
||||||
|
// "yuid_b=NgcXQWQ";
|
||||||
|
public const string UserId = "53887721";
|
||||||
public const string Cookie =
|
public const string Cookie =
|
||||||
"PHPSESSID=2603358_VHyGPeRaz7LpeoFkRsHvjXIpApCMb56a; " +
|
"PHPSESSID=5sn8n049j5c18l0tlj91qrjhesgddhjv; " +
|
||||||
"a_type=0; b_type=1; c_type=31; d_type=2; " +
|
"a_type=0; b_type=1; c_type=29; d_type=2; " +
|
||||||
"p_ab_id=2; p_ab_id_2=6; p_ab_d_id=1155161977; " +
|
"p_ab_d_id=1021624041; p_ab_id=2; p_ab_id_2=0; " +
|
||||||
"privacy_policy_agreement=2; " +
|
"privacy_policy_agreement=2; " +
|
||||||
"login_ever=yes; " +
|
"login_ever=yes; " +
|
||||||
"__cfduid=d9fa2d4d1ddd30db85ebb519f9855d2561587806747; " +
|
"__cfduid=d84153bf70ae67315a8bc297299d39eb61588856027; " +
|
||||||
"first_visit_datetime_pc=2019-10-29+22%3A05%3A30; " +
|
"first_visit_datetime_pc=2020-05-07+21%3A53%3A47; " +
|
||||||
"yuid_b=NgcXQWQ";
|
"yuid_b=MYkIJXc";
|
||||||
|
|
||||||
public static string GetThumbnailUrl(string url)
|
public static string GetThumbnailUrl(string url)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user