UI issues when orientation changed.
This commit is contained in:
parent
baa6056a4d
commit
33fe1c8cc1
Pixiview.iOS
Pixiview/Illust
@ -61,6 +61,7 @@
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchUseLlvm>true</MtouchUseLlvm>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
|
@ -58,8 +58,6 @@ namespace Pixiview.Illust
|
||||
public IllustCollection IllustCollection { get; set; }
|
||||
|
||||
protected virtual bool IsFavoriteVisible => true;
|
||||
protected Thickness totalBarOffset;
|
||||
protected Thickness navigationBarOffset;
|
||||
protected bool loaded;
|
||||
|
||||
private T illustData;
|
||||
@ -123,30 +121,15 @@ namespace Pixiview.Illust
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnOrientationChanged(Orientation orientation)
|
||||
protected override void OnSizeAllocated(double width, double height)
|
||||
{
|
||||
int columns;
|
||||
switch (orientation)
|
||||
{
|
||||
case Orientation.Portrait:
|
||||
columns = 2;
|
||||
break;
|
||||
case Orientation.PortraitUpsideDown:
|
||||
columns = isPhone ? 4 : 2;
|
||||
break;
|
||||
case Orientation.Unknown:
|
||||
case Orientation.LandscapeLeft:
|
||||
case Orientation.LandscapeRight:
|
||||
default:
|
||||
columns = 4;
|
||||
break;
|
||||
}
|
||||
base.OnSizeAllocated(width, height);
|
||||
var columns = width > height ? 4 : 2;
|
||||
if (Columns != columns)
|
||||
{
|
||||
App.DebugPrint($"change columns to {columns}");
|
||||
Columns = columns;
|
||||
App.DebugPrint($"change columns to {columns}");
|
||||
}
|
||||
base.OnOrientationChanged(orientation);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -21,39 +21,29 @@ namespace Pixiview.Illust
|
||||
|
||||
public RankingPage()
|
||||
{
|
||||
totalBarOffset = new Thickness(0, AppShell.TotalBarOffset.Top + 50, 0, 0);
|
||||
navigationBarOffset = new Thickness(0, AppShell.NavigationBarOffset.Top + 50, 0, 0);
|
||||
|
||||
Resources.Add("cardView", GetCardViewTemplate());
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public override void OnOrientationChanged(Orientation orientation)
|
||||
{
|
||||
int columns;
|
||||
switch (orientation)
|
||||
{
|
||||
case Orientation.Portrait:
|
||||
columns = 2;
|
||||
PageTopMargin = totalBarOffset;
|
||||
PageTopMargin = new Thickness(0, AppShell.TotalBarOffset.Top + 50, 0, 0);
|
||||
break;
|
||||
case Orientation.PortraitUpsideDown:
|
||||
columns = isPhone ? 4 : 2;
|
||||
PageTopMargin = isPhone ? navigationBarOffset : totalBarOffset;
|
||||
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:
|
||||
columns = 4;
|
||||
PageTopMargin = navigationBarOffset;
|
||||
PageTopMargin = new Thickness(0, AppShell.NavigationBarOffset.Top + 50, 0, 0);
|
||||
break;
|
||||
}
|
||||
if (Columns != columns)
|
||||
{
|
||||
App.DebugPrint($"ranking page, change columns to {columns}");
|
||||
Columns = columns;
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<IllustItem> DoGetIllustList(IllustData data, ICommand command)
|
||||
|
@ -28,39 +28,29 @@ namespace Pixiview.Illust
|
||||
|
||||
public RecommendsPage()
|
||||
{
|
||||
totalBarOffset = new Thickness(0, AppShell.TotalBarOffset.Top + 40, 0, 0);
|
||||
navigationBarOffset = new Thickness(0, AppShell.NavigationBarOffset.Top + 40, 0, 0);
|
||||
|
||||
Resources.Add("cardView", GetCardViewTemplate());
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public override void OnOrientationChanged(Orientation orientation)
|
||||
{
|
||||
int columns;
|
||||
switch (orientation)
|
||||
{
|
||||
case Orientation.Portrait:
|
||||
columns = 2;
|
||||
PageTopMargin = totalBarOffset;
|
||||
PageTopMargin = new Thickness(0, AppShell.TotalBarOffset.Top + 40, 0, 0);
|
||||
break;
|
||||
case Orientation.PortraitUpsideDown:
|
||||
columns = isPhone ? 4 : 2;
|
||||
PageTopMargin = isPhone ? navigationBarOffset : totalBarOffset;
|
||||
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:
|
||||
columns = 4;
|
||||
PageTopMargin = navigationBarOffset;
|
||||
PageTopMargin = new Thickness(0, AppShell.NavigationBarOffset.Top + 40, 0, 0);
|
||||
break;
|
||||
}
|
||||
if (Columns != columns)
|
||||
{
|
||||
App.DebugPrint($"ranking page, change columns to {columns}");
|
||||
Columns = columns;
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<IllustItem> DoGetIllustList(IllustData data, ICommand command)
|
||||
|
Loading…
x
Reference in New Issue
Block a user