feature: airdrop share favorites
This commit is contained in:
@@ -7,8 +7,12 @@
|
||||
x:Class="Pixiview.Illust.FavoritesPage"
|
||||
BackgroundColor="{DynamicResource WindowColor}"
|
||||
Title="{r:Text Favorites}">
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem Order="Primary" Clicked="ShareFavorites_Clicked"
|
||||
IconImageSource="{DynamicResource FontIconShare}"/>
|
||||
</ContentPage.ToolbarItems>
|
||||
<Grid>
|
||||
<ScrollView HorizontalOptions="Fill">
|
||||
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
||||
HorizontalOptions="Fill" Column="{Binding Columns}"
|
||||
Margin="16" RowSpacing="16" ColumnSpacing="16"
|
||||
|
@@ -1,7 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Input;
|
||||
using Pixiview.Resources;
|
||||
using Pixiview.Utils;
|
||||
using Xamarin.Essentials;
|
||||
|
||||
namespace Pixiview.Illust
|
||||
{
|
||||
@@ -22,8 +25,7 @@ namespace Pixiview.Illust
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
//base.OnAppearing();
|
||||
loaded = false;
|
||||
StartLoad();
|
||||
Reload();
|
||||
}
|
||||
|
||||
protected override IEnumerable<IllustItem> DoGetIllustList(IllustItem[] data, ICommand command)
|
||||
@@ -37,12 +39,28 @@ namespace Pixiview.Illust
|
||||
|
||||
protected override IllustItem[] DoLoadIllustData(bool force)
|
||||
{
|
||||
var favorites = Stores.FavoriteObject;
|
||||
var favorites = Stores.GetFavoriteObject(force);
|
||||
if (favorites == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return favorites.Illusts.ToArray();
|
||||
}
|
||||
|
||||
public void Reload(bool force = false)
|
||||
{
|
||||
loaded = false;
|
||||
StartLoad(force);
|
||||
}
|
||||
|
||||
private async void ShareFavorites_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
var file = Stores.FavoritesPath;
|
||||
await Share.RequestAsync(new ShareFileRequest
|
||||
{
|
||||
Title = ResourceHelper.Favorites,
|
||||
File = new ShareFile(file)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -121,7 +121,15 @@ namespace Pixiview.Illust
|
||||
protected override void OnSizeAllocated(double width, double height)
|
||||
{
|
||||
base.OnSizeAllocated(width, height);
|
||||
var columns = width > height ? 4 : 2;
|
||||
int columns;
|
||||
if (isPhone)
|
||||
{
|
||||
columns = width > height ? 4 : 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
columns = width > height ? 6 : 4;
|
||||
}
|
||||
if (Columns != columns)
|
||||
{
|
||||
Columns = columns;
|
||||
@@ -341,7 +349,7 @@ namespace Pixiview.Illust
|
||||
IsLoading = false;
|
||||
return;
|
||||
}
|
||||
if (force)
|
||||
if (force && IsFavoriteVisible)
|
||||
{
|
||||
NeedUpdate = true;
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
IconImageSource="{DynamicResource FontIconRefresh}"/>
|
||||
</ContentPage.ToolbarItems>
|
||||
<Grid>
|
||||
<ScrollView HorizontalOptions="Fill">
|
||||
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
||||
HorizontalOptions="Fill" Column="{Binding Columns}"
|
||||
Margin="16" RowSpacing="16" ColumnSpacing="16"
|
||||
|
@@ -11,7 +11,7 @@
|
||||
IconImageSource="{DynamicResource FontIconRefresh}"/>
|
||||
</ContentPage.ToolbarItems>
|
||||
<Grid Padding="{Binding PageTopMargin}">
|
||||
<ScrollView HorizontalOptions="Fill">
|
||||
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
||||
HorizontalOptions="Fill" Column="{Binding Columns}"
|
||||
Margin="16, 10, 16, 16" RowSpacing="16" ColumnSpacing="16"
|
||||
|
@@ -34,15 +34,17 @@ namespace Pixiview.Illust
|
||||
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;
|
||||
//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 = new Thickness(0, AppShell.NavigationBarOffset.Top + 50, 0, 0);
|
||||
PageTopMargin = isPhone ?
|
||||
new Thickness(0, AppShell.NavigationBarOffset.Top + 50, 0, 0) :
|
||||
new Thickness(0, AppShell.TotalBarOffset.Top + 50, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
IconImageSource="{DynamicResource FontIconRefresh}"/>
|
||||
</ContentPage.ToolbarItems>
|
||||
<Grid Padding="{Binding PageTopMargin}">
|
||||
<ScrollView HorizontalOptions="Fill">
|
||||
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
||||
HorizontalOptions="Fill" Column="{Binding Columns}"
|
||||
Margin="16, 6, 16, 16" RowSpacing="16" ColumnSpacing="16"
|
||||
|
@@ -40,15 +40,17 @@ namespace Pixiview.Illust
|
||||
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;
|
||||
//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 = new Thickness(0, AppShell.NavigationBarOffset.Top + 40, 0, 0);
|
||||
PageTopMargin = isPhone ?
|
||||
new Thickness(0, AppShell.NavigationBarOffset.Top + 40, 0, 0) :
|
||||
new Thickness(0, AppShell.TotalBarOffset.Top + 40, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
IconImageSource="{DynamicResource FontIconRefresh}"/>
|
||||
</ContentPage.ToolbarItems>
|
||||
<Grid>
|
||||
<ScrollView HorizontalOptions="Fill">
|
||||
<ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
||||
HorizontalOptions="Fill" Column="{Binding Columns}"
|
||||
Margin="16" RowSpacing="16" ColumnSpacing="16"
|
||||
|
Reference in New Issue
Block a user