Skip to content

Commit

Permalink
fixed to set android:windowSoftInputMode to adjustPan. (gree#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
KojiNakamaru authored Nov 19, 2023
1 parent 2f8db15 commit 32f1bf1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugins/Editor/UnityWebViewPostprocessBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public void OnPostGenerateGradleAndroidProject(string basePath) {
}
}
changed = (androidManifest.SetExported(true) || changed);
changed = (androidManifest.SetWindowSoftInputMode("adjustPan") || changed);
changed = (androidManifest.SetHardwareAccelerated(true) || changed);
#if UNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFIC
changed = (androidManifest.SetUsesCleartextTraffic(true) || changed);
Expand Down Expand Up @@ -163,6 +164,7 @@ public static void OnPostprocessBuild(BuildTarget buildTarget, string path) {
}
}
}
changed = (androidManifest.SetWindowSoftInputMode("adjustPan") || changed);
changed = (androidManifest.SetHardwareAccelerated(true) || changed);
#if UNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFIC
changed = (androidManifest.SetUsesCleartextTraffic(true) || changed);
Expand Down Expand Up @@ -314,6 +316,16 @@ internal bool SetExported(bool enabled) {
return changed;
}

internal bool SetWindowSoftInputMode(string mode) {
bool changed = false;
var activity = GetActivityWithLaunchIntent() as XmlElement;
if (activity.GetAttribute("windowSoftInputMode", AndroidXmlNamespace) != mode) {
activity.SetAttribute("windowSoftInputMode", AndroidXmlNamespace, mode);
changed = true;
}
return changed;
}

internal bool SetHardwareAccelerated(bool enabled) {
bool changed = false;
var activity = GetActivityWithLaunchIntent() as XmlElement;
Expand Down

0 comments on commit 32f1bf1

Please sign in to comment.