Skip to content
Snippets Groups Projects
Commit 0c34ee20 authored by Jean Chalard's avatar Jean Chalard
Browse files

[QRP5] Fix boldness for predictions, and small refactoring

This is more correct. When predictions, the typed word should
always be null unless explicitly passed. The text color should be
that of a valid typed word only if it's actually the typed word.

Bug: 13170509
Change-Id: I769ae100e112c37c6f02064fe9ef2f81372ca9e5
parent 783f1932
No related branches found
No related tags found
No related merge requests found
...@@ -227,7 +227,7 @@ public final class Suggest { ...@@ -227,7 +227,7 @@ public final class Suggest {
// TODO: this first argument is lying. If this is a whitelisted word which is an // 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 // actual word, it says typedWordValid = false, which looks wrong. We should either
// rename the attribute or change the value. // rename the attribute or change the value.
!allowsToBeAutoCorrected /* typedWordValid */, !isPrediction && !allowsToBeAutoCorrected /* typedWordValid */,
hasAutoCorrection, /* willAutoCorrect */ hasAutoCorrection, /* willAutoCorrect */
false /* isObsoleteSuggestions */, isPrediction, sequenceNumber)); false /* isObsoleteSuggestions */, isPrediction, sequenceNumber));
} }
......
...@@ -69,7 +69,7 @@ public class SuggestedWords { ...@@ -69,7 +69,7 @@ public class SuggestedWords {
final boolean isPrediction, final boolean isPrediction,
final int sequenceNumber) { final int sequenceNumber) {
this(suggestedWordInfoList, rawSuggestions, this(suggestedWordInfoList, rawSuggestions,
suggestedWordInfoList.isEmpty() ? null (suggestedWordInfoList.isEmpty() || isPrediction) ? null
: suggestedWordInfoList.get(INDEX_OF_TYPED_WORD).mWord, : suggestedWordInfoList.get(INDEX_OF_TYPED_WORD).mWord,
typedWordValid, willAutoCorrect, isObsoleteSuggestions, isPrediction, typedWordValid, willAutoCorrect, isObsoleteSuggestions, isPrediction,
sequenceNumber); sequenceNumber);
......
...@@ -248,13 +248,14 @@ final class SuggestionStripLayoutHelper { ...@@ -248,13 +248,14 @@ final class SuggestionStripLayoutHelper {
final int indexInSuggestedWords) { final int indexInSuggestedWords) {
final int positionInStrip = final int positionInStrip =
getPositionInSuggestionStrip(indexInSuggestedWords, suggestedWords); getPositionInSuggestionStrip(indexInSuggestedWords, suggestedWords);
final boolean isTypedWord = !suggestedWords.mIsPrediction // Use identity for strings, not #equals : it's the typed word if it's the same object
&& (indexInSuggestedWords == SuggestedWords.INDEX_OF_TYPED_WORD); final boolean isTypedWord =
suggestedWords.getWord(indexInSuggestedWords) == suggestedWords.mTypedWord;
final int color; final int color;
if (positionInStrip == mCenterPositionInStrip && suggestedWords.mWillAutoCorrect) { if (positionInStrip == mCenterPositionInStrip && suggestedWords.mWillAutoCorrect) {
color = mColorAutoCorrect; color = mColorAutoCorrect;
} else if (positionInStrip == mCenterPositionInStrip && suggestedWords.mTypedWordValid) { } else if (isTypedWord && suggestedWords.mTypedWordValid) {
color = mColorValidTypedWord; color = mColorValidTypedWord;
} else if (isTypedWord) { } else if (isTypedWord) {
color = mColorTypedWord; color = mColorTypedWord;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment