am 0c34ee20: [QRP5] Fix boldness for predictions, and small refactoring

* commit '0c34ee20a80884fea49b228745ce87132ae6f22f':
  [QRP5] Fix boldness for predictions, and small refactoring
main
Jean Chalard 2014-02-25 02:48:21 -08:00 committed by Android Git Automerger
commit 82c4474b63
3 changed files with 6 additions and 5 deletions

View File

@ -227,7 +227,7 @@ public final class Suggest {
// TODO: this first argument is lying. If this is a whitelisted word which is an
// actual word, it says typedWordValid = false, which looks wrong. We should either
// rename the attribute or change the value.
!allowsToBeAutoCorrected /* typedWordValid */,
!isPrediction && !allowsToBeAutoCorrected /* typedWordValid */,
hasAutoCorrection, /* willAutoCorrect */
false /* isObsoleteSuggestions */, isPrediction, sequenceNumber));
}

View File

@ -69,7 +69,7 @@ public class SuggestedWords {
final boolean isPrediction,
final int sequenceNumber) {
this(suggestedWordInfoList, rawSuggestions,
suggestedWordInfoList.isEmpty() ? null
(suggestedWordInfoList.isEmpty() || isPrediction) ? null
: suggestedWordInfoList.get(INDEX_OF_TYPED_WORD).mWord,
typedWordValid, willAutoCorrect, isObsoleteSuggestions, isPrediction,
sequenceNumber);

View File

@ -248,13 +248,14 @@ final class SuggestionStripLayoutHelper {
final int indexInSuggestedWords) {
final int positionInStrip =
getPositionInSuggestionStrip(indexInSuggestedWords, suggestedWords);
final boolean isTypedWord = !suggestedWords.mIsPrediction
&& (indexInSuggestedWords == SuggestedWords.INDEX_OF_TYPED_WORD);
// Use identity for strings, not #equals : it's the typed word if it's the same object
final boolean isTypedWord =
suggestedWords.getWord(indexInSuggestedWords) == suggestedWords.mTypedWord;
final int color;
if (positionInStrip == mCenterPositionInStrip && suggestedWords.mWillAutoCorrect) {
color = mColorAutoCorrect;
} else if (positionInStrip == mCenterPositionInStrip && suggestedWords.mTypedWordValid) {
} else if (isTypedWord && suggestedWords.mTypedWordValid) {
color = mColorValidTypedWord;
} else if (isTypedWord) {
color = mColorTypedWord;