share settings, UI adjust
This commit is contained in:
@@ -294,7 +294,7 @@ namespace Pixiview.Illust
|
||||
TextColor = StyleDefinition.ColorRedBackground,
|
||||
Text = StyleDefinition.IconLove
|
||||
}
|
||||
.Binding(IsVisibleProperty, nameof(IllustItem.IsFavorite))
|
||||
.Binding(IsVisibleProperty, IsFavoriteVisible ? nameof(IllustItem.IsFavorite) : null)
|
||||
.DynamicResource(Label.FontFamilyProperty, ThemeBase.IconSolidFontFamily)
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Pixiview.UI;
|
||||
using Pixiview.Utils;
|
||||
@@ -16,7 +17,7 @@ namespace Pixiview.Illust
|
||||
private static void OnSegmentIndexPropertyChanged(BindableObject obj, object oldValue, object newValue)
|
||||
{
|
||||
var page = (RecommendsPage)obj;
|
||||
page.DoLoadIllusts();
|
||||
Task.Run(() => page.DoLoadIllusts());
|
||||
}
|
||||
|
||||
public int SegmentIndex
|
||||
@@ -25,8 +26,6 @@ namespace Pixiview.Illust
|
||||
set => SetValue(SegmentIndexProperty, value);
|
||||
}
|
||||
|
||||
private IllustData illustData;
|
||||
|
||||
public RecommendsPage()
|
||||
{
|
||||
totalBarOffset = new Thickness(0, AppShell.TotalBarOffset.Top + 40, 0, 0);
|
||||
@@ -103,11 +102,7 @@ namespace Pixiview.Illust
|
||||
|
||||
protected override IllustData DoLoadIllustData(bool force)
|
||||
{
|
||||
if (illustData != null && !force)
|
||||
{
|
||||
return illustData;
|
||||
}
|
||||
illustData = Stores.LoadIllustData(force);
|
||||
var illustData = Stores.LoadIllustData(force);
|
||||
return illustData;
|
||||
}
|
||||
|
||||
|
@@ -255,43 +255,68 @@ namespace Pixiview.Illust
|
||||
|
||||
private async void Illust_LongPressed(IllustDetailItem item)
|
||||
{
|
||||
var share = ResourceHelper.Share;
|
||||
string[] extras;
|
||||
var preview = Stores.GetPreviewImagePath(item.PreviewUrl);
|
||||
if (string.IsNullOrEmpty(preview))
|
||||
{
|
||||
extras = new string[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
extras = new[] { share };
|
||||
}
|
||||
var saveOriginal = ResourceHelper.SaveOriginal;
|
||||
var result = await DisplayActionSheet(
|
||||
IllustItem.Title,
|
||||
ResourceHelper.Cancel,
|
||||
saveOriginal);
|
||||
saveOriginal,
|
||||
extras);
|
||||
if (result == saveOriginal)
|
||||
{
|
||||
if (Stores.CheckIllustImage(item.OriginalUrl))
|
||||
SaveOriginalImage(item);
|
||||
}
|
||||
else if (result == share)
|
||||
{
|
||||
await Share.RequestAsync(new ShareFileRequest
|
||||
{
|
||||
var flag = await DisplayAlert(ResourceHelper.Operation,
|
||||
ResourceHelper.AlreadySavedQuestion,
|
||||
ResourceHelper.Yes,
|
||||
ResourceHelper.No);
|
||||
if (!flag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
Title = IllustItem.Title,
|
||||
File = new ShareFile(preview)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var status = await Permissions.CheckStatusAsync<Permissions.Photos>();
|
||||
if (status != PermissionStatus.Granted)
|
||||
{
|
||||
status = await Permissions.RequestAsync<Permissions.Photos>();
|
||||
if (status != PermissionStatus.Granted)
|
||||
{
|
||||
App.DebugPrint("access denied to gallery.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (item == null || item.Downloading)
|
||||
private async void SaveOriginalImage(IllustDetailItem item)
|
||||
{
|
||||
if (Stores.CheckIllustImage(item.OriginalUrl))
|
||||
{
|
||||
var flag = await DisplayAlert(ResourceHelper.Operation,
|
||||
ResourceHelper.AlreadySavedQuestion,
|
||||
ResourceHelper.Yes,
|
||||
ResourceHelper.No);
|
||||
if (!flag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
item.Downloading = true;
|
||||
_ = Task.Run(() => DoLoadOriginalImage(item));
|
||||
}
|
||||
|
||||
var status = await Permissions.CheckStatusAsync<Permissions.Photos>();
|
||||
if (status != PermissionStatus.Granted)
|
||||
{
|
||||
status = await Permissions.RequestAsync<Permissions.Photos>();
|
||||
if (status != PermissionStatus.Granted)
|
||||
{
|
||||
App.DebugPrint("access denied to gallery.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (item == null || item.Downloading)
|
||||
{
|
||||
return;
|
||||
}
|
||||
item.Downloading = true;
|
||||
_ = Task.Run(() => DoLoadOriginalImage(item));
|
||||
}
|
||||
|
||||
private void DoLoadOriginalImage(IllustDetailItem item)
|
||||
|
Reference in New Issue
Block a user