mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Remove unused phrase gesture code.
Bug: 19687841 Change-Id: I0862aa3127bf7f1564a4845efdf99ebf5ae4d5ac
This commit is contained in:
parent
9a289da4e6
commit
4e0af43673
@ -43,10 +43,6 @@ public class NativeSuggestOptions {
|
||||
setBooleanOption(BLOCK_OFFENSIVE_WORDS, value);
|
||||
}
|
||||
|
||||
public void setSpaceAwareGestureEnabled(final boolean value) {
|
||||
setBooleanOption(SPACE_AWARE_GESTURE_ENABLED, value);
|
||||
}
|
||||
|
||||
public void setWeightForLocale(final float value) {
|
||||
// We're passing this option as a fixed point value, in thousands. This is decoded in
|
||||
// native code by SuggestOptions#weightForLocale().
|
||||
|
@ -292,8 +292,6 @@ public final class BinaryDictionary extends Dictionary {
|
||||
session.mNativeSuggestOptions.setIsGesture(isGesture);
|
||||
session.mNativeSuggestOptions.setBlockOffensiveWords(
|
||||
settingsValuesForSuggestion.mBlockPotentiallyOffensive);
|
||||
session.mNativeSuggestOptions.setSpaceAwareGestureEnabled(
|
||||
settingsValuesForSuggestion.mSpaceAwareGestureEnabled);
|
||||
session.mNativeSuggestOptions.setWeightForLocale(weightForLocale);
|
||||
if (inOutWeightOfLangModelVsSpatialModel != null) {
|
||||
session.mInputOutputWeightOfLangModelVsSpatialModel[0] =
|
||||
|
@ -534,29 +534,6 @@ public final class InputLogic {
|
||||
final InputPointers batchPointers,
|
||||
// TODO: remove these arguments
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1984,27 +1961,8 @@ public final class InputLogic {
|
||||
if (SpaceState.PHANTOM == mSpaceState) {
|
||||
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);
|
||||
setComposingTextInternal(batchInputText, 1);
|
||||
}
|
||||
mWordComposer.setBatchInputWord(batchInputText);
|
||||
setComposingTextInternal(batchInputText, 1);
|
||||
mConnection.endBatchEdit();
|
||||
// Space state must be updated before calling updateShiftState
|
||||
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.
|
||||
mWordComposer.isComposingWord() ? 2 : 1),
|
||||
keyboard,
|
||||
new SettingsValuesForSuggestion(settingsValues.mBlockPotentiallyOffensive,
|
||||
settingsValues.mPhraseGestureEnabled),
|
||||
new SettingsValuesForSuggestion(settingsValues.mBlockPotentiallyOffensive),
|
||||
settingsValues.mAutoCorrectionEnabledPerUserSettings,
|
||||
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_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";
|
||||
|
||||
@ -235,12 +234,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||
&& 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) {
|
||||
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 mGestureFloatingPreviewTextEnabled;
|
||||
public final boolean mSlidingKeyInputPreviewEnabled;
|
||||
public final boolean mPhraseGestureEnabled;
|
||||
public final int mKeyLongpressTimeout;
|
||||
public final boolean mEnableEmojiAltPhysicalKey;
|
||||
public final boolean mEnableMetricsLogging;
|
||||
@ -174,7 +173,6 @@ public class SettingsValues {
|
||||
null /* default */);
|
||||
mGestureFloatingPreviewTextEnabled = !mInputAttributes.mDisableGestureFloatingPreviewText
|
||||
&& prefs.getBoolean(Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true);
|
||||
mPhraseGestureEnabled = Settings.readPhraseGestureEnabled(prefs, res);
|
||||
mAutoCorrectionEnabledPerUserSettings = mAutoCorrectEnabled
|
||||
&& !mInputAttributes.mInputTypeNoAutoCorrect;
|
||||
mSuggestionsEnabledPerUserSettings = readSuggestionsEnabled(prefs);
|
||||
@ -389,8 +387,6 @@ public class SettingsValues {
|
||||
sb.append("" + mGestureFloatingPreviewTextEnabled);
|
||||
sb.append("\n mSlidingKeyInputPreviewEnabled = ");
|
||||
sb.append("" + mSlidingKeyInputPreviewEnabled);
|
||||
sb.append("\n mPhraseGestureEnabled = ");
|
||||
sb.append("" + mPhraseGestureEnabled);
|
||||
sb.append("\n mKeyLongpressTimeout = ");
|
||||
sb.append("" + mKeyLongpressTimeout);
|
||||
sb.append("\n mLocale = ");
|
||||
|
@ -18,11 +18,8 @@ package com.android.inputmethod.latin.settings;
|
||||
|
||||
public class SettingsValuesForSuggestion {
|
||||
public final boolean mBlockPotentiallyOffensive;
|
||||
public final boolean mSpaceAwareGestureEnabled;
|
||||
|
||||
public SettingsValuesForSuggestion(final boolean blockPotentiallyOffensive,
|
||||
final boolean spaceAwareGestureEnabled) {
|
||||
public SettingsValuesForSuggestion(final boolean blockPotentiallyOffensive) {
|
||||
mBlockPotentiallyOffensive = blockPotentiallyOffensive;
|
||||
mSpaceAwareGestureEnabled = spaceAwareGestureEnabled;
|
||||
}
|
||||
}
|
||||
|
@ -79,8 +79,7 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
|
||||
private float mRecommendedThreshold;
|
||||
// TODO: make a spell checker option to block offensive words or not
|
||||
private final SettingsValuesForSuggestion mSettingsValuesForSuggestion =
|
||||
new SettingsValuesForSuggestion(true /* blockPotentiallyOffensive */,
|
||||
true /* spaceAwareGestureEnabled */);
|
||||
new SettingsValuesForSuggestion(true /* blockPotentiallyOffensive */);
|
||||
|
||||
public static final String SINGLE_QUOTE = "\u0027";
|
||||
public static final String APOSTROPHE = "\u2019";
|
||||
|
Loading…
Reference in New Issue
Block a user