UI adjustment, add json proxy
This commit is contained in:
@@ -55,6 +55,7 @@ namespace Pixiview.Illust
|
||||
public IllustCollection IllustCollection { get; set; }
|
||||
|
||||
protected virtual bool IsFavoriteVisible => true;
|
||||
protected virtual bool IsLazyload => false;
|
||||
protected DateTime lastUpdated;
|
||||
|
||||
private T illustData;
|
||||
@@ -87,9 +88,20 @@ namespace Pixiview.Illust
|
||||
|
||||
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;
|
||||
foreach (var item in IllustCollection)
|
||||
@@ -120,13 +132,19 @@ namespace Pixiview.Illust
|
||||
{
|
||||
base.OnSizeAllocated(width, height);
|
||||
int columns;
|
||||
if (isPhone)
|
||||
if (width > height)
|
||||
{
|
||||
columns = width > height ? 4 : 2;
|
||||
PanelTopMargin = StyleDefinition.IsFullscreenDevice ?
|
||||
AppShell.HalfNavigationBarOffset :
|
||||
StyleDefinition.TopOffset16;
|
||||
columns = isPhone ? 4 : 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
columns = width > height ? 6 : 4;
|
||||
PanelTopMargin = StyleDefinition.IsFullscreenDevice ?
|
||||
AppShell.NavigationBarOffset :
|
||||
StyleDefinition.TopOffset32;
|
||||
columns = isPhone ? 2 : 4;
|
||||
}
|
||||
if (Columns != columns)
|
||||
{
|
||||
|
@@ -5,21 +5,24 @@
|
||||
xmlns:u="clr-namespace:Pixiview.UI"
|
||||
xmlns:r="clr-namespace:Pixiview.Resources"
|
||||
x:Class="Pixiview.Illust.RankingPage"
|
||||
BackgroundColor="{DynamicResource WindowColor}">
|
||||
BackgroundColor="{DynamicResource WindowColor}"
|
||||
Shell.NavBarHasShadow="False">
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem Order="Primary" Clicked="Refresh_Clicked"
|
||||
IconImageSource="{DynamicResource FontIconRefresh}"/>
|
||||
</ContentPage.ToolbarItems>
|
||||
<Grid Padding="{Binding PageTopMargin}">
|
||||
<Grid>
|
||||
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
||||
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}"/>
|
||||
</ScrollView>
|
||||
<SearchBar Placeholder="{r:Text Search}" VerticalOptions="Start"
|
||||
Margin="0, -46, 0, 0" HeightRequest="50"
|
||||
BackgroundColor="{DynamicResource WindowColor}"
|
||||
<u:BlurryPanel VerticalOptions="Start" HeightRequest="50" Margin="{Binding PanelTopMargin}"/>
|
||||
<SearchBar Placeholder="{r:Text Search}" HeightRequest="50"
|
||||
VerticalOptions="Start"
|
||||
Margin="{Binding PageTopMargin}"
|
||||
BackgroundColor="Transparent"
|
||||
CancelButtonColor="{DynamicResource TintColor}"
|
||||
Text="{Binding Keywords, Mode=TwoWay}"
|
||||
SearchButtonPressed="SearchBar_SearchButtonPressed"
|
||||
|
@@ -26,28 +26,7 @@ namespace Pixiview.Illust
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public override void OnOrientationChanged(Orientation orientation)
|
||||
{
|
||||
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 bool IsLazyload => true;
|
||||
|
||||
protected override IEnumerable<IllustItem> DoGetIllustList(IllustData data, ICommand command)
|
||||
{
|
||||
|
@@ -11,14 +11,15 @@
|
||||
<ToolbarItem Order="Primary" Clicked="Refresh_Clicked"
|
||||
IconImageSource="{DynamicResource FontIconRefresh}"/>
|
||||
</ContentPage.ToolbarItems>
|
||||
<Grid Padding="{Binding PageTopMargin}">
|
||||
<Grid>
|
||||
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||
|
||||
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
||||
HorizontalOptions="Fill" Column="{Binding Columns}"
|
||||
Margin="16, 6, 16, 16" RowSpacing="16" ColumnSpacing="16"
|
||||
Margin="16" RowSpacing="16" ColumnSpacing="16"
|
||||
ItemTemplate="{StaticResource cardView}"/>
|
||||
</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"
|
||||
HeightRequest="30"
|
||||
BackgroundColor="{DynamicResource WindowColor}"
|
||||
@@ -30,7 +31,7 @@
|
||||
<u:SegmentedControlOption Text="{r:Text ByUser}"/>
|
||||
</u:SegmentedControl.Children>
|
||||
</u:SegmentedControl>
|
||||
</Grid>
|
||||
</Grid>-->
|
||||
<Frame HasShadow="False" Margin="0" Padding="20" CornerRadius="8"
|
||||
IsVisible="{Binding IsLoading}"
|
||||
HorizontalOptions="Center" VerticalOptions="Center"
|
||||
|
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Pixiview.UI;
|
||||
using Pixiview.Utils;
|
||||
using Xamarin.Forms;
|
||||
|
||||
@@ -32,29 +31,6 @@ namespace Pixiview.Illust
|
||||
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)
|
||||
{
|
||||
if (SegmentIndex == 1)
|
||||
|
Reference in New Issue
Block a user