diff options
author | 2011-01-19 17:29:27 +0900 | |
---|---|---|
committer | 2011-01-21 15:20:21 +0900 | |
commit | 6f7218627eda110a8454053f8ecb7b80edfdc8ce (patch) | |
tree | 08f3e321e3a3e1833fa05e5814530dd21e8addb4 /java/src/com/android/inputmethod/latin/CandidateView.java | |
parent | a2ad96d95986eb61c3d2d5abce154fb4c3803cac (diff) | |
download | latinime-6f7218627eda110a8454053f8ecb7b80edfdc8ce.tar.gz latinime-6f7218627eda110a8454053f8ecb7b80edfdc8ce.tar.xz latinime-6f7218627eda110a8454053f8ecb7b80edfdc8ce.zip |
Dim previously suggested words
Change-Id: Id673c03bfa22ea9ce1bedb5174d8309a37a2a460
Diffstat (limited to 'java/src/com/android/inputmethod/latin/CandidateView.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/CandidateView.java | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java index d2d1f22dd..fc45c7c75 100644 --- a/java/src/com/android/inputmethod/latin/CandidateView.java +++ b/java/src/com/android/inputmethod/latin/CandidateView.java @@ -16,8 +16,11 @@ package com.android.inputmethod.latin; +import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; + import android.content.Context; import android.content.res.Resources; +import android.graphics.Color; import android.graphics.Typeface; import android.os.Handler; import android.os.Message; @@ -43,6 +46,7 @@ import android.widget.PopupWindow; import android.widget.TextView; import java.util.ArrayList; +import java.util.List; public class CandidateView extends LinearLayout implements OnClickListener, OnLongClickListener { @@ -50,6 +54,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo private static final CharacterStyle UNDERLINE_SPAN = new UnderlineSpan(); private static final int MAX_SUGGESTIONS = 16; + private static boolean DBG = LatinImeLogger.sDBG; + private final ArrayList<View> mWords = new ArrayList<View>(); private final boolean mConfigCandidateHighlightFontColorEnabled; private final CharacterStyle mInvertedForegroundColorSpan; @@ -175,11 +181,12 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo final SuggestedWords suggestions = mSuggestions; clear(); final int count = suggestions.size(); - final Object[] debugInfo = suggestions.mDebugInfo; for (int i = 0; i < count; i++) { CharSequence word = suggestions.getWord(i); if (word == null) continue; final int wordLength = word.length(); + final List<SuggestedWordInfo> suggestedWordInfoList = + suggestions.mSuggestedWordInfoList; final View v = mWords.get(i); final TextView tv = (TextView)v.findViewById(R.id.candidate_word); @@ -209,10 +216,21 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo } tv.setText(word); tv.setClickable(true); - if (debugInfo != null && i < debugInfo.length && debugInfo[i] != null - && !TextUtils.isEmpty(debugInfo[i].toString())) { - dv.setText(debugInfo[i].toString()); - dv.setVisibility(VISIBLE); + + if (suggestedWordInfoList != null && suggestedWordInfoList.get(i) != null) { + final SuggestedWordInfo info = suggestedWordInfoList.get(i); + if (info.isPreviousSuggestedWord()) { + int color = tv.getCurrentTextColor(); + tv.setTextColor(Color.argb((int)(Color.alpha(color) * 0.5f), Color.red(color), + Color.green(color), Color.blue(color))); + } + final String debugString = info.getDebugString(); + if (DBG) { + if (!TextUtils.isEmpty(debugString)) { + dv.setText(debugString); + dv.setVisibility(VISIBLE); + } + } } else { dv.setVisibility(GONE); } |