summaryrefslogtreecommitdiff
path: root/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2013-12-13 17:09:16 +0900
committerKen Wakasa <kwakasa@google.com>2013-12-13 17:13:32 +0900
commit2fa3693c264a4c150ac307d9bb7f6f8f18cc4ffc (patch)
tree56a5652edf71dd19d04161f72e3e013608cc2a9c /java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java
parent18d033405c18a8dc28f60ca22d1d0df23a679384 (diff)
Reset to 9bd6dac4708ad94fd0257c53e977df62b152e20c
The bulk merge from -bayo to klp-dev should not have been merged to master. Change-Id: I527a03a76f5247e4939a672f27c314dc11cbb854
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java42
1 files changed, 20 insertions, 22 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java
index 1eccdf341..e5b814faf 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java
@@ -105,10 +105,10 @@ public final class KeyboardLayoutSet {
int mMode;
EditorInfo mEditorInfo;
boolean mDisableTouchPositionCorrectionDataForTest;
- boolean mVoiceKeyEnabled;
- // TODO: Remove mVoiceKeyOnMain when it's certainly confirmed that we no longer show
- // the voice input key on the symbol layout
- boolean mVoiceKeyOnMain;
+ boolean mIsPasswordField;
+ boolean mSupportsSwitchingToShortcutIme;
+ boolean mShowsVoiceInputKey;
+ boolean mNoMicrophoneKey;
boolean mNoSettingsKey;
boolean mLanguageSwitchKeyEnabled;
InputMethodSubtype mSubtype;
@@ -221,16 +221,24 @@ public final class KeyboardLayoutSet {
private static final EditorInfo EMPTY_EDITOR_INFO = new EditorInfo();
- public Builder(final Context context, final EditorInfo editorInfo) {
+ public Builder(final Context context, final EditorInfo ei) {
mContext = context;
mPackageName = context.getPackageName();
mResources = context.getResources();
final Params params = mParams;
+ final EditorInfo editorInfo = (ei != null) ? ei : EMPTY_EDITOR_INFO;
params.mMode = getKeyboardMode(editorInfo);
- params.mEditorInfo = (editorInfo != null) ? editorInfo : EMPTY_EDITOR_INFO;
+ params.mEditorInfo = editorInfo;
+ params.mIsPasswordField = InputTypeUtils.isPasswordInputType(editorInfo.inputType);
+ @SuppressWarnings("deprecation")
+ final boolean deprecatedNoMicrophone = InputAttributes.inPrivateImeOptions(
+ null, NO_MICROPHONE_COMPAT, editorInfo);
+ params.mNoMicrophoneKey = InputAttributes.inPrivateImeOptions(
+ mPackageName, NO_MICROPHONE, editorInfo)
+ || deprecatedNoMicrophone;
params.mNoSettingsKey = InputAttributes.inPrivateImeOptions(
- mPackageName, NO_SETTINGS_KEY, params.mEditorInfo);
+ mPackageName, NO_SETTINGS_KEY, editorInfo);
}
public Builder setKeyboardGeometry(final int keyboardWidth, final int keyboardHeight) {
@@ -261,18 +269,11 @@ public final class KeyboardLayoutSet {
return this;
}
- // TODO: Remove mVoiceKeyOnMain when it's certainly confirmed that we no longer show
- // the voice input key on the symbol layout
- public Builder setOptions(final boolean voiceKeyEnabled, final boolean voiceKeyOnMain,
- final boolean languageSwitchKeyEnabled) {
- @SuppressWarnings("deprecation")
- final boolean deprecatedNoMicrophone = InputAttributes.inPrivateImeOptions(
- null, NO_MICROPHONE_COMPAT, mParams.mEditorInfo);
- final boolean noMicrophone = InputAttributes.inPrivateImeOptions(
- mPackageName, NO_MICROPHONE, mParams.mEditorInfo)
- || deprecatedNoMicrophone;
- mParams.mVoiceKeyEnabled = voiceKeyEnabled && !noMicrophone;
- mParams.mVoiceKeyOnMain = voiceKeyOnMain;
+ public Builder setOptions(final boolean isShortcutImeEnabled,
+ final boolean showsVoiceInputKey, final boolean languageSwitchKeyEnabled) {
+ mParams.mSupportsSwitchingToShortcutIme =
+ isShortcutImeEnabled && !mParams.mNoMicrophoneKey && !mParams.mIsPasswordField;
+ mParams.mShowsVoiceInputKey = showsVoiceInputKey;
mParams.mLanguageSwitchKeyEnabled = languageSwitchKeyEnabled;
return this;
}
@@ -368,9 +369,6 @@ public final class KeyboardLayoutSet {
}
private static int getKeyboardMode(final EditorInfo editorInfo) {
- if (editorInfo == null)
- return KeyboardId.MODE_TEXT;
-
final int inputType = editorInfo.inputType;
final int variation = inputType & InputType.TYPE_MASK_VARIATION;