aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-12-14 02:42:58 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-12-14 02:42:58 -0800
commit90c12077b2c57afe34b5d9d02fd6a9dcdd9b0cfc (patch)
tree8a61f74d81e336d5c2a9dbe35107321e2ec3e14e /java/src
parenta042150a697715ca0b65fcc1a03fcc3491c488a2 (diff)
parent2d603fff64499098927a6a615baafa78a1ff3999 (diff)
downloadlatinime-90c12077b2c57afe34b5d9d02fd6a9dcdd9b0cfc.tar.gz
latinime-90c12077b2c57afe34b5d9d02fd6a9dcdd9b0cfc.tar.xz
latinime-90c12077b2c57afe34b5d9d02fd6a9dcdd9b0cfc.zip
Merge "Remove EditorInfo from KeyboardId"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardId.java77
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java6
2 files changed, 48 insertions, 35 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
index db5d8a84c..3b3ff0709 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
@@ -63,46 +63,39 @@ public class KeyboardId {
// TODO: Remove this field.
private final int mXmlId;
public final int mElementState;
- public final boolean mNavigateAction;
- public final boolean mPasswordInput;
+ private final int mInputType;
+ private final int mImeOptions;
private final boolean mSettingsKeyEnabled;
public final boolean mClobberSettingsKey;
public final boolean mShortcutKeyEnabled;
public final boolean mHasShortcutKey;
- public final int mImeAction;
-
- // TODO: Remove this field.
- private final EditorInfo mEditorInfo;
private final int mHashCode;
public KeyboardId(int xmlId, int elementState, Locale locale, int orientation, int width,
int mode, EditorInfo editorInfo, boolean settingsKeyEnabled,
boolean clobberSettingsKey, boolean shortcutKeyEnabled, boolean hasShortcutKey) {
- final int inputType = (editorInfo != null) ? editorInfo.inputType : 0;
- final int imeOptions = (editorInfo != null) ? editorInfo.imeOptions : 0;
- this.mElementState = elementState;
+ this(xmlId, elementState, locale, orientation, width, mode,
+ (editorInfo != null ? editorInfo.inputType : 0),
+ (editorInfo != null ? editorInfo.imeOptions : 0),
+ settingsKeyEnabled, clobberSettingsKey, shortcutKeyEnabled, hasShortcutKey);
+ }
+
+ private KeyboardId(int xmlId, int elementState, Locale locale, int orientation, int width,
+ int mode, int inputType, int imeOptions, boolean settingsKeyEnabled,
+ boolean clobberSettingsKey, boolean shortcutKeyEnabled, boolean hasShortcutKey) {
this.mLocale = locale;
this.mOrientation = orientation;
this.mWidth = width;
this.mMode = mode;
this.mXmlId = xmlId;
- // Note: Turn off checking navigation flag to show TAB key for now.
- this.mNavigateAction = InputTypeCompatUtils.isWebInputType(inputType);
-// || EditorInfoCompatUtils.hasFlagNavigateNext(imeOptions)
-// || EditorInfoCompatUtils.hasFlagNavigatePrevious(imeOptions);
- this.mPasswordInput = InputTypeCompatUtils.isPasswordInputType(inputType)
- || InputTypeCompatUtils.isVisiblePasswordInputType(inputType);
+ this.mElementState = elementState;
+ this.mInputType = inputType;
+ this.mImeOptions = imeOptions;
this.mSettingsKeyEnabled = settingsKeyEnabled;
this.mClobberSettingsKey = clobberSettingsKey;
this.mShortcutKeyEnabled = shortcutKeyEnabled;
this.mHasShortcutKey = hasShortcutKey;
- // We are interested only in {@link EditorInfo#IME_MASK_ACTION} enum value and
- // {@link EditorInfo#IME_FLAG_NO_ENTER_ACTION}.
- this.mImeAction = imeOptions & (
- EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION);
-
- this.mEditorInfo = editorInfo;
this.mHashCode = hashCode(this);
}
@@ -114,14 +107,14 @@ public class KeyboardId {
id.mMode,
id.mWidth,
id.mXmlId,
- id.mNavigateAction,
- id.mPasswordInput,
+ id.navigateAction(),
+ id.passwordInput(),
id.mSettingsKeyEnabled,
id.mClobberSettingsKey,
id.mShortcutKeyEnabled,
id.mHasShortcutKey,
- id.mImeAction,
- id.mLocale,
+ id.imeAction(),
+ id.mLocale
});
}
@@ -133,19 +126,19 @@ public class KeyboardId {
&& other.mMode == this.mMode
&& other.mWidth == this.mWidth
&& other.mXmlId == this.mXmlId
- && other.mNavigateAction == this.mNavigateAction
- && other.mPasswordInput == this.mPasswordInput
+ && other.navigateAction() == this.navigateAction()
+ && other.passwordInput() == this.passwordInput()
&& other.mSettingsKeyEnabled == this.mSettingsKeyEnabled
&& other.mClobberSettingsKey == this.mClobberSettingsKey
&& other.mShortcutKeyEnabled == this.mShortcutKeyEnabled
&& other.mHasShortcutKey == this.mHasShortcutKey
- && other.mImeAction == this.mImeAction
+ && other.imeAction() == this.imeAction()
&& other.mLocale.equals(this.mLocale);
}
public KeyboardId cloneWithNewXml(int xmlId) {
return new KeyboardId(xmlId, mElementState, mLocale, mOrientation, mWidth, mMode,
- mEditorInfo, false, false, false, false);
+ mInputType, mImeOptions, false, false, false, false);
}
// Remove this method.
@@ -169,6 +162,26 @@ public class KeyboardId {
return mElementState == ELEMENT_PHONE_SHIFT;
}
+ public boolean navigateAction() {
+ // Note: Turn off checking navigation flag to show TAB key for now.
+ boolean navigateAction = InputTypeCompatUtils.isWebInputType(mInputType);
+// || EditorInfoCompatUtils.hasFlagNavigateNext(mImeOptions)
+// || EditorInfoCompatUtils.hasFlagNavigatePrevious(mImeOptions);
+ return navigateAction;
+ }
+
+ public boolean passwordInput() {
+ return InputTypeCompatUtils.isPasswordInputType(mInputType)
+ || InputTypeCompatUtils.isVisiblePasswordInputType(mInputType);
+ }
+
+ public int imeAction() {
+ // We are interested only in {@link EditorInfo#IME_MASK_ACTION} enum value and
+ // {@link EditorInfo#IME_FLAG_NO_ENTER_ACTION}.
+ return mImeOptions & (
+ EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION);
+ }
+
public boolean hasSettingsKey() {
return mSettingsKeyEnabled && !mClobberSettingsKey;
}
@@ -205,11 +218,11 @@ public class KeyboardId {
mLocale,
(mOrientation == 1 ? "port" : "land"), mWidth,
modeName(mMode),
- EditorInfoCompatUtils.imeOptionsName(mImeAction),
+ EditorInfoCompatUtils.imeOptionsName(imeAction()),
f2KeyModeName(f2KeyMode()),
(mClobberSettingsKey ? " clobberSettingsKey" : ""),
- (mNavigateAction ? " navigateAction" : ""),
- (mPasswordInput ? " passwordInput" : ""),
+ (navigateAction() ? " navigateAction" : ""),
+ (passwordInput() ? " passwordInput" : ""),
(hasSettingsKey() ? " hasSettingsKey" : ""),
(mShortcutKeyEnabled ? " shortcutKeyEnabled" : ""),
(mHasShortcutKey ? " hasShortcutKey" : "")
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
index 31785ff75..66a9d049b 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
@@ -609,9 +609,9 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
final boolean modeMatched = matchTypedValue(a,
R.styleable.Keyboard_Case_mode, id.mMode, KeyboardId.modeName(id.mMode));
final boolean navigateActionMatched = matchBoolean(a,
- R.styleable.Keyboard_Case_navigateAction, id.mNavigateAction);
+ R.styleable.Keyboard_Case_navigateAction, id.navigateAction());
final boolean passwordInputMatched = matchBoolean(a,
- R.styleable.Keyboard_Case_passwordInput, id.mPasswordInput);
+ R.styleable.Keyboard_Case_passwordInput, id.passwordInput());
final boolean hasSettingsKeyMatched = matchBoolean(a,
R.styleable.Keyboard_Case_hasSettingsKey, id.hasSettingsKey());
final boolean f2KeyModeMatched = matchInteger(a,
@@ -627,7 +627,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
// {@link android.view.inputmethod.EditorInfo#IME_FLAG_NO_ENTER_ACTION}. So matching
// this attribute with id.mImeOptions as integer value is enough for our purpose.
final boolean imeActionMatched = matchInteger(a,
- R.styleable.Keyboard_Case_imeAction, id.mImeAction);
+ R.styleable.Keyboard_Case_imeAction, id.imeAction());
final boolean localeCodeMatched = matchString(a,
R.styleable.Keyboard_Case_localeCode, id.mLocale.toString());
final boolean languageCodeMatched = matchString(a,