* Pixiview/UI/StyleDefinition.cs: issue in simulator iPad Pro
11-inch * Pixiview/UI/FlowLayout.cs: * Pixiview/Illust/RankingPage.xaml: * Pixiview/Illust/RankingPage.xaml.cs: fix: scrolling issue * Pixiview/Illust/ViewIllustPage.xaml: * Pixiview/Illust/ViewIllustPage.xaml.cs: fix: swipe page indicator issue
This commit is contained in:
parent
a2b91a2406
commit
29fd8e9667
@ -48,7 +48,7 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
<ScrollView x:Name="scrollView" Scrolled="ScrollView_Scrolled"
|
||||||
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never">
|
||||||
<u:FlowLayout ItemsSource="{Binding Illusts}"
|
<u:FlowLayout ItemsSource="{Binding Illusts}" MaxHeightChanged="FlowLayout_MaxHeightChanged"
|
||||||
HorizontalOptions="Fill" Column="{Binding Columns}"
|
HorizontalOptions="Fill" Column="{Binding Columns}"
|
||||||
Margin="16, 16, 16, 16" RowSpacing="16" ColumnSpacing="16"
|
Margin="16, 16, 16, 16" RowSpacing="16" ColumnSpacing="16"
|
||||||
ItemTemplate="{StaticResource cardView}"/>
|
ItemTemplate="{StaticResource cardView}"/>
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Pixiview.Resources;
|
using Pixiview.Resources;
|
||||||
|
using Pixiview.UI;
|
||||||
using Pixiview.Utils;
|
using Pixiview.Utils;
|
||||||
using Xamarin.Essentials;
|
using Xamarin.Essentials;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
@ -77,9 +78,10 @@ namespace Pixiview.Illust
|
|||||||
public Command<string> ToolbarCommand { get; private set; }
|
public Command<string> ToolbarCommand { get; private set; }
|
||||||
|
|
||||||
private double lastScrollY = double.MinValue;
|
private double lastScrollY = double.MinValue;
|
||||||
public bool previousEnabled;
|
private bool previousEnabled;
|
||||||
public bool dateEnabled;
|
private bool dateEnabled;
|
||||||
public bool nextEnabled;
|
private bool nextEnabled;
|
||||||
|
private double offset;
|
||||||
|
|
||||||
private bool isFilterVisible;
|
private bool isFilterVisible;
|
||||||
private string lastQueryKey;
|
private string lastQueryKey;
|
||||||
@ -126,6 +128,14 @@ namespace Pixiview.Illust
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FlowLayout_MaxHeightChanged(object sender, HeightEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.ContentHeight > 0)
|
||||||
|
{
|
||||||
|
offset = e.ContentHeight - scrollView.Bounds.Height - 33;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void DoIllustsLoaded(IllustCollection collection)
|
protected override void DoIllustsLoaded(IllustCollection collection)
|
||||||
{
|
{
|
||||||
var now = IllustCollection;
|
var now = IllustCollection;
|
||||||
@ -333,8 +343,7 @@ namespace Pixiview.Illust
|
|||||||
}
|
}
|
||||||
lastScrollY = y;
|
lastScrollY = y;
|
||||||
|
|
||||||
var bottomOffset = scrollView.ContentSize.Height - (scrollView.LayoutAreaOverride.Height * 2);
|
if (y > 0 && offset > 0 && y - topOffset > offset)
|
||||||
if (y > 0 && y + topOffset > bottomOffset)
|
|
||||||
{
|
{
|
||||||
bool refresh = false;
|
bool refresh = false;
|
||||||
lock (sync)
|
lock (sync)
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
<CarouselView ItemsSource="{Binding Illusts}" HorizontalScrollBarVisibility="Never"
|
<CarouselView ItemsSource="{Binding Illusts}" HorizontalScrollBarVisibility="Never"
|
||||||
Position="{Binding CurrentPage}"
|
Position="{Binding CurrentPage}"
|
||||||
ItemTemplate="{StaticResource carouselView}"
|
ItemTemplate="{StaticResource carouselView}"
|
||||||
IsScrollAnimated="{Binding IsScrollAnimated}"
|
IsScrollAnimated="{Binding IsScrollAnimated}">
|
||||||
PositionChanged="CarouselView_PositionChanged">
|
|
||||||
<CarouselView.ItemsLayout>
|
<CarouselView.ItemsLayout>
|
||||||
<LinearItemsLayout Orientation="Vertical" ItemSpacing="20"/>
|
<LinearItemsLayout Orientation="Vertical" ItemSpacing="20"/>
|
||||||
</CarouselView.ItemsLayout>
|
</CarouselView.ItemsLayout>
|
||||||
|
@ -86,7 +86,7 @@ namespace Pixiview.Illust
|
|||||||
public int CurrentPage
|
public int CurrentPage
|
||||||
{
|
{
|
||||||
get => (int)GetValue(CurrentPageProperty);
|
get => (int)GetValue(CurrentPageProperty);
|
||||||
private set => SetValue(CurrentPageProperty, value);
|
set => SetValue(CurrentPageProperty, value);
|
||||||
}
|
}
|
||||||
public bool IsScrollAnimated
|
public bool IsScrollAnimated
|
||||||
{
|
{
|
||||||
@ -413,11 +413,6 @@ namespace Pixiview.Illust
|
|||||||
item.Loading = false;
|
item.Loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CarouselView_PositionChanged(object sender, PositionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
CurrentPage = e.CurrentPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TapPrevious_Tapped(object sender, EventArgs e)
|
private void TapPrevious_Tapped(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var index = CurrentPage;
|
var index = CurrentPage;
|
||||||
@ -520,7 +515,7 @@ namespace Pixiview.Illust
|
|||||||
|
|
||||||
var illustItem = IllustItem;
|
var illustItem = IllustItem;
|
||||||
var result = await DisplayActionSheet(
|
var result = await DisplayActionSheet(
|
||||||
illustItem.Title,
|
$"{illustItem.Title} (id: {illustItem.Id})",
|
||||||
ResourceHelper.Cancel,
|
ResourceHelper.Cancel,
|
||||||
saveOriginal,
|
saveOriginal,
|
||||||
extras.ToArray());
|
extras.ToArray());
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
@ -19,7 +20,7 @@ namespace Pixiview.UI
|
|||||||
var flowLayout = (FlowLayout)obj;
|
var flowLayout = (FlowLayout)obj;
|
||||||
if (oldValue is int column && column != flowLayout.Column)
|
if (oldValue is int column && column != flowLayout.Column)
|
||||||
{
|
{
|
||||||
//flowLayout.UpdateChildrenLayout();
|
flowLayout.UpdateChildrenLayout();
|
||||||
flowLayout.InvalidateLayout();
|
flowLayout.InvalidateLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,6 +41,8 @@ namespace Pixiview.UI
|
|||||||
set => SetValue(ColumnSpacingProperty, value);
|
set => SetValue(ColumnSpacingProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event EventHandler<HeightEventArgs> MaxHeightChanged;
|
||||||
|
|
||||||
public double ColumnWidth { get; private set; }
|
public double ColumnWidth { get; private set; }
|
||||||
|
|
||||||
private double maximumHeight;
|
private double maximumHeight;
|
||||||
@ -109,6 +112,8 @@ namespace Pixiview.UI
|
|||||||
}
|
}
|
||||||
maximumHeight = columnHeights.Max();
|
maximumHeight = columnHeights.Max();
|
||||||
|
|
||||||
|
MaxHeightChanged?.Invoke(this, new HeightEventArgs { ContentHeight = maximumHeight });
|
||||||
|
|
||||||
return new SizeRequest(new Size(widthConstraint, maximumHeight));
|
return new SizeRequest(new Size(widthConstraint, maximumHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,4 +196,9 @@ namespace Pixiview.UI
|
|||||||
InvalidateLayout();
|
InvalidateLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class HeightEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public double ContentHeight { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,12 +114,12 @@ namespace Pixiview.UI
|
|||||||
// iPad or Simulator
|
// iPad or Simulator
|
||||||
var name = DeviceInfo.Name;
|
var name = DeviceInfo.Name;
|
||||||
var flag = name.StartsWith("iPhone X")
|
var flag = name.StartsWith("iPhone X")
|
||||||
|| name.StartsWith("iPhone 11")
|
|| name.StartsWith("iPhone 11");
|
||||||
|
_isFullscreenDevice = flag;
|
||||||
|
_isBottomPadding = flag
|
||||||
|| name.StartsWith("iPad Pro (11-inch)")
|
|| name.StartsWith("iPad Pro (11-inch)")
|
||||||
|| name.StartsWith("iPad Pro (12.9-inch) (3rd generation)")
|
|| name.StartsWith("iPad Pro (12.9-inch) (3rd generation)")
|
||||||
|| name.StartsWith("iPad Pro (12.9-inch) (4th generation)");
|
|| name.StartsWith("iPad Pro (12.9-inch) (4th generation)");
|
||||||
_isFullscreenDevice = flag;
|
|
||||||
_isBottomPadding = flag;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user