On a Sony Z3 compact, which has an on-screen navigation bar, in landscape mode the nav bar is docked to the right. This makes BottomBarBackground be ignored, as it seems to expect the navbar to be at the bottom.
Thanks for reporting. We’re already aware of this problem, but unfortunately we don’t have a fix for it yet. We’ll update this thread when we do. Sorry for the inconvenience!
Any way in UX to know that we must compensate for that?
It migth be possible to work around this by making a replacement for BottomBarBackground
in Uno, but I’m not sure how easy this would be…
Actually, seems this was easier than I thought:
RightNavigationBarBackground.uno:
using Uno;
using Fuse;
using Fuse.Controls;
using Uno.Compiler.ExportTargetInterop;
class RightNavigationBarBackground : Control
{
[ExportCondition("Android")]
int _navigationBarWidth;
public RightNavigationBarBackground()
{
_navigationBarWidth = getNavBarWidth();
}
protected override float2 GetContentSize(LayoutParams lp)
{
if defined(Android)
{
var width = _navigationBarWidth / Viewport.PointDensity;
return float2(width, 1);
}
return float2(0, 0);
}
[Foreign(Language.Java)]
public int getNavBarWidth()
@{
android.content.Context c = @(Activity.Package).@(Activity.Name).GetRootActivity();
android.content.res.Resources r = c.getResources();
boolean navigationBarVisible = false;
int showNavigationBarId = r.getIdentifier("config_showNavigationBar", "bool", "android");
if (showNavigationBarId > 0)
{
navigationBarVisible = r.getBoolean(showNavigationBarId);
}
else
{
boolean hasMenuKey = android.view.ViewConfiguration.get(c).hasPermanentMenuKey();
boolean hasBackKey = android.view.KeyCharacterMap.deviceHasKey(android.view.KeyEvent.KEYCODE_BACK);
navigationBarVisible = !hasMenuKey || !hasBackKey;
}
if (navigationBarVisible)
{
int navigationBarWidthId = r.getIdentifier("navigation_bar_width", "dimen", "android");
if (navigationBarWidthId > 0)
return r.getDimensionPixelSize(navigationBarWidthId);
}
return 0;
@}
}
MainView.ux:
<App Theme="Basic" ClearColor="#eeeeeeff">
<ClientPanel>
<DockPanel>
<WhileWindowLandscape>
<RightNavigationBarBackground Dock="Right" />
</WhileWindowLandscape>
<StackPanel>
<Button ux:Name="button" Height="100" MaxHeight="600">
<Clicked>
<Change Target="button.Height" Value="500" Easing="ElasticOut" EasingBack="ElasticIn" Duration="1" DurationBack="1"/>
</Clicked>
</Button>
</StackPanel>
</DockPanel>
</ClientPanel>
</App>
So, having dug a bit into this, I feel confident I’ll be able to get this included in an upcoming release. But probably not right away.
Very cool