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

* commit '76218b966a6a712f3baa72d95c6d125d414cdbd4':
  Do not set "SuggestionSpan"s for suggestions from the next word predicition
main
satok 2012-05-15 11:37:52 -07:00 committed by Android Git Automerger
commit d9c4aa83e1
5 changed files with 17 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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

View File

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