Skip to content

Commit ac0bfe3

Browse files
committed
Fix NaluTabBar doubled Window Insets detection on Android
1 parent 0205456 commit ac0bfe3

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

Samples/Nalu.Maui.Sample/AppShellTabBar.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public partial class AppShellTabBar
55
static AppShellTabBar()
66
{
77
#if IOS || ANDROID || MACCATALYST
8-
UseBlurEffect = true;
8+
NaluTabBar.UseBlurEffect = true;
99
#endif
1010
}
1111

Source/Nalu.Maui.Navigation/Platforms/Android/NaluShellItemRendererTabBarLayout.cs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
namespace Nalu;
1313

1414
#pragma warning disable CS1591
15-
public class NaluShellItemRendererTabBarLayout : FrameLayout, IOnApplyWindowInsetsListener
15+
public class NaluShellItemRendererTabBarLayout : FrameLayout
1616
{
17-
private static readonly int _systemBarsInsetsType = WindowInsetsCompat.Type.SystemBars();
18-
private int _systemBarInset;
1917
private View? _tabBar;
2018

2119
public NaluShellItemRendererTabBarLayout(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
@@ -27,7 +25,6 @@ public NaluShellItemRendererTabBarLayout(IntPtr javaReference, JniHandleOwnershi
2725
#endif
2826
public NaluShellItemRendererTabBarLayout(Context context) : base(context)
2927
{
30-
ViewCompat.SetOnApplyWindowInsetsListener(this, this);
3128
// ReSharper disable once VirtualMemberCallInConstructor
3229
SetClipChildren(false);
3330
#if NET10_0_OR_GREATER
@@ -63,11 +60,6 @@ protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
6360
MeasureChild(_tabBar, widthMeasureSpec, heightMeasureSpec);
6461
width = _tabBar.MeasuredWidth;
6562
height = _tabBar.MeasuredHeight;
66-
67-
if (height > 0)
68-
{
69-
height += _systemBarInset;
70-
}
7163
}
7264
else
7365
{
@@ -101,18 +93,4 @@ protected override void Dispose(bool disposing)
10193
ViewCompat.SetOnApplyWindowInsetsListener(this, null);
10294
}
10395
}
104-
105-
WindowInsetsCompat AndroidX.Core.View.IOnApplyWindowInsetsListener.OnApplyWindowInsets(View? view, WindowInsetsCompat? insets)
106-
{
107-
ArgumentNullException.ThrowIfNull(insets);
108-
var bottomInset = insets.GetInsets(_systemBarsInsetsType)?.Bottom ?? throw new InvalidOperationException("SystemBars insets are null.");
109-
110-
if (_systemBarInset != bottomInset)
111-
{
112-
_systemBarInset = bottomInset;
113-
RequestLayout();
114-
}
115-
116-
return insets;
117-
}
11896
}

0 commit comments

Comments
 (0)