aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/SettingsValues.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SettingsValues.java')
-rw-r--r--java/src/com/android/inputmethod/latin/SettingsValues.java50
1 files changed, 33 insertions, 17 deletions
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index da4acea50..d6d6c6c88 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -76,9 +76,7 @@ public class SettingsValues {
@SuppressWarnings("unused") // TODO: Use this
private final String mKeyPreviewPopupDismissDelayRawValue;
public final boolean mUseContactsDict;
- // Suggestion: use bigrams to adjust scores of suggestions obtained from unigram dictionary
- public final boolean mBigramSuggestionEnabled;
- // Prediction: use bigrams to predict the next word when there is no input for it yet
+ // Use bigrams to predict the next word when there is no input for it yet
public final boolean mBigramPredictionEnabled;
public final boolean mEnableSuggestionSpanInsertion;
@SuppressWarnings("unused") // TODO: Use this
@@ -87,6 +85,9 @@ public class SettingsValues {
private final float mKeypressSoundVolumeRawValue;
private final InputMethodSubtype[] mAdditionalSubtypes;
+ // From the input box
+ private final InputAttributes mInputAttributes;
+
// Deduced settings
public final int mKeypressVibrationDuration;
public final float mFxVolume;
@@ -125,6 +126,13 @@ public class SettingsValues {
mSymbolsExcludedFromWordSeparators, res);
mHintToSaveText = context.getText(R.string.hint_add_to_dictionary);
+ // Store the input attributes
+ if (null == inputAttributes) {
+ mInputAttributes = new InputAttributes(null, false /* isFullscreenMode */);
+ } else {
+ mInputAttributes = inputAttributes;
+ }
+
// Get the settings preferences
mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true);
mVibrateOn = isVibrateOn(context, prefs, res);
@@ -147,10 +155,7 @@ public class SettingsValues {
Integer.toString(res.getInteger(R.integer.config_key_preview_linger_timeout)));
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
mAutoCorrectEnabled = isAutoCorrectEnabled(res, mAutoCorrectionThresholdRawValue);
- mBigramSuggestionEnabled = mAutoCorrectEnabled
- && isBigramSuggestionEnabled(prefs, res, mAutoCorrectEnabled);
- mBigramPredictionEnabled = mBigramSuggestionEnabled
- && isBigramPredictionEnabled(prefs, res);
+ mBigramPredictionEnabled = isBigramPredictionEnabled(prefs, res);
// TODO: remove mEnableSuggestionSpanInsertion. It's always true.
mEnableSuggestionSpanInsertion = true;
mVibrationDurationSettingsRawValue =
@@ -167,7 +172,7 @@ public class SettingsValues {
mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain);
mAdditionalSubtypes = AdditionalSubtype.createAdditionalSubtypesArray(
getPrefAdditionalSubtypes(prefs, res));
- mCorrectionMode = createCorrectionMode(inputAttributes);
+ mCorrectionMode = createCorrectionMode();
mSuggestionVisibility = createSuggestionVisibility(res);
}
@@ -201,10 +206,10 @@ public class SettingsValues {
return wordSeparators;
}
- private int createCorrectionMode(final InputAttributes inputAttributes) {
+ private int createCorrectionMode() {
final boolean shouldAutoCorrect = mAutoCorrectEnabled
- && (null == inputAttributes || !inputAttributes.mInputTypeNoAutoCorrect);
- if (mBigramSuggestionEnabled && shouldAutoCorrect) return Suggest.CORRECTION_FULL_BIGRAM;
+ && !mInputAttributes.mInputTypeNoAutoCorrect;
+ if (shouldAutoCorrect) return Suggest.CORRECTION_FULL_BIGRAM;
return shouldAutoCorrect ? Suggest.CORRECTION_FULL : Suggest.CORRECTION_NONE;
}
@@ -225,6 +230,18 @@ public class SettingsValues {
res.getBoolean(R.bool.config_default_vibration_enabled));
}
+ public boolean isApplicationSpecifiedCompletionsOn() {
+ return mInputAttributes.mApplicationSpecifiedCompletionOn;
+ }
+
+ public boolean isEditorActionNext() {
+ return mInputAttributes.mEditorAction == EditorInfo.IME_ACTION_NEXT;
+ }
+
+ public boolean isSuggestionStripRequestedByTextField() {
+ return mInputAttributes.mIsSettingsSuggestionStripOn;
+ }
+
public boolean isCorrectionOn() {
return mCorrectionMode == Suggest.CORRECTION_FULL
|| mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM;
@@ -285,12 +302,6 @@ public class SettingsValues {
R.integer.config_key_preview_linger_timeout))));
}
- private static boolean isBigramSuggestionEnabled(final SharedPreferences sp,
- final Resources resources, final boolean autoCorrectEnabled) {
- // TODO: remove this method. Bigram suggestion is always true.
- return true;
- }
-
private static boolean isBigramPredictionEnabled(final SharedPreferences sp,
final Resources resources) {
return sp.getBoolean(Settings.PREF_BIGRAM_PREDICTIONS, resources.getBoolean(
@@ -412,4 +423,9 @@ public class SettingsValues {
final String newStr = Utils.localeAndTimeHashMapToStr(map);
prefs.edit().putString(Settings.PREF_LAST_USER_DICTIONARY_WRITE_TIME, newStr).apply();
}
+
+ // For debug.
+ public String getInputAttributesDebugString() {
+ return mInputAttributes.toString();
+ }
}