Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduced BottomAdjustmentDisabled() to disable bottom margin adjustment #809

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions plugins/WebViewObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ void Update()
/// Called from Java native plugin to set when the keyboard is opened
public void SetKeyboardVisible(string pIsVisible)
{
bool isKeyboardVisible0 = mIsKeyboardVisible;
mIsKeyboardVisible = (pIsVisible == "true");
if (!Screen.fullScreen)
if (BottomAdjustmentDisabled())
{
return;
}
bool isKeyboardVisible0 = mIsKeyboardVisible;
mIsKeyboardVisible = (pIsVisible == "true");
if (mIsKeyboardVisible != isKeyboardVisible0 || mIsKeyboardVisible)
{
SetMargins(mMarginLeft, mMarginTop, mMarginRight, mMarginBottom, mMarginRelative);
Expand All @@ -158,7 +158,11 @@ public void SetKeyboardVisible(string pIsVisible)

public int AdjustBottomMargin(int bottom)
{
if (!mIsKeyboardVisible || !Screen.fullScreen)
if (BottomAdjustmentDisabled())
{
return bottom;
}
else if (!mIsKeyboardVisible)
{
return bottom;
}
Expand All @@ -177,6 +181,14 @@ public int AdjustBottomMargin(int bottom)
return (bottom > keyboardHeight) ? bottom : keyboardHeight;
}
}

private bool BottomAdjustmentDisabled()
{
return
!Screen.fullScreen
|| ((Screen.autorotateToLandscapeLeft || Screen.autorotateToLandscapeRight)
&& (Screen.autorotateToPortrait || Screen.autorotateToPortraitUpsideDown));
}
#else
IntPtr webView;
#endif
Expand Down