Skip to content

Commit dc28e2f

Browse files
committed
fix: ImmersiveMode, WebViewSoftInputPatch cause incorrect interface height
1 parent 0bd8f6a commit dc28e2f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/MauiBlazorToolkit/MauiBlazorToolkit/Platform/WebViewSoftInput/WebViewSoftInput.android.cs

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Android.Content.Res;
2+
using Android.Views;
23
using Android.Widget;
34
using System.Runtime.Versioning;
45
using static Android.Resource;
@@ -59,7 +60,14 @@ static int ComputeUsableHeight()
5960
{
6061
Rect rect = new Rect();
6162
MChildOfContent?.GetWindowVisibleDisplayFrame(rect);
62-
return rect.Bottom - GetStatusBarHeight();
63+
if(IsImmersiveMode())
64+
{
65+
return rect.Bottom;
66+
}
67+
else
68+
{
69+
return rect.Bottom - GetStatusBarHeight();
70+
}
6371
}
6472

6573
static int GetStatusBarHeight()
@@ -73,4 +81,12 @@ static int GetStatusBarHeight()
7381
}
7482
return result;
7583
}
84+
85+
static bool IsImmersiveMode()
86+
{
87+
var window = Activity.Window ?? throw new InvalidOperationException("Activity Window can't be null.");
88+
View decorView = window.DecorView;
89+
int uiOptions = (int)decorView.SystemUiVisibility;
90+
return (uiOptions & (int)SystemUiFlags.Immersive) == (int)SystemUiFlags.Immersive;
91+
}
7692
}

0 commit comments

Comments
 (0)