diff options
author | 2011-04-01 00:35:57 -0700 | |
---|---|---|
committer | 2011-04-01 00:35:57 -0700 | |
commit | 44783b6965e741d9690d3d215b6ec60931a47397 (patch) | |
tree | 9e961391bc3056567ecbd42a360ca20f85e700a2 /java/src/com/android/inputmethod/deprecated/VoiceProxy.java | |
parent | 6f18a1fbcccf9cf5ca937b08098601a4fafead29 (diff) | |
parent | 742900983830386f04ccb004cd4356c8b08c61d0 (diff) | |
download | latinime-44783b6965e741d9690d3d215b6ec60931a47397.tar.gz latinime-44783b6965e741d9690d3d215b6ec60931a47397.tar.xz latinime-44783b6965e741d9690d3d215b6ec60931a47397.zip |
Merge "Enable VoiceInput even if there is no shortcut subtype supported"
Diffstat (limited to 'java/src/com/android/inputmethod/deprecated/VoiceProxy.java')
-rw-r--r-- | java/src/com/android/inputmethod/deprecated/VoiceProxy.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java index 5fba29d90..0d0591bd0 100644 --- a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java +++ b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java @@ -82,6 +82,8 @@ public class VoiceProxy implements VoiceInput.UiListener { private static final String PREF_HAS_USED_VOICE_INPUT_UNSUPPORTED_LOCALE = "has_used_voice_input_unsupported_locale"; private static final int RECOGNITIONVIEW_HEIGHT_THRESHOLD_RATIO = 6; + // TODO: Adjusted on phones for now + private static final int RECOGNITIONVIEW_MINIMUM_HEIGHT_DIP = 244; private static final String TAG = VoiceProxy.class.getSimpleName(); private static final boolean DEBUG = LatinImeLogger.sDBG; @@ -99,6 +101,7 @@ public class VoiceProxy implements VoiceInput.UiListener { private boolean mVoiceButtonOnPrimary; private boolean mVoiceInputHighlighted; + private int mMinimumVoiceRecognitionViewHeightPixel; private InputMethodManagerCompatWrapper mImm; private LatinIME mService; private AlertDialog mVoiceWarningDialog; @@ -107,6 +110,7 @@ public class VoiceProxy implements VoiceInput.UiListener { private Hints mHints; private UIHandler mHandler; private SubtypeSwitcher mSubtypeSwitcher; + // For each word, a list of potential replacements, usually from voice. private final Map<String, List<CharSequence>> mWordToSuggestions = new HashMap<String, List<CharSequence>>(); @@ -123,6 +127,8 @@ public class VoiceProxy implements VoiceInput.UiListener { private void initInternal(LatinIME service, SharedPreferences prefs, UIHandler h) { mService = service; mHandler = h; + mMinimumVoiceRecognitionViewHeightPixel = Utils.dipToPixel( + Utils.getDipScale(service), RECOGNITIONVIEW_MINIMUM_HEIGHT_DIP); mImm = InputMethodManagerCompatWrapper.getInstance(service); mSubtypeSwitcher = SubtypeSwitcher.getInstance(); if (VOICE_INSTALLED) { @@ -542,7 +548,11 @@ public class VoiceProxy implements VoiceInput.UiListener { mService.getResources().getDisplayMetrics().heightPixels; final int currentHeight = popupLayout.getLayoutParams().height; final int keyboardHeight = keyboardView.getHeight(); - if (keyboardHeight > currentHeight || keyboardHeight + if (mMinimumVoiceRecognitionViewHeightPixel > keyboardHeight + || mMinimumVoiceRecognitionViewHeightPixel > currentHeight) { + popupLayout.getLayoutParams().height = + mMinimumVoiceRecognitionViewHeightPixel; + } else if (keyboardHeight > currentHeight || keyboardHeight > (displayHeight / RECOGNITIONVIEW_HEIGHT_THRESHOLD_RATIO)) { popupLayout.getLayoutParams().height = keyboardHeight; } |