From 0c34ee20a80884fea49b228745ce87132ae6f22f Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 25 Feb 2014 15:35:37 +0900 Subject: [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 --- .../inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java') diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java index 9b66773e0..afa8fe3a8 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java @@ -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; -- cgit v1.2.3-83-g751a