Resolve a todo
This exports some voiceproxy complexity to voiceproxy rather than keeping it in latinime Change-Id: I0b3523e77af4104cc3ed28417956059c734c8bfemain
parent
49aa5856a4
commit
3cd1a00eca
|
@ -92,6 +92,7 @@ public class VoiceProxy implements VoiceInput.UiListener {
|
||||||
private static final boolean DEBUG = LatinImeLogger.sDBG;
|
private static final boolean DEBUG = LatinImeLogger.sDBG;
|
||||||
|
|
||||||
private boolean mAfterVoiceInput;
|
private boolean mAfterVoiceInput;
|
||||||
|
private boolean mConfigurationChanging;
|
||||||
private boolean mHasUsedVoiceInput;
|
private boolean mHasUsedVoiceInput;
|
||||||
private boolean mHasUsedVoiceInputUnsupportedLocale;
|
private boolean mHasUsedVoiceInputUnsupportedLocale;
|
||||||
private boolean mImmediatelyAfterVoiceInput;
|
private boolean mImmediatelyAfterVoiceInput;
|
||||||
|
@ -159,11 +160,11 @@ public class VoiceProxy implements VoiceInput.UiListener {
|
||||||
mPasswordText = isPasswordText;
|
mPasswordText = isPasswordText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flushVoiceInputLogs(boolean configurationChanged) {
|
public void flushVoiceInputLogs() {
|
||||||
if (!VOICE_INSTALLED) {
|
if (!VOICE_INSTALLED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!configurationChanged) {
|
if (!mConfigurationChanging) {
|
||||||
if (mAfterVoiceInput) {
|
if (mAfterVoiceInput) {
|
||||||
mVoiceInput.flushAllTextModificationCounters();
|
mVoiceInput.flushAllTextModificationCounters();
|
||||||
mVoiceInput.logInputEnded();
|
mVoiceInput.logInputEnded();
|
||||||
|
@ -318,11 +319,11 @@ public class VoiceProxy implements VoiceInput.UiListener {
|
||||||
mImmediatelyAfterVoiceInput = false;
|
mImmediatelyAfterVoiceInput = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideVoiceWindow(boolean configurationChanging) {
|
public void hideVoiceWindow() {
|
||||||
if (!VOICE_INSTALLED) {
|
if (!VOICE_INSTALLED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!configurationChanging) {
|
if (!mConfigurationChanging) {
|
||||||
if (mAfterVoiceInput)
|
if (mAfterVoiceInput)
|
||||||
mVoiceInput.logInputEnded();
|
mVoiceInput.logInputEnded();
|
||||||
if (mVoiceWarningDialog != null && mVoiceWarningDialog.isShowing()) {
|
if (mVoiceWarningDialog != null && mVoiceWarningDialog.isShowing()) {
|
||||||
|
@ -842,4 +843,12 @@ public class VoiceProxy implements VoiceInput.UiListener {
|
||||||
SettingsUtil.LATIN_IME_VOICE_INPUT_SUPPORTED_LOCALES,
|
SettingsUtil.LATIN_IME_VOICE_INPUT_SUPPORTED_LOCALES,
|
||||||
DEFAULT_VOICE_INPUT_SUPPORTED_LOCALES);
|
DEFAULT_VOICE_INPUT_SUPPORTED_LOCALES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void startChangingConfiguration() {
|
||||||
|
mConfigurationChanging = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishChangingConfiguration() {
|
||||||
|
mConfigurationChanging = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,9 +223,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
|
|
||||||
private VibratorCompatWrapper mVibrator;
|
private VibratorCompatWrapper mVibrator;
|
||||||
|
|
||||||
// TODO: Move this flag to VoiceProxy
|
|
||||||
private boolean mConfigurationChanging;
|
|
||||||
|
|
||||||
// Member variables for remembering the current device orientation.
|
// Member variables for remembering the current device orientation.
|
||||||
private int mDisplayOrientation;
|
private int mDisplayOrientation;
|
||||||
|
|
||||||
|
@ -664,10 +661,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
mOptionsDialog.dismiss();
|
mOptionsDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
mConfigurationChanging = true;
|
mVoiceProxy.startChangingConfiguration();
|
||||||
super.onConfigurationChanged(conf);
|
super.onConfigurationChanged(conf);
|
||||||
mVoiceProxy.onConfigurationChanged(conf);
|
mVoiceProxy.onConfigurationChanged(conf);
|
||||||
mConfigurationChanging = false;
|
mVoiceProxy.finishChangingConfiguration();
|
||||||
|
|
||||||
// This will work only when the subtype is not supported.
|
// This will work only when the subtype is not supported.
|
||||||
LanguageSwitcherProxy.onConfigurationChanged(conf);
|
LanguageSwitcherProxy.onConfigurationChanged(conf);
|
||||||
|
@ -830,7 +827,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
|
|
||||||
LatinImeLogger.commit();
|
LatinImeLogger.commit();
|
||||||
|
|
||||||
mVoiceProxy.flushVoiceInputLogs(mConfigurationChanging);
|
mVoiceProxy.flushVoiceInputLogs();
|
||||||
|
|
||||||
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
||||||
if (inputView != null) inputView.closing();
|
if (inputView != null) inputView.closing();
|
||||||
|
@ -960,7 +957,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
mOptionsDialog.dismiss();
|
mOptionsDialog.dismiss();
|
||||||
mOptionsDialog = null;
|
mOptionsDialog = null;
|
||||||
}
|
}
|
||||||
mVoiceProxy.hideVoiceWindow(mConfigurationChanging);
|
mVoiceProxy.hideVoiceWindow();
|
||||||
super.hideWindow();
|
super.hideWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue