Skip to content

Commit

Permalink
introduced UNITYWEBVIEW_ANDROID_FORCE_MARGIN_ADJUSTMENT_FOR_KEYBOARD. (
Browse files Browse the repository at this point in the history
  • Loading branch information
KojiNakamaru authored Jun 23, 2023
1 parent 76373a5 commit e2f749d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ index a62c1ca..a5efe9f 100644

By default, `navigator.onLine` doesn't work on Android WebView. Please define `UNITYWEBVIEW_ANDROID_ENABLE_NAVIGATOR_ONLINE` to enable it. The plugin will then periodically check `Application.internetReachability` and call WebView's `setNetworkAvailable()` adequately.

#### Margin adjustment for keyboard popup

This plugin adjusts the bottom margin temporarily when the keyboard pops up to keep the focused input field displayed. This adjustment is however disabled for some cases (non-fullscreen mode or both portrait/landscape are enabled) to avoid odd behaviours (cf. https://github.com/gree/unity-webview/pull/809 ). Please define `UNITYWEBVIEW_ANDROID_FORCE_MARGIN_ADJUSTMENT_FOR_KEYBOARD` to force the margin adjustment even for these cases.

#### How to build WebViewPlugin.jar

The following steps are for Mac but you can follow similar ones for Windows.
Expand Down
4 changes: 4 additions & 0 deletions plugins/WebViewObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,14 @@ public int AdjustBottomMargin(int bottom)

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

0 comments on commit e2f749d

Please sign in to comment.