Merge "Follow up change of I8b38e280 (DO NOT MERGE)" into gingerbread

main
Tadashi G. Takaoka 2010-10-14 18:13:18 -07:00 committed by Android (Google) Code Review
commit ace15025c3
3 changed files with 28 additions and 24 deletions

View File

@ -260,7 +260,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mMode = mode; mMode = mode;
mImeOptions = imeOptions; mImeOptions = imeOptions;
if (enableVoice != mHasVoice) { if (enableVoice != mHasVoice) {
setVoiceMode(mHasVoice, mVoiceOnPrimary); // TODO clean up this unnecessary recursive call.
setVoiceMode(enableVoice, mVoiceOnPrimary);
} }
mIsSymbols = isSymbols; mIsSymbols = isSymbols;

View File

@ -2329,8 +2329,8 @@ public class LatinIME extends InputMethodService
private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo attribute) { private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo attribute) {
return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext) return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext)
&& !(attribute != null && attribute.privateImeOptions != null && !(attribute != null
&& attribute.privateImeOptions.equals(IME_OPTION_NO_MICROPHONE)) && IME_OPTION_NO_MICROPHONE.equals(attribute.privateImeOptions))
&& SpeechRecognizer.isRecognitionAvailable(this); && SpeechRecognizer.isRecognitionAvailable(this);
} }

View File

@ -336,7 +336,7 @@ public class LatinKeyboard extends Keyboard {
mMicIcon = mRes.getDrawable(R.drawable.sym_keyboard_mic); mMicIcon = mRes.getDrawable(R.drawable.sym_keyboard_mic);
m123MicIcon = mRes.getDrawable(R.drawable.sym_keyboard_123_mic); m123MicIcon = mRes.getDrawable(R.drawable.sym_keyboard_123_mic);
} }
updateF1Key(); updateDynamicKeys();
if (mSpaceKey != null) { if (mSpaceKey != null) {
updateSpaceBarForLocale(isAutoCompletion, isBlack); updateSpaceBarForLocale(isAutoCompletion, isBlack);
} }
@ -350,11 +350,11 @@ public class LatinKeyboard extends Keyboard {
public void setVoiceMode(boolean hasVoiceButton, boolean hasVoice) { public void setVoiceMode(boolean hasVoiceButton, boolean hasVoice) {
mHasVoiceButton = hasVoiceButton; mHasVoiceButton = hasVoiceButton;
mVoiceEnabled = hasVoice; mVoiceEnabled = hasVoice;
updateF1Key(); updateDynamicKeys();
} }
private void updateF1Key() { private void updateDynamicKeys() {
if (mF1Key == null) return; // Update KEYCODE_MODE_CHANGE key only on alphabet mode, not on symbol mode.
if (m123Key != null && mIsAlphaKeyboard) { if (m123Key != null && mIsAlphaKeyboard) {
if (mVoiceEnabled && !mHasVoiceButton) { if (mVoiceEnabled && !mHasVoiceButton) {
m123Key.icon = m123MicIcon; m123Key.icon = m123MicIcon;
@ -367,23 +367,26 @@ public class LatinKeyboard extends Keyboard {
} }
} }
if (mHasVoiceButton && mVoiceEnabled) { // Update KEYCODE_F1 key. Please note that some keyboard layout has no F1 key.
mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; if (mF1Key != null) {
mF1Key.label = null; if (mHasVoiceButton && mVoiceEnabled) {
// HACK: draw mMicIcon and mF1HintIcon at the same time mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE };
mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( mF1Key.label = null;
mF1Key.width, mF1Key.height + mVerticalGap, mMicIcon, mF1HintIcon)); // HACK: draw mMicIcon and mF1HintIcon at the same time
mF1Key.iconPreview = mMicPreviewIcon; mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage(
mF1Key.popupResId = R.xml.popup_mic; mF1Key.width, mF1Key.height + mVerticalGap, mMicIcon, mF1HintIcon));
} else { mF1Key.iconPreview = mMicPreviewIcon;
mF1Key.label = ","; mF1Key.popupResId = R.xml.popup_mic;
mF1Key.codes = new int[] { ',' }; } else {
// HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to the mF1Key.label = ",";
// above synthesized icon mF1Key.codes = new int[] { ',' };
mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to
mF1Key.width, mF1Key.height + mVerticalGap, null, mF1HintIcon)); // the above synthesized icon
mF1Key.iconPreview = null; mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage(
mF1Key.popupResId = R.xml.popup_comma; mF1Key.width, mF1Key.height + mVerticalGap, null, mF1HintIcon));
mF1Key.iconPreview = null;
mF1Key.popupResId = R.xml.popup_comma;
}
} }
} }