aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-06-19 01:46:16 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-06-19 00:17:11 +0000
commitd89a34b0a1e7b5df7526e42027f8379a25baa291 (patch)
treebdf7d87925cd23761d5be9d106703db7c1a927ac /java/src
parent03288ef47fd93758b5665e19fe9b892ece6e586f (diff)
parent0351b816327ebddef0c4c1f95834645a4fab96fe (diff)
downloadlatinime-d89a34b0a1e7b5df7526e42027f8379a25baa291.tar.gz
latinime-d89a34b0a1e7b5df7526e42027f8379a25baa291.tar.xz
latinime-d89a34b0a1e7b5df7526e42027f8379a25baa291.zip
Merge "Hide voice input key from URI, Email, Number, and Phone layout"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/InputAttributes.java10
-rw-r--r--java/src/com/android/inputmethod/latin/settings/SettingsValues.java3
2 files changed, 10 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/InputAttributes.java b/java/src/com/android/inputmethod/latin/InputAttributes.java
index e1ae3dfe3..ebe436128 100644
--- a/java/src/com/android/inputmethod/latin/InputAttributes.java
+++ b/java/src/com/android/inputmethod/latin/InputAttributes.java
@@ -41,6 +41,7 @@ public final class InputAttributes {
final public boolean mShouldShowSuggestions;
final public boolean mApplicationSpecifiedCompletionOn;
final public boolean mShouldInsertSpacesAutomatically;
+ final public boolean mShouldShowVoiceInputKey;
final private int mInputType;
final private EditorInfo mEditorInfo;
final private String mPackageNameForPrivateImeOptions;
@@ -74,6 +75,7 @@ public final class InputAttributes {
mInputTypeNoAutoCorrect = false;
mApplicationSpecifiedCompletionOn = false;
mShouldInsertSpacesAutomatically = false;
+ mShouldShowVoiceInputKey = false;
return;
}
// inputClass == InputType.TYPE_CLASS_TEXT
@@ -99,6 +101,12 @@ public final class InputAttributes {
mShouldInsertSpacesAutomatically = InputTypeUtils.isAutoSpaceFriendlyType(inputType);
+ final boolean noMicrophone = mIsPasswordField
+ || InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS == variation
+ || InputType.TYPE_TEXT_VARIATION_URI == variation
+ || hasNoMicrophoneKeyOption();
+ mShouldShowVoiceInputKey = !noMicrophone;
+
// If it's a browser edit field and auto correct is not ON explicitly, then
// disable auto correction, but keep suggestions on.
// If NO_SUGGESTIONS is set, don't do prediction.
@@ -119,7 +127,7 @@ public final class InputAttributes {
return editorInfo.inputType == mInputType;
}
- public boolean hasNoMicrophoneKeyOption() {
+ private boolean hasNoMicrophoneKeyOption() {
@SuppressWarnings("deprecation")
final boolean deprecatedNoMicrophone = InputAttributes.inPrivateImeOptions(
null, NO_MICROPHONE_COMPAT, mEditorInfo);
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
index 44104019b..8de5fed07 100644
--- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
@@ -125,8 +125,7 @@ public final class SettingsValues {
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res)
- && !mInputAttributes.mIsPasswordField
- && !mInputAttributes.hasNoMicrophoneKeyOption()
+ && mInputAttributes.mShouldShowVoiceInputKey
&& SubtypeSwitcher.getInstance().isShortcutImeEnabled();
final String autoCorrectionThresholdRawValue = prefs.getString(
Settings.PREF_AUTO_CORRECTION_THRESHOLD,