aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-10-14 18:13:18 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-14 18:13:18 -0700
commitace15025c3ccc2bb351490836c01958dfd45ca34 (patch)
treead149dd52d9b7d521945e96d36fcc819566eb0ee /java/src
parent913730d6e7202d71f36dc1b727bb2bd3592f0dee (diff)
parent0661496ee0988391f9214616ef091625bcc7f8cb (diff)
downloadlatinime-ace15025c3ccc2bb351490836c01958dfd45ca34.tar.gz
latinime-ace15025c3ccc2bb351490836c01958dfd45ca34.tar.xz
latinime-ace15025c3ccc2bb351490836c01958dfd45ca34.zip
Merge "Follow up change of I8b38e280 (DO NOT MERGE)" into gingerbread
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/KeyboardSwitcher.java3
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java4
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboard.java45
3 files changed, 28 insertions, 24 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index 86dbf1f60..a7b695eb3 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -260,7 +260,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mMode = mode;
mImeOptions = imeOptions;
if (enableVoice != mHasVoice) {
- setVoiceMode(mHasVoice, mVoiceOnPrimary);
+ // TODO clean up this unnecessary recursive call.
+ setVoiceMode(enableVoice, mVoiceOnPrimary);
}
mIsSymbols = isSymbols;
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 4e0f7c56b..b6fee1170 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -2329,8 +2329,8 @@ public class LatinIME extends InputMethodService
private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo attribute) {
return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext)
- && !(attribute != null && attribute.privateImeOptions != null
- && attribute.privateImeOptions.equals(IME_OPTION_NO_MICROPHONE))
+ && !(attribute != null
+ && IME_OPTION_NO_MICROPHONE.equals(attribute.privateImeOptions))
&& SpeechRecognizer.isRecognitionAvailable(this);
}
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
index cf702f391..e33ae145b 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
@@ -336,7 +336,7 @@ public class LatinKeyboard extends Keyboard {
mMicIcon = mRes.getDrawable(R.drawable.sym_keyboard_mic);
m123MicIcon = mRes.getDrawable(R.drawable.sym_keyboard_123_mic);
}
- updateF1Key();
+ updateDynamicKeys();
if (mSpaceKey != null) {
updateSpaceBarForLocale(isAutoCompletion, isBlack);
}
@@ -350,11 +350,11 @@ public class LatinKeyboard extends Keyboard {
public void setVoiceMode(boolean hasVoiceButton, boolean hasVoice) {
mHasVoiceButton = hasVoiceButton;
mVoiceEnabled = hasVoice;
- updateF1Key();
+ updateDynamicKeys();
}
- private void updateF1Key() {
- if (mF1Key == null) return;
+ private void updateDynamicKeys() {
+ // Update KEYCODE_MODE_CHANGE key only on alphabet mode, not on symbol mode.
if (m123Key != null && mIsAlphaKeyboard) {
if (mVoiceEnabled && !mHasVoiceButton) {
m123Key.icon = m123MicIcon;
@@ -367,23 +367,26 @@ public class LatinKeyboard extends Keyboard {
}
}
- if (mHasVoiceButton && mVoiceEnabled) {
- mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE };
- mF1Key.label = null;
- // HACK: draw mMicIcon and mF1HintIcon at the same time
- mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage(
- mF1Key.width, mF1Key.height + mVerticalGap, mMicIcon, mF1HintIcon));
- mF1Key.iconPreview = mMicPreviewIcon;
- mF1Key.popupResId = R.xml.popup_mic;
- } else {
- mF1Key.label = ",";
- mF1Key.codes = new int[] { ',' };
- // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to the
- // above synthesized icon
- mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage(
- mF1Key.width, mF1Key.height + mVerticalGap, null, mF1HintIcon));
- mF1Key.iconPreview = null;
- mF1Key.popupResId = R.xml.popup_comma;
+ // Update KEYCODE_F1 key. Please note that some keyboard layout has no F1 key.
+ if (mF1Key != null) {
+ if (mHasVoiceButton && mVoiceEnabled) {
+ mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE };
+ mF1Key.label = null;
+ // HACK: draw mMicIcon and mF1HintIcon at the same time
+ mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage(
+ mF1Key.width, mF1Key.height + mVerticalGap, mMicIcon, mF1HintIcon));
+ mF1Key.iconPreview = mMicPreviewIcon;
+ mF1Key.popupResId = R.xml.popup_mic;
+ } else {
+ mF1Key.label = ",";
+ mF1Key.codes = new int[] { ',' };
+ // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to
+ // the above synthesized icon
+ mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage(
+ mF1Key.width, mF1Key.height + mVerticalGap, null, mF1HintIcon));
+ mF1Key.iconPreview = null;
+ mF1Key.popupResId = R.xml.popup_comma;
+ }
}
}