summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/WebTextView.java
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-02-08 13:07:41 -0500
committerLeon Scroggins <scroggo@google.com>2010-02-09 10:30:08 -0500
commitd5ff5dbfebe9a6b906323b4cc98257a83bbf38b2 (patch)
tree19e1a31b43524c3bf1d9e9192726b285e56a7bf7 /core/java/android/webkit/WebTextView.java
parent7040ce78666d3307521c6dc6d55c71ea90534a7e (diff)
downloadframeworks_base-d5ff5dbfebe9a6b906323b4cc98257a83bbf38b2.zip
frameworks_base-d5ff5dbfebe9a6b906323b4cc98257a83bbf38b2.tar.gz
frameworks_base-d5ff5dbfebe9a6b906323b4cc98257a83bbf38b2.tar.bz2
Handle the Tab key by moving to the next textfield. And ensure
there is always a way to get to the next field. http://b/issue?id=2414236 and http://b/issue?id=2414229
Diffstat (limited to 'core/java/android/webkit/WebTextView.java')
-rw-r--r--core/java/android/webkit/WebTextView.java41
1 files changed, 17 insertions, 24 deletions
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index 6d0be43..68be08d 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -145,6 +145,12 @@ import java.util.ArrayList;
break;
}
+ if (KeyEvent.KEYCODE_TAB == keyCode) {
+ if (down) {
+ onEditorAction(EditorInfo.IME_ACTION_NEXT);
+ }
+ return true;
+ }
Spannable text = (Spannable) getText();
int oldLength = text.length();
// Normally the delete key's dom events are sent via onTextChanged.
@@ -819,6 +825,7 @@ import java.util.ArrayList;
break;
case 2: // PASSWORD
inPassword = true;
+ imeOptions |= EditorInfo.IME_ACTION_GO;
break;
case 3: // SEARCH
imeOptions |= EditorInfo.IME_ACTION_SEARCH;
@@ -826,20 +833,22 @@ import java.util.ArrayList;
case 4: // EMAIL
// TYPE_TEXT_VARIATION_WEB_EDIT_TEXT prevents EMAIL_ADDRESS
// from working, so exclude it for now.
- inputType = EditorInfo.TYPE_CLASS_TEXT
- | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
+ imeOptions |= EditorInfo.IME_ACTION_GO;
break;
case 5: // NUMBER
- inputType = EditorInfo.TYPE_CLASS_NUMBER;
+ inputType |= EditorInfo.TYPE_CLASS_NUMBER;
+ // Number and telephone do not have both a Tab key and an
+ // action, so set the action to NEXT
+ imeOptions |= EditorInfo.IME_ACTION_NEXT;
break;
case 6: // TELEPHONE
- inputType = EditorInfo.TYPE_CLASS_PHONE;
+ inputType |= EditorInfo.TYPE_CLASS_PHONE;
+ imeOptions |= EditorInfo.IME_ACTION_NEXT;
break;
case 7: // URL
- // TYPE_TEXT_VARIATION_WEB_EDIT_TEXT prevents URI
- // from working, so exclude it for now.
- inputType = EditorInfo.TYPE_CLASS_TEXT
- | EditorInfo.TYPE_TEXT_VARIATION_URI;
+ // TYPE_TEXT_VARIATION_URI prevents Tab key from showing, so
+ // exclude it for now.
+ imeOptions |= EditorInfo.IME_ACTION_GO;
break;
default:
break;
@@ -855,22 +864,6 @@ import java.util.ArrayList;
mWebView.requestFormData(name, mNodePointer);
}
}
- if (type != 3 /* SEARCH */) {
- int action = mWebView.nativeTextFieldAction();
- switch (action) {
- // Keep in sync with CachedRoot::ImeAction
- case 0: // NEXT
- imeOptions |= EditorInfo.IME_ACTION_NEXT;
- break;
- case 1: // GO
- imeOptions |= EditorInfo.IME_ACTION_GO;
- break;
- case -1: // FAILURE
- case 2: // DONE
- imeOptions |= EditorInfo.IME_ACTION_DONE;
- break;
- }
- }
}
mSingle = single;
setMaxLength(maxLength);