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