From 71d17e40714407296d0d8c83d35c20f591bb0386 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 2 Sep 2010 12:53:08 -0400 Subject: Only close the IME if it is Active on the WebView. Bug: 2955391 Some applications want to leave the IME open even though the WebView is loading a page. Only hide the IME if it is Active on the WebView or the WebTextView. Change-Id: I1e7f973f649d78561bd8585c628a83c9b18a66ad --- core/java/android/webkit/WebTextView.java | 6 ++++-- core/java/android/webkit/WebView.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index 990f891..4d85046 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -594,8 +594,10 @@ import java.util.ArrayList; */ /* package */ void remove() { // hide the soft keyboard when the edit text is out of focus - InputMethodManager.getInstance(mContext).hideSoftInputFromWindow( - getWindowToken(), 0); + InputMethodManager imm = InputMethodManager.getInstance(mContext); + if (imm.isActive(this)) { + imm.hideSoftInputFromWindow(getWindowToken(), 0); + } mWebView.removeView(this); mWebView.requestFocus(); } diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 0b236af..b83edc7 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3701,8 +3701,10 @@ public class WebView extends AbsoluteLayout private void hideSoftKeyboard() { InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - - imm.hideSoftInputFromWindow(this.getWindowToken(), 0); + if (imm.isActive(this) + || (inEditingMode() && imm.isActive(mWebTextView))) { + imm.hideSoftInputFromWindow(this.getWindowToken(), 0); + } } /* -- cgit v1.1