Merge "Move phrase gesture from additional features to public."
commit
3b8f2ece40
|
@ -103,6 +103,13 @@
|
|||
android:title="@string/gesture_preview_trail"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
<CheckBoxPreference
|
||||
android:key="pref_gesture_space_aware"
|
||||
android:dependency="gesture_input"
|
||||
android:title="@string/gesture_space_aware"
|
||||
android:summary="@string/gesture_space_aware_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen
|
||||
android:title="@string/settings_screen_correction"
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.android.inputmethod.latin.makedict.FormatSpec;
|
|||
import com.android.inputmethod.latin.makedict.FormatSpec.DictionaryOptions;
|
||||
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
|
||||
import com.android.inputmethod.latin.makedict.WordProperty;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
|
||||
import com.android.inputmethod.latin.utils.FileUtils;
|
||||
import com.android.inputmethod.latin.utils.JniUtils;
|
||||
|
@ -256,7 +257,7 @@ public final class BinaryDictionary extends Dictionary {
|
|||
@Override
|
||||
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final int sessionId, final float[] inOutLanguageWeight) {
|
||||
if (!isValidDictionary()) {
|
||||
return null;
|
||||
|
@ -279,8 +280,12 @@ public final class BinaryDictionary extends Dictionary {
|
|||
}
|
||||
session.mNativeSuggestOptions.setUseFullEditDistance(mUseFullEditDistance);
|
||||
session.mNativeSuggestOptions.setIsGesture(isGesture);
|
||||
session.mNativeSuggestOptions.setBlockOffensiveWords(blockOffensiveWords);
|
||||
session.mNativeSuggestOptions.setAdditionalFeaturesOptions(additionalFeaturesOptions);
|
||||
session.mNativeSuggestOptions.setBlockOffensiveWords(
|
||||
settingsValuesForSuggestion.mBlockPotentiallyOffensive);
|
||||
session.mNativeSuggestOptions.setSpaceAwareGestureEnabled(
|
||||
settingsValuesForSuggestion.mSpaceAwareGestureEnabled);
|
||||
session.mNativeSuggestOptions.setAdditionalFeaturesOptions(
|
||||
settingsValuesForSuggestion.mAdditionalFeaturesSettingValues);
|
||||
if (inOutLanguageWeight != null) {
|
||||
session.mInputOutputLanguageWeight[0] = inOutLanguageWeight[0];
|
||||
} else {
|
||||
|
|
|
@ -19,6 +19,7 @@ package com.android.inputmethod.latin;
|
|||
import com.android.inputmethod.annotations.UsedForTesting;
|
||||
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -72,8 +73,7 @@ public abstract class Dictionary {
|
|||
* @param composer the key sequence to match with coordinate info, as a WordComposer
|
||||
* @param prevWordsInfo the information of previous words.
|
||||
* @param proximityInfo the object for key proximity. May be ignored by some implementations.
|
||||
* @param blockOffensiveWords whether to block potentially offensive words
|
||||
* @param additionalFeaturesOptions options about additional features used for the suggestion.
|
||||
* @param settingsValuesForSuggestion the settings values used for the suggestion.
|
||||
* @param sessionId the session id.
|
||||
* @param inOutLanguageWeight the language weight used for generating suggestions.
|
||||
* inOutLanguageWeight is a float array that has only one element. This can be updated when the
|
||||
|
@ -82,7 +82,7 @@ public abstract class Dictionary {
|
|||
*/
|
||||
abstract public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final int sessionId, final float[] inOutLanguageWeight);
|
||||
|
||||
/**
|
||||
|
@ -168,7 +168,7 @@ public abstract class Dictionary {
|
|||
@Override
|
||||
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final int sessionId, final float[] inOutLanguageWeight) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.util.Log;
|
|||
|
||||
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -57,21 +58,21 @@ public final class DictionaryCollection extends Dictionary {
|
|||
@Override
|
||||
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final int sessionId, final float[] inOutLanguageWeight) {
|
||||
final CopyOnWriteArrayList<Dictionary> dictionaries = mDictionaries;
|
||||
if (dictionaries.isEmpty()) return null;
|
||||
// To avoid creating unnecessary objects, we get the list out of the first
|
||||
// dictionary and add the rest to it if not null, hence the get(0)
|
||||
ArrayList<SuggestedWordInfo> suggestions = dictionaries.get(0).getSuggestions(composer,
|
||||
prevWordsInfo, proximityInfo, blockOffensiveWords, additionalFeaturesOptions,
|
||||
sessionId, inOutLanguageWeight);
|
||||
prevWordsInfo, proximityInfo, settingsValuesForSuggestion, sessionId,
|
||||
inOutLanguageWeight);
|
||||
if (null == suggestions) suggestions = new ArrayList<>();
|
||||
final int length = dictionaries.size();
|
||||
for (int i = 1; i < length; ++ i) {
|
||||
final ArrayList<SuggestedWordInfo> sugg = dictionaries.get(i).getSuggestions(composer,
|
||||
prevWordsInfo, proximityInfo, blockOffensiveWords, additionalFeaturesOptions,
|
||||
sessionId, inOutLanguageWeight);
|
||||
prevWordsInfo, proximityInfo, settingsValuesForSuggestion, sessionId,
|
||||
inOutLanguageWeight);
|
||||
if (null != sugg) suggestions.addAll(sugg);
|
||||
}
|
||||
return suggestions;
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.android.inputmethod.latin.personalization.ContextualDictionary;
|
|||
import com.android.inputmethod.latin.personalization.PersonalizationDataChunk;
|
||||
import com.android.inputmethod.latin.personalization.PersonalizationDictionary;
|
||||
import com.android.inputmethod.latin.personalization.UserHistoryDictionary;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
|
||||
import com.android.inputmethod.latin.utils.DistracterFilter;
|
||||
import com.android.inputmethod.latin.utils.DistracterFilterCheckingIsInDictionary;
|
||||
|
@ -486,8 +487,7 @@ public class DictionaryFacilitator {
|
|||
// TODO: Revise the way to fusion suggestion results.
|
||||
public SuggestionResults getSuggestionResults(final WordComposer composer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final int sessionId) {
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion, final int sessionId) {
|
||||
final Dictionaries dictionaries = mDictionaries;
|
||||
final SuggestionResults suggestionResults =
|
||||
new SuggestionResults(dictionaries.mLocale, SuggestedWords.MAX_SUGGESTIONS);
|
||||
|
@ -497,8 +497,7 @@ public class DictionaryFacilitator {
|
|||
if (null == dictionary) continue;
|
||||
final ArrayList<SuggestedWordInfo> dictionarySuggestions =
|
||||
dictionary.getSuggestions(composer, prevWordsInfo, proximityInfo,
|
||||
blockOffensiveWords, additionalFeaturesOptions, sessionId,
|
||||
languageWeight);
|
||||
settingsValuesForSuggestion, sessionId, languageWeight);
|
||||
if (null == dictionarySuggestions) continue;
|
||||
suggestionResults.addAll(dictionarySuggestions);
|
||||
if (null != suggestionResults.mRawSuggestions) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.android.inputmethod.latin.makedict.FormatSpec;
|
|||
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
|
||||
import com.android.inputmethod.latin.makedict.WordProperty;
|
||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
import com.android.inputmethod.latin.utils.CombinedFormatUtils;
|
||||
import com.android.inputmethod.latin.utils.DistracterFilter;
|
||||
import com.android.inputmethod.latin.utils.ExecutorUtils;
|
||||
|
@ -409,8 +410,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
|||
@Override
|
||||
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final int sessionId, final float[] inOutLanguageWeight) {
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion, final int sessionId,
|
||||
final float[] inOutLanguageWeight) {
|
||||
reloadDictionaryIfRequired();
|
||||
boolean lockAcquired = false;
|
||||
try {
|
||||
|
@ -422,8 +423,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
|||
}
|
||||
final ArrayList<SuggestedWordInfo> suggestions =
|
||||
mBinaryDictionary.getSuggestions(composer, prevWordsInfo, proximityInfo,
|
||||
blockOffensiveWords, additionalFeaturesOptions, sessionId,
|
||||
inOutLanguageWeight);
|
||||
settingsValuesForSuggestion, sessionId, inOutLanguageWeight);
|
||||
if (mBinaryDictionary.isCorrupted()) {
|
||||
Log.i(TAG, "Dictionary (" + mDictName +") is corrupted. "
|
||||
+ "Remove and regenerate it.");
|
||||
|
|
|
@ -18,6 +18,7 @@ package com.android.inputmethod.latin;
|
|||
|
||||
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
@ -51,13 +52,12 @@ public final class ReadOnlyBinaryDictionary extends Dictionary {
|
|||
@Override
|
||||
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final int sessionId, final float[] inOutLanguageWeight) {
|
||||
if (mLock.readLock().tryLock()) {
|
||||
try {
|
||||
return mBinaryDictionary.getSuggestions(composer, prevWordsInfo, proximityInfo,
|
||||
blockOffensiveWords, additionalFeaturesOptions, sessionId,
|
||||
inOutLanguageWeight);
|
||||
settingsValuesForSuggestion, sessionId, inOutLanguageWeight);
|
||||
} finally {
|
||||
mLock.readLock().unlock();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import android.text.TextUtils;
|
|||
|
||||
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.define.ProductionFlag;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
import com.android.inputmethod.latin.utils.AutoCorrectionUtils;
|
||||
import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
|
||||
import com.android.inputmethod.latin.utils.StringUtils;
|
||||
|
@ -73,17 +73,15 @@ public final class Suggest {
|
|||
|
||||
public void getSuggestedWords(final WordComposer wordComposer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final boolean isCorrectionEnabled,
|
||||
final int[] additionalFeaturesOptions, final int sessionId, final int sequenceNumber,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final boolean isCorrectionEnabled, final int sessionId, final int sequenceNumber,
|
||||
final OnGetSuggestedWordsCallback callback) {
|
||||
if (wordComposer.isBatchMode()) {
|
||||
getSuggestedWordsForBatchInput(wordComposer, prevWordsInfo, proximityInfo,
|
||||
blockOffensiveWords, additionalFeaturesOptions, sessionId, sequenceNumber,
|
||||
callback);
|
||||
settingsValuesForSuggestion, sessionId, sequenceNumber, callback);
|
||||
} else {
|
||||
getSuggestedWordsForTypingInput(wordComposer, prevWordsInfo, proximityInfo,
|
||||
blockOffensiveWords, isCorrectionEnabled, additionalFeaturesOptions,
|
||||
sequenceNumber, callback);
|
||||
settingsValuesForSuggestion, isCorrectionEnabled, sequenceNumber, callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,8 +123,8 @@ public final class Suggest {
|
|||
// and calls the callback function with the suggestions.
|
||||
private void getSuggestedWordsForTypingInput(final WordComposer wordComposer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final boolean isCorrectionEnabled,
|
||||
final int[] additionalFeaturesOptions, final int sequenceNumber,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final boolean isCorrectionEnabled, final int sequenceNumber,
|
||||
final OnGetSuggestedWordsCallback callback) {
|
||||
final String typedWord = wordComposer.getTypedWord();
|
||||
final int trailingSingleQuotesCount = StringUtils.getTrailingSingleQuotesCount(typedWord);
|
||||
|
@ -135,8 +133,8 @@ public final class Suggest {
|
|||
: typedWord;
|
||||
|
||||
final SuggestionResults suggestionResults = mDictionaryFacilitator.getSuggestionResults(
|
||||
wordComposer, prevWordsInfo, proximityInfo, blockOffensiveWords,
|
||||
additionalFeaturesOptions, SESSION_TYPING);
|
||||
wordComposer, prevWordsInfo, proximityInfo, settingsValuesForSuggestion,
|
||||
SESSION_TYPING);
|
||||
final ArrayList<SuggestedWordInfo> suggestionsContainer =
|
||||
getTransformedSuggestedWordInfoList(wordComposer, suggestionResults,
|
||||
trailingSingleQuotesCount);
|
||||
|
@ -205,12 +203,11 @@ public final class Suggest {
|
|||
// and calls the callback function with the suggestions.
|
||||
private void getSuggestedWordsForBatchInput(final WordComposer wordComposer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final int sessionId, final int sequenceNumber,
|
||||
final OnGetSuggestedWordsCallback callback) {
|
||||
final SuggestionResults suggestionResults = mDictionaryFacilitator.getSuggestionResults(
|
||||
wordComposer, prevWordsInfo, proximityInfo, blockOffensiveWords,
|
||||
additionalFeaturesOptions, sessionId);
|
||||
wordComposer, prevWordsInfo, proximityInfo, settingsValuesForSuggestion, sessionId);
|
||||
final ArrayList<SuggestedWordInfo> suggestionsContainer =
|
||||
new ArrayList<>(suggestionResults);
|
||||
final int suggestionsCount = suggestionsContainer.size();
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.android.inputmethod.latin.SuggestedWords;
|
|||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.WordComposer;
|
||||
import com.android.inputmethod.latin.settings.SettingsValues;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
|
||||
import com.android.inputmethod.latin.suggestions.SuggestionStripViewAccessor;
|
||||
import com.android.inputmethod.latin.utils.AsyncResultHolder;
|
||||
|
@ -1998,9 +1999,11 @@ public final class InputLogic {
|
|||
// a word, it's whatever is *before* the half-committed word in the buffer,
|
||||
// hence 2; if we aren't, we should just skip whitespace if any, so 1.
|
||||
mWordComposer.isComposingWord() ? 2 : 1),
|
||||
proximityInfo, settingsValues.mBlockPotentiallyOffensive,
|
||||
proximityInfo,
|
||||
new SettingsValuesForSuggestion(settingsValues.mBlockPotentiallyOffensive,
|
||||
settingsValues.mPhraseGestureEnabled,
|
||||
settingsValues.mAdditionalFeaturesSettingValues),
|
||||
settingsValues.mAutoCorrectionEnabled,
|
||||
settingsValues.mAdditionalFeaturesSettingValues,
|
||||
sessionId, sequenceNumber, callback);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,8 @@ public class NativeSuggestOptions {
|
|||
private static final int IS_GESTURE = 0;
|
||||
private static final int USE_FULL_EDIT_DISTANCE = 1;
|
||||
private static final int BLOCK_OFFENSIVE_WORDS = 2;
|
||||
private static final int OPTIONS_SIZE = 3;
|
||||
private static final int SPACE_AWARE_GESTURE_ENABLED = 3;
|
||||
private static final int OPTIONS_SIZE = 4;
|
||||
|
||||
private final int[] mOptions = new int[OPTIONS_SIZE
|
||||
+ AdditionalFeaturesSettingUtils.ADDITIONAL_FEATURES_SETTINGS_SIZE];
|
||||
|
@ -38,6 +39,10 @@ public class NativeSuggestOptions {
|
|||
setBooleanOption(BLOCK_OFFENSIVE_WORDS, value);
|
||||
}
|
||||
|
||||
public void setSpaceAwareGestureEnabled(final boolean value) {
|
||||
setBooleanOption(SPACE_AWARE_GESTURE_ENABLED, value);
|
||||
}
|
||||
|
||||
public void setAdditionalFeaturesOptions(final int[] additionalOptions) {
|
||||
if (additionalOptions == null) {
|
||||
return;
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.inputmethod.latin.settings;
|
||||
|
||||
public class SettingsValuesForSuggestion {
|
||||
public final boolean mBlockPotentiallyOffensive;
|
||||
public final boolean mSpaceAwareGestureEnabled;
|
||||
public final int[] mAdditionalFeaturesSettingValues;
|
||||
|
||||
public SettingsValuesForSuggestion(final boolean blockPotentiallyOffensive,
|
||||
final boolean spaceAwareGestureEnabled, final int[] additionalFeaturesSettingValues) {
|
||||
mBlockPotentiallyOffensive = blockPotentiallyOffensive;
|
||||
mSpaceAwareGestureEnabled = spaceAwareGestureEnabled;
|
||||
mAdditionalFeaturesSettingValues = additionalFeaturesSettingValues;
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ import com.android.inputmethod.latin.Dictionary;
|
|||
import com.android.inputmethod.latin.PrevWordsInfo;
|
||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.WordComposer;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
import com.android.inputmethod.latin.spellcheck.AndroidSpellCheckerService.SuggestionsGatherer;
|
||||
import com.android.inputmethod.latin.utils.CoordinateUtils;
|
||||
import com.android.inputmethod.latin.utils.LocaleUtils;
|
||||
|
@ -308,8 +309,12 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
|
|||
// TODO: make a spell checker option to block offensive words or not
|
||||
final ArrayList<SuggestedWordInfo> suggestions =
|
||||
dictInfo.mDictionary.getSuggestions(composer, prevWordsInfo,
|
||||
dictInfo.getProximityInfo(), true /* blockOffensiveWords */,
|
||||
null /* additionalFeaturesOptions */, 0 /* sessionId */,
|
||||
dictInfo.getProximityInfo(),
|
||||
new SettingsValuesForSuggestion(
|
||||
true /* blockPotentiallyOffensive */,
|
||||
true /* spaceAwareGestureEnabled */,
|
||||
null /* additionalFeaturesSettingValues */),
|
||||
0 /* sessionId */,
|
||||
null /* inOutLanguageWeight */);
|
||||
if (suggestions != null) {
|
||||
for (final SuggestedWordInfo suggestion : suggestions) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.android.inputmethod.keyboard.ProximityInfo;
|
|||
import com.android.inputmethod.latin.Dictionary;
|
||||
import com.android.inputmethod.latin.PrevWordsInfo;
|
||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
import com.android.inputmethod.latin.WordComposer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -53,7 +54,7 @@ public final class DictionaryPool extends LinkedBlockingQueue<DictAndKeyboard> {
|
|||
@Override
|
||||
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final int sessionId, final float[] inOutLanguageWeight) {
|
||||
return noSuggestions;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.android.inputmethod.keyboard.ProximityInfo;
|
|||
import com.android.inputmethod.latin.ContactsBinaryDictionary;
|
||||
import com.android.inputmethod.latin.PrevWordsInfo;
|
||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
import com.android.inputmethod.latin.WordComposer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -38,11 +39,11 @@ public final class SynchronouslyLoadedContactsBinaryDictionary extends ContactsB
|
|||
@Override
|
||||
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer codes,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final int sessionId, final float[] inOutLanguageWeight) {
|
||||
synchronized (mLock) {
|
||||
return super.getSuggestions(codes, prevWordsInfo, proximityInfo,
|
||||
blockOffensiveWords, additionalFeaturesOptions, sessionId, inOutLanguageWeight);
|
||||
settingsValuesForSuggestion, sessionId, inOutLanguageWeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.content.Context;
|
|||
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||
import com.android.inputmethod.latin.PrevWordsInfo;
|
||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||
import com.android.inputmethod.latin.UserBinaryDictionary;
|
||||
import com.android.inputmethod.latin.WordComposer;
|
||||
|
||||
|
@ -43,11 +44,11 @@ public final class SynchronouslyLoadedUserBinaryDictionary extends UserBinaryDic
|
|||
@Override
|
||||
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer codes,
|
||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||
final int sessionId, final float[] inOutLanguageWeight) {
|
||||
synchronized (mLock) {
|
||||
return super.getSuggestions(codes, prevWordsInfo, proximityInfo,
|
||||
blockOffensiveWords, additionalFeaturesOptions, sessionId, inOutLanguageWeight);
|
||||
settingsValuesForSuggestion, sessionId, inOutLanguageWeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,10 @@ class SuggestOptions{
|
|||
return getBoolOption(BLOCK_OFFENSIVE_WORDS);
|
||||
}
|
||||
|
||||
AK_FORCE_INLINE bool enableSpaceAwareGesture() const {
|
||||
return getBoolOption(SPACE_AWARE_GESTURE_ENABLED);
|
||||
}
|
||||
|
||||
AK_FORCE_INLINE bool getAdditionalFeaturesBoolOption(const int key) const {
|
||||
return getBoolOption(key + ADDITIONAL_FEATURES_OPTIONS);
|
||||
}
|
||||
|
@ -50,9 +54,10 @@ class SuggestOptions{
|
|||
static const int IS_GESTURE = 0;
|
||||
static const int USE_FULL_EDIT_DISTANCE = 1;
|
||||
static const int BLOCK_OFFENSIVE_WORDS = 2;
|
||||
static const int SPACE_AWARE_GESTURE_ENABLED = 3;
|
||||
// Additional features options are stored after the other options and used as setting values of
|
||||
// experimental features.
|
||||
static const int ADDITIONAL_FEATURES_OPTIONS = 3;
|
||||
static const int ADDITIONAL_FEATURES_OPTIONS = 4;
|
||||
|
||||
const int *const mOptions;
|
||||
const int mLength;
|
||||
|
|
|
@ -50,6 +50,7 @@ LATINIME_SRC_FILES_FOR_DICTTOOL := \
|
|||
latin/SuggestedWords.java \
|
||||
latin/WordComposer.java \
|
||||
latin/settings/NativeSuggestOptions.java \
|
||||
latin/settings/SettingsValuesForSuggestion.java \
|
||||
latin/utils/BinaryDictionaryUtils.java \
|
||||
latin/utils/CombinedFormatUtils.java \
|
||||
latin/utils/CoordinateUtils.java \
|
||||
|
|
Loading…
Reference in New Issue