diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
4 files changed, 16 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index b5dd3eed4..5db6e63d0 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -700,6 +700,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha mInputView.setOnKeyboardActionListener(mInputMethodService); mLayoutId = newLayout; } + // TODO: Not to post if this function was called from loadKeyboardView mInputMethodService.mHandler.post(new Runnable() { public void run() { if (mInputView != null) { diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 6554954ee..d069e00fb 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -632,8 +632,7 @@ public class LatinIME extends InputMethodService checkTutorial(attribute.privateImeOptions); inputView.setForeground(true); - // TODO: Not to show keyboard if IME starts in Voice One shot mode. - mVoiceConnector.onStartInputView(); + mVoiceConnector.onStartInputView(mKeyboardSwitcher.getInputView().getWindowToken()); if (TRACE) Debug.startMethodTracing("/data/trace/latinime"); } diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java index 4fcfe01ba..ac68e3c39 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin; import com.android.inputmethod.latin.BaseKeyboard.Key; +import com.android.inputmethod.voice.VoiceIMEConnector; import android.content.Context; import android.graphics.Canvas; @@ -366,4 +367,10 @@ public class LatinKeyboardView extends BaseKeyboardView { c.drawLine(0, mLastY, getWidth(), mLastY, mPaint); } } + + @Override + protected void onAttachedToWindow() { + // Token is available from here. + VoiceIMEConnector.getInstance().onAttachedToWindow(); + } } diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java index df123c9f4..7cf055672 100644 --- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java +++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin; import com.android.inputmethod.voice.SettingsUtil; +import com.android.inputmethod.voice.VoiceIMEConnector; import com.android.inputmethod.voice.VoiceInput; import android.content.Context; @@ -189,7 +190,10 @@ public class SubtypeSwitcher { mService.onKeyboardLanguageChanged(); } } else if (isVoiceMode()) { - if (languageChanged || modeChanged) { + // If needsToShowWarningDialog is true, voice input need to show warning before + // show recognition view. + if (languageChanged || modeChanged + || VoiceIMEConnector.getInstance().needsToShowWarningDialog()) { if (mVoiceInput != null) { // TODO: Call proper function to trigger VoiceIME mService.onKey(LatinKeyboardView.KEYCODE_VOICE, null, 0, 0); @@ -340,16 +344,15 @@ public class SubtypeSwitcher { /////////////////////////// public boolean setVoiceInput(VoiceInput vi) { - if (mVoiceInput == null) { + if (mVoiceInput == null && vi != null) { // TODO: Remove requirements to construct KeyboardSwitcher // when IME was enabled with Voice mode mService.onKeyboardLanguageChanged(); mVoiceInput = vi; - if (isVoiceMode() && mVoiceInput != null) { + if (isVoiceMode()) { if (DBG) { Log.d(TAG, "Set and call voice input."); } - // TODO: Call proper function to enable VoiceIME mService.onKey(LatinKeyboardView.KEYCODE_VOICE, null, 0, 0); return true; } |