Remove unused phrase gesture code.
Bug: 19687841 Change-Id: I0862aa3127bf7f1564a4845efdf99ebf5ae4d5acmain
parent
9a289da4e6
commit
4e0af43673
|
@ -43,10 +43,6 @@ public class NativeSuggestOptions {
|
||||||
setBooleanOption(BLOCK_OFFENSIVE_WORDS, value);
|
setBooleanOption(BLOCK_OFFENSIVE_WORDS, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpaceAwareGestureEnabled(final boolean value) {
|
|
||||||
setBooleanOption(SPACE_AWARE_GESTURE_ENABLED, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWeightForLocale(final float value) {
|
public void setWeightForLocale(final float value) {
|
||||||
// We're passing this option as a fixed point value, in thousands. This is decoded in
|
// We're passing this option as a fixed point value, in thousands. This is decoded in
|
||||||
// native code by SuggestOptions#weightForLocale().
|
// native code by SuggestOptions#weightForLocale().
|
||||||
|
|
|
@ -292,8 +292,6 @@ public final class BinaryDictionary extends Dictionary {
|
||||||
session.mNativeSuggestOptions.setIsGesture(isGesture);
|
session.mNativeSuggestOptions.setIsGesture(isGesture);
|
||||||
session.mNativeSuggestOptions.setBlockOffensiveWords(
|
session.mNativeSuggestOptions.setBlockOffensiveWords(
|
||||||
settingsValuesForSuggestion.mBlockPotentiallyOffensive);
|
settingsValuesForSuggestion.mBlockPotentiallyOffensive);
|
||||||
session.mNativeSuggestOptions.setSpaceAwareGestureEnabled(
|
|
||||||
settingsValuesForSuggestion.mSpaceAwareGestureEnabled);
|
|
||||||
session.mNativeSuggestOptions.setWeightForLocale(weightForLocale);
|
session.mNativeSuggestOptions.setWeightForLocale(weightForLocale);
|
||||||
if (inOutWeightOfLangModelVsSpatialModel != null) {
|
if (inOutWeightOfLangModelVsSpatialModel != null) {
|
||||||
session.mInputOutputWeightOfLangModelVsSpatialModel[0] =
|
session.mInputOutputWeightOfLangModelVsSpatialModel[0] =
|
||||||
|
|
|
@ -534,29 +534,6 @@ public final class InputLogic {
|
||||||
final InputPointers batchPointers,
|
final InputPointers batchPointers,
|
||||||
// TODO: remove these arguments
|
// TODO: remove these arguments
|
||||||
final KeyboardSwitcher keyboardSwitcher) {
|
final KeyboardSwitcher keyboardSwitcher) {
|
||||||
if (settingsValues.mPhraseGestureEnabled) {
|
|
||||||
final SuggestedWordInfo candidate = mSuggestedWords.getAutoCommitCandidate();
|
|
||||||
// If these suggested words have been generated with out of date input pointers, then
|
|
||||||
// we skip auto-commit (see comments above on the mSequenceNumber member).
|
|
||||||
if (null != candidate
|
|
||||||
&& mSuggestedWords.mSequenceNumber >= mAutoCommitSequenceNumber) {
|
|
||||||
if (candidate.mSourceDict.shouldAutoCommit(candidate)) {
|
|
||||||
final String[] commitParts = candidate.mWord.split(Constants.WORD_SEPARATOR, 2);
|
|
||||||
batchPointers.shift(candidate.mIndexOfTouchPointOfSecondWord);
|
|
||||||
if (SpaceState.PHANTOM == mSpaceState) {
|
|
||||||
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
|
|
||||||
}
|
|
||||||
mConnection.commitText(commitParts[0], 0);
|
|
||||||
StatsUtils.onWordCommitUserTyped(commitParts[0], mWordComposer.isBatchMode());
|
|
||||||
mSpaceState = SpaceState.PHANTOM;
|
|
||||||
keyboardSwitcher.requestUpdatingShiftState(
|
|
||||||
getCurrentAutoCapsState(settingsValues), getCurrentRecapitalizeState());
|
|
||||||
mWordComposer.setCapitalizedModeAtStartComposingTime(getActualCapsMode(
|
|
||||||
settingsValues, keyboardSwitcher.getKeyboardShiftMode()));
|
|
||||||
++mAutoCommitSequenceNumber;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mInputLogicHandler.onUpdateBatchInput(batchPointers, mAutoCommitSequenceNumber);
|
mInputLogicHandler.onUpdateBatchInput(batchPointers, mAutoCommitSequenceNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1984,27 +1961,8 @@ public final class InputLogic {
|
||||||
if (SpaceState.PHANTOM == mSpaceState) {
|
if (SpaceState.PHANTOM == mSpaceState) {
|
||||||
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
|
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
|
||||||
}
|
}
|
||||||
final SuggestedWordInfo autoCommitCandidate = mSuggestedWords.getAutoCommitCandidate();
|
|
||||||
// Commit except the last word for phrase gesture if the top suggestion is eligible for auto
|
|
||||||
// commit.
|
|
||||||
if (settingsValues.mPhraseGestureEnabled && null != autoCommitCandidate) {
|
|
||||||
// Find the last space
|
|
||||||
final int indexOfLastSpace = batchInputText.lastIndexOf(Constants.CODE_SPACE) + 1;
|
|
||||||
if (0 != indexOfLastSpace) {
|
|
||||||
mConnection.commitText(batchInputText.substring(0, indexOfLastSpace), 1);
|
|
||||||
StatsUtils.onWordCommitUserTyped(
|
|
||||||
batchInputText.substring(0, indexOfLastSpace), mWordComposer.isBatchMode());
|
|
||||||
final SuggestedWords suggestedWordsForLastWordOfPhraseGesture =
|
|
||||||
suggestedWords.getSuggestedWordsForLastWordOfPhraseGesture();
|
|
||||||
mLatinIME.showSuggestionStrip(suggestedWordsForLastWordOfPhraseGesture);
|
|
||||||
}
|
|
||||||
final String lastWord = batchInputText.substring(indexOfLastSpace);
|
|
||||||
mWordComposer.setBatchInputWord(lastWord);
|
|
||||||
setComposingTextInternal(lastWord, 1);
|
|
||||||
} else {
|
|
||||||
mWordComposer.setBatchInputWord(batchInputText);
|
mWordComposer.setBatchInputWord(batchInputText);
|
||||||
setComposingTextInternal(batchInputText, 1);
|
setComposingTextInternal(batchInputText, 1);
|
||||||
}
|
|
||||||
mConnection.endBatchEdit();
|
mConnection.endBatchEdit();
|
||||||
// Space state must be updated before calling updateShiftState
|
// Space state must be updated before calling updateShiftState
|
||||||
mSpaceState = SpaceState.PHANTOM;
|
mSpaceState = SpaceState.PHANTOM;
|
||||||
|
@ -2186,8 +2144,7 @@ public final class InputLogic {
|
||||||
// hence 2; if we aren't, we should just skip whitespace if any, so 1.
|
// hence 2; if we aren't, we should just skip whitespace if any, so 1.
|
||||||
mWordComposer.isComposingWord() ? 2 : 1),
|
mWordComposer.isComposingWord() ? 2 : 1),
|
||||||
keyboard,
|
keyboard,
|
||||||
new SettingsValuesForSuggestion(settingsValues.mBlockPotentiallyOffensive,
|
new SettingsValuesForSuggestion(settingsValues.mBlockPotentiallyOffensive),
|
||||||
settingsValues.mPhraseGestureEnabled),
|
|
||||||
settingsValues.mAutoCorrectionEnabledPerUserSettings,
|
settingsValues.mAutoCorrectionEnabledPerUserSettings,
|
||||||
inputStyle, sequenceNumber, callback);
|
inputStyle, sequenceNumber, callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static final String PREF_GESTURE_PREVIEW_TRAIL = "pref_gesture_preview_trail";
|
public static final String PREF_GESTURE_PREVIEW_TRAIL = "pref_gesture_preview_trail";
|
||||||
public static final String PREF_GESTURE_FLOATING_PREVIEW_TEXT =
|
public static final String PREF_GESTURE_FLOATING_PREVIEW_TEXT =
|
||||||
"pref_gesture_floating_preview_text";
|
"pref_gesture_floating_preview_text";
|
||||||
public static final String PREF_PHRASE_GESTURE_ENABLED = "pref_gesture_space_aware";
|
|
||||||
|
|
||||||
public static final String PREF_KEY_IS_INTERNAL = "pref_key_is_internal";
|
public static final String PREF_KEY_IS_INTERNAL = "pref_key_is_internal";
|
||||||
|
|
||||||
|
@ -235,12 +234,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
&& prefs.getBoolean(PREF_GESTURE_INPUT, true);
|
&& prefs.getBoolean(PREF_GESTURE_INPUT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean readPhraseGestureEnabled(final SharedPreferences prefs,
|
|
||||||
final Resources res) {
|
|
||||||
return prefs.getBoolean(PREF_PHRASE_GESTURE_ENABLED,
|
|
||||||
res.getBoolean(R.bool.config_default_phrase_gesture_enabled));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean readFromBuildConfigIfToShowKeyPreviewPopupOption(final Resources res) {
|
public static boolean readFromBuildConfigIfToShowKeyPreviewPopupOption(final Resources res) {
|
||||||
return res.getBoolean(R.bool.config_enable_show_key_preview_popup_option);
|
return res.getBoolean(R.bool.config_enable_show_key_preview_popup_option);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,6 @@ public class SettingsValues {
|
||||||
public final boolean mGestureTrailEnabled;
|
public final boolean mGestureTrailEnabled;
|
||||||
public final boolean mGestureFloatingPreviewTextEnabled;
|
public final boolean mGestureFloatingPreviewTextEnabled;
|
||||||
public final boolean mSlidingKeyInputPreviewEnabled;
|
public final boolean mSlidingKeyInputPreviewEnabled;
|
||||||
public final boolean mPhraseGestureEnabled;
|
|
||||||
public final int mKeyLongpressTimeout;
|
public final int mKeyLongpressTimeout;
|
||||||
public final boolean mEnableEmojiAltPhysicalKey;
|
public final boolean mEnableEmojiAltPhysicalKey;
|
||||||
public final boolean mEnableMetricsLogging;
|
public final boolean mEnableMetricsLogging;
|
||||||
|
@ -174,7 +173,6 @@ public class SettingsValues {
|
||||||
null /* default */);
|
null /* default */);
|
||||||
mGestureFloatingPreviewTextEnabled = !mInputAttributes.mDisableGestureFloatingPreviewText
|
mGestureFloatingPreviewTextEnabled = !mInputAttributes.mDisableGestureFloatingPreviewText
|
||||||
&& prefs.getBoolean(Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true);
|
&& prefs.getBoolean(Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true);
|
||||||
mPhraseGestureEnabled = Settings.readPhraseGestureEnabled(prefs, res);
|
|
||||||
mAutoCorrectionEnabledPerUserSettings = mAutoCorrectEnabled
|
mAutoCorrectionEnabledPerUserSettings = mAutoCorrectEnabled
|
||||||
&& !mInputAttributes.mInputTypeNoAutoCorrect;
|
&& !mInputAttributes.mInputTypeNoAutoCorrect;
|
||||||
mSuggestionsEnabledPerUserSettings = readSuggestionsEnabled(prefs);
|
mSuggestionsEnabledPerUserSettings = readSuggestionsEnabled(prefs);
|
||||||
|
@ -389,8 +387,6 @@ public class SettingsValues {
|
||||||
sb.append("" + mGestureFloatingPreviewTextEnabled);
|
sb.append("" + mGestureFloatingPreviewTextEnabled);
|
||||||
sb.append("\n mSlidingKeyInputPreviewEnabled = ");
|
sb.append("\n mSlidingKeyInputPreviewEnabled = ");
|
||||||
sb.append("" + mSlidingKeyInputPreviewEnabled);
|
sb.append("" + mSlidingKeyInputPreviewEnabled);
|
||||||
sb.append("\n mPhraseGestureEnabled = ");
|
|
||||||
sb.append("" + mPhraseGestureEnabled);
|
|
||||||
sb.append("\n mKeyLongpressTimeout = ");
|
sb.append("\n mKeyLongpressTimeout = ");
|
||||||
sb.append("" + mKeyLongpressTimeout);
|
sb.append("" + mKeyLongpressTimeout);
|
||||||
sb.append("\n mLocale = ");
|
sb.append("\n mLocale = ");
|
||||||
|
|
|
@ -18,11 +18,8 @@ package com.android.inputmethod.latin.settings;
|
||||||
|
|
||||||
public class SettingsValuesForSuggestion {
|
public class SettingsValuesForSuggestion {
|
||||||
public final boolean mBlockPotentiallyOffensive;
|
public final boolean mBlockPotentiallyOffensive;
|
||||||
public final boolean mSpaceAwareGestureEnabled;
|
|
||||||
|
|
||||||
public SettingsValuesForSuggestion(final boolean blockPotentiallyOffensive,
|
public SettingsValuesForSuggestion(final boolean blockPotentiallyOffensive) {
|
||||||
final boolean spaceAwareGestureEnabled) {
|
|
||||||
mBlockPotentiallyOffensive = blockPotentiallyOffensive;
|
mBlockPotentiallyOffensive = blockPotentiallyOffensive;
|
||||||
mSpaceAwareGestureEnabled = spaceAwareGestureEnabled;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,7 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
|
||||||
private float mRecommendedThreshold;
|
private float mRecommendedThreshold;
|
||||||
// TODO: make a spell checker option to block offensive words or not
|
// TODO: make a spell checker option to block offensive words or not
|
||||||
private final SettingsValuesForSuggestion mSettingsValuesForSuggestion =
|
private final SettingsValuesForSuggestion mSettingsValuesForSuggestion =
|
||||||
new SettingsValuesForSuggestion(true /* blockPotentiallyOffensive */,
|
new SettingsValuesForSuggestion(true /* blockPotentiallyOffensive */);
|
||||||
true /* spaceAwareGestureEnabled */);
|
|
||||||
|
|
||||||
public static final String SINGLE_QUOTE = "\u0027";
|
public static final String SINGLE_QUOTE = "\u0027";
|
||||||
public static final String APOSTROPHE = "\u2019";
|
public static final String APOSTROPHE = "\u2019";
|
||||||
|
|
Loading…
Reference in New Issue