diff options
author | 2011-01-24 15:45:20 +0000 | |
---|---|---|
committer | 2011-01-24 15:45:20 +0000 | |
commit | 35f1c6a73cef75c3a966ea8347e9ed70ad88a2ea (patch) | |
tree | fe475986a8da7f15bca1196fd49f2c3695e6e87e /java/src/com/android/inputmethod/latin | |
parent | bd0de0f15108f5d08e2a734807255c30ea3030c7 (diff) | |
download | latinime-35f1c6a73cef75c3a966ea8347e9ed70ad88a2ea.tar.gz latinime-35f1c6a73cef75c3a966ea8347e9ed70ad88a2ea.tar.xz latinime-35f1c6a73cef75c3a966ea8347e9ed70ad88a2ea.zip |
Fix resetting the status of VoiceIME when the user is switching from one VoiceIME to another Voice IME
Change-Id: Ibbbe3ed6c4e2e7e3c1266daddf109742bd8d97b6
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r-- | java/src/com/android/inputmethod/latin/SubtypeSwitcher.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java index 01e09fbc0..7a1ac2e27 100644 --- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java +++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java @@ -223,6 +223,9 @@ public class SubtypeSwitcher { } mMode = newMode; } + + // If the old mode is voice input, we need to reset or cancel its status. + // We cancel its status when we change mode, while we reset otherwise. if (isKeyboardMode()) { if (modeChanged) { if (VOICE_MODE.equals(oldMode) && mVoiceInput != null) { @@ -233,17 +236,23 @@ public class SubtypeSwitcher { updateShortcutIME(); mService.onRefreshKeyboard(); } - } else if (isVoiceMode()) { + } else if (isVoiceMode() && mVoiceInput != null) { + if (VOICE_MODE.equals(oldMode)) { + mVoiceInput.reset(); + } // If needsToShowWarningDialog is true, voice input need to show warning before // show recognition view. if (languageChanged || modeChanged || VoiceIMEConnector.getInstance().needsToShowWarningDialog()) { - if (mVoiceInput != null) { - triggerVoiceIME(); - } + triggerVoiceIME(); } } else { Log.w(TAG, "Unknown subtype mode: " + mMode); + if (VOICE_MODE.equals(oldMode) && mVoiceInput != null) { + // We need to reset the voice input to release the resources and to reset its status + // as it is not the current input mode. + mVoiceInput.reset(); + } } } |