aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java21
-rw-r--r--java/src/com/android/inputmethod/latin/Settings.java15
2 files changed, 22 insertions, 14 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index e5d2f7578..5d8fd3411 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -542,15 +542,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
TextEntryState.reset();
- if (attribute != null) {
- // Most such things we decide below in initializeInputAttributesAndGetMode, but we need
- // to know now whether this is a password text field, because we need to know now
- // whether we want to enable the voice button.
- mVoiceProxy.resetVoiceStates(
- InputTypeCompatUtils.isPasswordInputType(attribute.inputType)
- || InputTypeCompatUtils.isVisiblePasswordInputType(
- attribute.inputType));
- }
+ // Most such things we decide below in initializeInputAttributesAndGetMode, but we need to
+ // know now whether this is a password text field, because we need to know now whether we
+ // want to enable the voice button.
+ final VoiceProxy voiceIme = mVoiceProxy;
+ voiceIme.resetVoiceStates(InputTypeCompatUtils.isPasswordInputType(attribute.inputType)
+ || InputTypeCompatUtils.isVisiblePasswordInputType(attribute.inputType));
initializeInputAttributes(attribute);
@@ -576,8 +573,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mSubtypeSwitcher.isKeyboardMode()) {
switcher.loadKeyboard(attribute,
- mSubtypeSwitcher.isShortcutImeEnabled() && mVoiceProxy.isVoiceButtonEnabled(),
- mVoiceProxy.isVoiceButtonOnPrimary());
+ mSubtypeSwitcher.isShortcutImeEnabled() && voiceIme.isVoiceButtonEnabled(),
+ voiceIme.isVoiceButtonOnPrimary());
switcher.updateShiftState();
}
@@ -595,7 +592,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// If we just entered a text field, maybe it has some old text that requires correction
mRecorrection.checkRecorrectionOnStart();
- mVoiceProxy.onStartInputView(inputView.getWindowToken());
+ voiceIme.onStartInputView(inputView.getWindowToken());
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
}
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index e665ee2f5..54f0a1b4d 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -304,6 +304,8 @@ public class Settings extends InputMethodSettingsActivity
private AlertDialog mDialog;
+ private VoiceProxy.VoiceLoggerWrapper mVoiceLogger;
+
private boolean mOkClicked = false;
private String mVoiceModeOff;
@@ -347,6 +349,7 @@ public class Settings extends InputMethodSettingsActivity
mVoiceModeOff = getString(R.string.voice_mode_off);
mVoiceOn = !(prefs.getString(PREF_VOICE_SETTINGS_KEY, mVoiceModeOff)
.equals(mVoiceModeOff));
+ mVoiceLogger = VoiceProxy.VoiceLoggerWrapper.getInstance(context);
mAutoCorrectionThreshold = (ListPreference) findPreference(PREF_AUTO_CORRECTION_THRESHOLD);
mBigramSuggestion = (CheckBoxPreference) findPreference(PREF_BIGRAM_SUGGESTIONS);
@@ -444,7 +447,6 @@ public class Settings extends InputMethodSettingsActivity
}
}
- @SuppressWarnings("unused")
@Override
public void onResume() {
super.onResume();
@@ -539,7 +541,6 @@ public class Settings extends InputMethodSettingsActivity
[mVoicePreference.findIndexOfValue(mVoicePreference.getValue())]);
}
- @Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case VOICE_INPUT_CONFIRM_DIALOG:
@@ -548,9 +549,12 @@ public class Settings extends InputMethodSettingsActivity
public void onClick(DialogInterface dialog, int whichButton) {
if (whichButton == DialogInterface.BUTTON_NEGATIVE) {
mVoicePreference.setValue(mVoiceModeOff);
+ mVoiceLogger.settingsWarningDialogCancel();
} else if (whichButton == DialogInterface.BUTTON_POSITIVE) {
mOkClicked = true;
+ mVoiceLogger.settingsWarningDialogOk();
}
+ updateVoicePreference();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivityInternal())
@@ -579,6 +583,7 @@ public class Settings extends InputMethodSettingsActivity
AlertDialog dialog = builder.create();
mDialog = dialog;
dialog.setOnDismissListener(this);
+ mVoiceLogger.settingsWarningDialogShown();
return dialog;
default:
Log.e(TAG, "unknown dialog " + id);
@@ -588,10 +593,16 @@ public class Settings extends InputMethodSettingsActivity
@Override
public void onDismiss(DialogInterface dialog) {
+ mVoiceLogger.settingsWarningDialogDismissed();
if (!mOkClicked) {
// This assumes that onPreferenceClick gets called first, and this if the user
// agreed after the warning, we set the mOkClicked value to true.
mVoicePreference.setValue(mVoiceModeOff);
}
}
+
+ private void updateVoicePreference() {
+ boolean isChecked = !mVoicePreference.getValue().equals(mVoiceModeOff);
+ mVoiceLogger.voiceInputSettingEnabled(isChecked);
+ }
}