Browse Source

Toplevel - Fix system theme not being applied at launch on some platforms (#16159)

* move platformbinding for theme variant from WindowBase up to TopLevel.

* remvoe visibility check in android insets manager for system theme
pull/16174/head
Emmanuel Hansen 2 years ago
committed by GitHub
parent
commit
3b235f9aa8
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      src/Android/Avalonia.Android/Platform/AndroidInsetsManager.cs
  2. 5
      src/Avalonia.Controls/TopLevel.cs
  3. 5
      src/Avalonia.Controls/WindowBase.cs

10
src/Android/Avalonia.Android/Platform/AndroidInsetsManager.cs

@ -191,11 +191,6 @@ namespace Avalonia.Android.Platform
{
_statusBarTheme = value;
if (!_topLevel.View.IsShown)
{
return;
}
var compat = new WindowInsetsControllerCompat(Window, _topLevel.View);
if (_isDefaultSystemBarLightTheme == null)
@ -229,11 +224,6 @@ namespace Avalonia.Android.Platform
{
_systemUiVisibility = value;
if (!_topLevel.View.IsShown)
{
return;
}
var compat = WindowCompat.GetInsetsController(Window, _topLevel.View);
if (value == null || value.Value)

5
src/Avalonia.Controls/TopLevel.cs

@ -232,6 +232,11 @@ namespace Avalonia.Controls
impl.TransparencyLevelChanged = HandleTransparencyLevelChanged;
CreatePlatformImplBinding(TransparencyLevelHintProperty, hint => PlatformImpl.SetTransparencyLevelHint(hint ?? Array.Empty<WindowTransparencyLevel>()));
CreatePlatformImplBinding(ActualThemeVariantProperty, variant =>
{
variant ??= ThemeVariant.Default;
PlatformImpl?.SetFrameThemeVariant((PlatformThemeVariant?)variant ?? PlatformThemeVariant.Light);
});
_keyboardNavigationHandler?.SetOwner(this);
_accessKeyHandler?.SetOwner(this);

5
src/Avalonia.Controls/WindowBase.cs

@ -48,11 +48,6 @@ namespace Avalonia.Controls
public WindowBase(IWindowBaseImpl impl) : this(impl, AvaloniaLocator.Current)
{
CreatePlatformImplBinding(TopmostProperty, topmost => PlatformImpl!.SetTopmost(topmost));
CreatePlatformImplBinding(ActualThemeVariantProperty, variant =>
{
variant ??= ThemeVariant.Default;
PlatformImpl?.SetFrameThemeVariant((PlatformThemeVariant?)variant ?? PlatformThemeVariant.Light);
});
FrameSize = impl.FrameSize;
}

Loading…
Cancel
Save