aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-01-17 23:47:52 +0900
committerTadashi G. Takaoka <takaoka@google.com>2011-01-18 11:41:12 +0900
commitd5a6b910e83de6dea3c5813cbf5e219abaccdf8a (patch)
tree43b156a3933bcef9164580ac63eb3271fee68cf4 /java/src
parent98353076909cad1c4bbdd70b9f2b3db5d48cea6d (diff)
downloadlatinime-d5a6b910e83de6dea3c5813cbf5e219abaccdf8a.tar.gz
latinime-d5a6b910e83de6dea3c5813cbf5e219abaccdf8a.tar.xz
latinime-d5a6b910e83de6dea3c5813cbf5e219abaccdf8a.zip
Purge keyboard only when voice input will be invoked
This change also draws the language name in light gray on spacebar without fading out even when the keyboard locale has not been changed. Bug: 3362369 Bug: 3361915 Change-Id: I66538b03ce2e48c3441091319d0377176f8118ec
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java7
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java6
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java15
-rw-r--r--java/src/com/android/inputmethod/voice/VoiceIMEConnector.java2
4 files changed, 18 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 42af8a8d6..68d3ccd84 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -161,9 +161,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
final Keyboard oldKeyboard = mInputView.getKeyboard();
loadKeyboardInternal(mode, imeOptions, voiceKeyEnabled, voiceButtonOnPrimary, false);
final Keyboard newKeyboard = mInputView.getKeyboard();
- if (newKeyboard.isAlphaKeyboard() && (oldKeyboard == null
- || !newKeyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale))) {
- mInputMethodService.mHandler.startDisplayLanguageOnSpacebar();
+ if (newKeyboard.isAlphaKeyboard()) {
+ final boolean localeChanged = (oldKeyboard == null)
+ || !newKeyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
+ mInputMethodService.mHandler.startDisplayLanguageOnSpacebar(localeChanged);
}
} catch (RuntimeException e) {
Log.w(TAG, e);
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index b1815a146..766fdf0e6 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -1404,11 +1404,15 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
dismissPopupKeyboard();
mBuffer = null;
mCanvas = null;
- mKeyboard = null;
mMiniKeyboardCache.clear();
requestLayout();
}
+ public void purgeKeyboardAndClosing() {
+ mKeyboard = null;
+ closing();
+ }
+
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 5766f6b38..cd4143e78 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -154,7 +154,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private boolean mConfigSwipeDownDismissKeyboardEnabled;
private int mConfigDelayBeforeFadeoutLanguageOnSpacebar;
private int mConfigDurationOfFadeoutLanguageOnSpacebar;
- private float mConfigFinalFadeoutFactorOfLanugageOnSpacebar;
+ private float mConfigFinalFadeoutFactorOfLanguageOnSpacebar;
private int mCorrectionMode;
private int mCommittedLength;
@@ -269,7 +269,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
case MSG_FADEOUT_LANGUAGE_ON_SPACEBAR:
if (inputView != null)
inputView.setSpacebarTextFadeFactor(
- (1.0f + mConfigFinalFadeoutFactorOfLanugageOnSpacebar) / 2,
+ (1.0f + mConfigFinalFadeoutFactorOfLanguageOnSpacebar) / 2,
(LatinKeyboard)msg.obj);
sendMessageDelayed(obtainMessage(MSG_DISMISS_LANGUAGE_ON_SPACEBAR, msg.obj),
mConfigDurationOfFadeoutLanguageOnSpacebar);
@@ -277,7 +277,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
case MSG_DISMISS_LANGUAGE_ON_SPACEBAR:
if (inputView != null)
inputView.setSpacebarTextFadeFactor(
- mConfigFinalFadeoutFactorOfLanugageOnSpacebar, (LatinKeyboard)msg.obj);
+ mConfigFinalFadeoutFactorOfLanguageOnSpacebar, (LatinKeyboard)msg.obj);
break;
}
}
@@ -318,7 +318,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
sendMessage(obtainMessage(MSG_VOICE_RESULTS));
}
- public void startDisplayLanguageOnSpacebar() {
+ public void startDisplayLanguageOnSpacebar(boolean localeChanged) {
removeMessages(MSG_FADEOUT_LANGUAGE_ON_SPACEBAR);
removeMessages(MSG_DISMISS_LANGUAGE_ON_SPACEBAR);
final LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
@@ -326,9 +326,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final LatinKeyboard keyboard = inputView.getLatinKeyboard();
// The language is never displayed when the delay is zero.
if (mConfigDelayBeforeFadeoutLanguageOnSpacebar != 0)
- inputView.setSpacebarTextFadeFactor(1.0f, keyboard);
+ inputView.setSpacebarTextFadeFactor(localeChanged ? 1.0f
+ : mConfigFinalFadeoutFactorOfLanguageOnSpacebar, keyboard);
// The language is always displayed when the delay is negative.
- if (mConfigDelayBeforeFadeoutLanguageOnSpacebar > 0) {
+ if (localeChanged && mConfigDelayBeforeFadeoutLanguageOnSpacebar > 0) {
sendMessageDelayed(obtainMessage(MSG_FADEOUT_LANGUAGE_ON_SPACEBAR, keyboard),
mConfigDelayBeforeFadeoutLanguageOnSpacebar);
}
@@ -360,7 +361,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
R.integer.config_delay_before_fadeout_language_on_spacebar);
mConfigDurationOfFadeoutLanguageOnSpacebar = res.getInteger(
R.integer.config_duration_of_fadeout_language_on_spacebar);
- mConfigFinalFadeoutFactorOfLanugageOnSpacebar = res.getInteger(
+ mConfigFinalFadeoutFactorOfLanguageOnSpacebar = res.getInteger(
R.integer.config_final_fadeout_percentage_of_language_on_spacebar) / 100.0f;
Utils.GCUtils.getInstance().reset();
diff --git a/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java b/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java
index 715486147..9a6c3a83a 100644
--- a/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java
+++ b/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java
@@ -631,7 +631,7 @@ public class VoiceIMEConnector implements VoiceInput.UiListener {
if (mSubtypeSwitcher.isVoiceMode() && token != null) {
// Close keyboard view if it is been shown.
if (KeyboardSwitcher.getInstance().isInputViewShown())
- KeyboardSwitcher.getInstance().getInputView().closing();
+ KeyboardSwitcher.getInstance().getInputView().purgeKeyboardAndClosing();
startListening(false, token, false);
}
// If we have no token, onAttachedToWindow will take care of showing dialog and start