Make WebView inactive when title bar takes focus.

Bug:3296938
Change-Id: I656e8582044acf3b0e9b417f41337833fe72c181
This commit is contained in:
Leon Scroggins
2011-01-18 16:49:20 -05:00
parent b25de0558c
commit 407772390f
2 changed files with 11 additions and 1 deletions

View File

@@ -132,6 +132,9 @@ import junit.framework.Assert;
private boolean mAutoFillable; // Is this textview part of an autofillable form?
private int mQueryId;
private boolean mAutoFillProfileIsSet;
// Used to determine whether onFocusChanged was called as a result of
// calling remove().
private boolean mInsideRemove;
// Types used with setType. Keep in sync with CachedInput.h
private static final int NORMAL_TEXT_FIELD = 0;
@@ -540,6 +543,11 @@ import junit.framework.Assert;
Rect previouslyFocusedRect) {
mFromFocusChange = true;
super.onFocusChanged(focused, direction, previouslyFocusedRect);
if (focused) {
mWebView.setActive(true);
} else if (!mInsideRemove) {
mWebView.setActive(false);
}
mFromFocusChange = false;
}
@@ -770,8 +778,10 @@ import junit.framework.Assert;
if (imm.isActive(this)) {
imm.hideSoftInputFromWindow(getWindowToken(), 0);
}
mInsideRemove = true;
mWebView.removeView(this);
mWebView.requestFocus();
mInsideRemove = false;
}
/**

View File

@@ -5050,7 +5050,7 @@ public class WebView extends AbsoluteLayout
public void onGlobalFocusChanged(View oldFocus, View newFocus) {
}
private void setActive(boolean active) {
void setActive(boolean active) {
if (active) {
if (hasFocus()) {
// If our window regained focus, and we have focus, then begin