Merge "Do not set "SuggestionSpan"s for suggestions from the next word predicition" into jb-dev

main
satok 2012-05-14 20:14:53 -07:00 committed by Android (Google) Code Review
commit 76218b966a
5 changed files with 17 additions and 10 deletions

View File

@ -108,6 +108,7 @@ public class SuggestionSpanUtils {
if (!dictionaryAvailable || TextUtils.isEmpty(pickedWord)
|| CONSTRUCTOR_SuggestionSpan == null
|| suggestedWords == null || suggestedWords.size() == 0
|| suggestedWords.mIsPrediction || suggestedWords.mIsPunctuationSuggestions
|| OBJ_SUGGESTIONS_MAX_SIZE == null) {
return pickedWord;
}

View File

@ -877,7 +877,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
false /* hasAutoCorrectionCandidate */,
false /* allowsToBeAutoCorrected */,
false /* isPunctuationSuggestions */,
false /* isObsoleteSuggestions */);
false /* isObsoleteSuggestions */,
false /* isPrediction */);
// When in fullscreen mode, show completions generated by the application
final boolean isAutoCorrection = false;
setSuggestions(suggestedWords, isAutoCorrection);
@ -1772,7 +1773,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
false /* hasAutoCorrectionCandidate */,
false /* allowsToBeAutoCorrected */,
false /* isPunctuationSuggestions */,
true /* isObsoleteSuggestions */);
true /* isObsoleteSuggestions */,
false /* isPrediction */);
showSuggestions(obsoleteSuggestedWords, typedWord);
}
}

View File

@ -166,7 +166,8 @@ public class SettingsValues {
false /* hasAutoCorrectionCandidate */,
false /* allowsToBeAutoCorrected */,
true /* isPunctuationSuggestions */,
false /* isObsoleteSuggestions */);
false /* isObsoleteSuggestions */,
false /* isPrediction */);
}
private static String createWordSeparators(final String weakSpaceStrippers,

View File

@ -253,13 +253,12 @@ public class Suggest implements Dictionary.WordCallback {
SuggestedWordInfo.removeDups(mSuggestions);
return new SuggestedWords(mSuggestions,
// TODO: Just assuming the suggestions that came from the bigram prediction are
// valid now. Need to assign a correct value for typedWordValid.
true /* typedWordValid */,
false /* typedWordValid */,
false /* hasAutoCorrectionCandidate */,
false /* allowsToBeAutoCorrected */,
false /* isPunctuationSuggestions */,
false /* isObsoleteSuggestions */);
false /* isObsoleteSuggestions */,
true /* isPrediction */);
}
// TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder
@ -396,7 +395,8 @@ public class Suggest implements Dictionary.WordCallback {
autoCorrectionAvailable /* hasAutoCorrectionCandidate */,
allowsToBeAutoCorrected /* allowsToBeAutoCorrected */,
false /* isPunctuationSuggestions */,
false /* isObsoleteSuggestions */);
false /* isObsoleteSuggestions */,
false /* isPrediction */);
}
/**

View File

@ -25,13 +25,14 @@ import java.util.HashSet;
public class SuggestedWords {
public static final SuggestedWords EMPTY = new SuggestedWords(
new ArrayList<SuggestedWordInfo>(0), false, false, false, false, false);
new ArrayList<SuggestedWordInfo>(0), false, false, false, false, false, false);
public final boolean mTypedWordValid;
public final boolean mHasAutoCorrectionCandidate;
public final boolean mIsPunctuationSuggestions;
public final boolean mAllowsToBeAutoCorrected;
public final boolean mIsObsoleteSuggestions;
public final boolean mIsPrediction;
private final ArrayList<SuggestedWordInfo> mSuggestedWordInfoList;
public SuggestedWords(final ArrayList<SuggestedWordInfo> suggestedWordInfoList,
@ -39,13 +40,15 @@ public class SuggestedWords {
final boolean hasAutoCorrectionCandidate,
final boolean allowsToBeAutoCorrected,
final boolean isPunctuationSuggestions,
final boolean isObsoleteSuggestions) {
final boolean isObsoleteSuggestions,
final boolean isPrediction) {
mSuggestedWordInfoList = suggestedWordInfoList;
mTypedWordValid = typedWordValid;
mHasAutoCorrectionCandidate = hasAutoCorrectionCandidate;
mAllowsToBeAutoCorrected = allowsToBeAutoCorrected;
mIsPunctuationSuggestions = isPunctuationSuggestions;
mIsObsoleteSuggestions = isObsoleteSuggestions;
mIsPrediction = isPrediction;
}
public int size() {