From 243ea06d2bf67e8b54da51977687b08f49aeb093 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Thu, 25 Jun 2009 10:49:32 -0400 Subject: Remove the web text view if the key cannot be handled Also add some debugging to WebTextView Requires companion change in external/webkit --- core/java/android/webkit/WebTextView.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'core/java/android/webkit/WebTextView.java') diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index 4a8fa3cb2f3b..79896f26661a 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -24,6 +24,7 @@ import android.text.Selection; import android.text.Spannable; import android.text.TextUtils; import android.text.method.MovementMethod; +import android.util.Log; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.view.KeyCharacterMap; @@ -45,6 +46,8 @@ import java.util.ArrayList; */ /* package */ class WebTextView extends AutoCompleteTextView { + static final String LOGTAG = "webtextview"; + private WebView mWebView; private boolean mSingle; private int mWidthSpec; @@ -82,6 +85,7 @@ import java.util.ArrayList; setImeOptions(EditorInfo.IME_ACTION_NONE); // Allow webkit's drawing to show through setWillNotDraw(true); + setCursorVisible(false); } @Override @@ -268,6 +272,10 @@ import java.util.ArrayList; @Override protected void onSelectionChanged(int selStart, int selEnd) { if (mWebView != null) { + if (DebugFlags.WEB_TEXT_VIEW) { + Log.v(LOGTAG, "onSelectionChanged selStart=" + selStart + + " selEnd=" + selEnd); + } mWebView.setSelection(selStart, selEnd); } } @@ -313,6 +321,10 @@ import java.util.ArrayList; } else { // This corrects the selection which may have been affected by the // trackball or auto-correct. + if (DebugFlags.WEB_TEXT_VIEW) { + Log.v(LOGTAG, "onTextChanged start=" + start + + " start + before=" + (start + before)); + } mWebView.setSelection(start, start + before); } if (!cannotUseKeyEvents) { @@ -542,6 +554,10 @@ import java.util.ArrayList; } else if (start > length) { start = length; } + if (DebugFlags.WEB_TEXT_VIEW) { + Log.v(LOGTAG, "setText start=" + start + + " end=" + end); + } Selection.setSelection(span, start, end); } -- cgit v1.2.3