aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/SuggestionsView.java
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-09-28 15:59:11 +0900
committersatok <satok@google.com>2011-10-10 18:44:52 +0900
commitec780e2868962bf17f0dfd35d36895f543bde40a (patch)
tree50322687e3bd2c01d236fe205ca063819b78eae3 /java/src/com/android/inputmethod/latin/SuggestionsView.java
parentce9e4f926b69745834df677501e59c6db3744de4 (diff)
downloadlatinime-ec780e2868962bf17f0dfd35d36895f543bde40a.tar.gz
latinime-ec780e2868962bf17f0dfd35d36895f543bde40a.tar.xz
latinime-ec780e2868962bf17f0dfd35d36895f543bde40a.zip
Put SuggestionSpan as the indicater of the auto-correction
Bug: 5245468 Change-Id: Ia5609e1b3c69f5553e3632fbce60a55665a5b185
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SuggestionsView.java')
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestionsView.java10
1 files changed, 3 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/SuggestionsView.java b/java/src/com/android/inputmethod/latin/SuggestionsView.java
index fe54f4ae1..3271b8253 100644
--- a/java/src/com/android/inputmethod/latin/SuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/SuggestionsView.java
@@ -260,7 +260,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
private CharSequence getStyledSuggestionWord(SuggestedWords suggestions, int pos) {
final CharSequence word = suggestions.getWord(pos);
- final boolean isAutoCorrect = pos == 1 && willAutoCorrect(suggestions);
+ final boolean isAutoCorrect = pos == 1 && Utils.willAutoCorrect(suggestions);
final boolean isTypedWordValid = pos == 0 && suggestions.mTypedWordValid;
if (!isAutoCorrect && !isTypedWordValid)
return word;
@@ -278,14 +278,10 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
return spannedWord;
}
- private static boolean willAutoCorrect(SuggestedWords suggestions) {
- return !suggestions.mTypedWordValid && suggestions.mHasMinimalSuggestion;
- }
-
private int getWordPosition(int index, SuggestedWords suggestions) {
// TODO: This works for 3 suggestions. Revisit this algorithm when there are 5 or more
// suggestions.
- final int centerPos = willAutoCorrect(suggestions) ? 1 : 0;
+ final int centerPos = Utils.willAutoCorrect(suggestions) ? 1 : 0;
if (index == mCenterSuggestionIndex) {
return centerPos;
} else if (index == centerPos) {
@@ -300,7 +296,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
final boolean isSuggested = (pos != 0);
final int color;
- if (index == mCenterSuggestionIndex && willAutoCorrect(suggestions)) {
+ if (index == mCenterSuggestionIndex && Utils.willAutoCorrect(suggestions)) {
color = mColorAutoCorrect;
} else if (isSuggested) {
color = mColorSuggested;