Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1420)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java

Issue 720313004: Add autocapitalize support to IME support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java b/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
index 600af6833d497c231748c83fdb95969f1cf5c741..8b9eada5368d2cdecde718fd5efe8cbe1915f469 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
@@ -68,10 +68,22 @@ public class AdapterInputConnection extends BaseInputConnection {
| EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT;
int inputType = imeAdapter.getTextInputType();
+ int inputMode = imeAdapter.getTextInputMode();
int inputFlags = imeAdapter.getTextInputFlags();
+ boolean autoCapSet = false;
if ((inputFlags & ImeAdapter.sTextInputFlagAutocompleteOff) != 0) {
outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
}
+ if (inputMode == ImeAdapter.sTextInputModeLatinProse) {
+ outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES;
+ autoCapSet = true;
+ } else if (inputMode == ImeAdapter.sTextInputModeLatinName) {
+ outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS;
+ autoCapSet = true;
+ } else if (inputMode == ImeAdapter.sTextInputModeVerbatim) {
+ // Default is to capitalize nothing so no flag to set.
+ autoCapSet = true;
+ }
if (inputType == TextInputType.TEXT) {
// Normal text field
@@ -82,8 +94,10 @@ public class AdapterInputConnection extends BaseInputConnection {
} else if (inputType == TextInputType.TEXT_AREA
|| inputType == TextInputType.CONTENT_EDITABLE) {
// TextArea or contenteditable.
- outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE
- | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES;
+ outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
+ if (!autoCapSet) {
+ outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES;
+ }
if ((inputFlags & ImeAdapter.sTextInputFlagAutocorrectOff) == 0) {
outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
}

Powered by Google App Engine
This is Rietveld 408576698