diff options
author | 2013-06-21 02:25:27 -0700 | |
---|---|---|
committer | 2013-06-21 02:25:27 -0700 | |
commit | 2cf3056354261c015af708fd2503d39b366e3713 (patch) | |
tree | 53eae5220317fed9e88019da7d4f3ed9c0215714 /java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java | |
parent | c65d19fb9280ccfa8426970eeff874b5315e562d (diff) | |
parent | d02daf201631e5da042a43faf86e439c6904564c (diff) | |
download | latinime-2cf3056354261c015af708fd2503d39b366e3713.tar.gz latinime-2cf3056354261c015af708fd2503d39b366e3713.tar.xz latinime-2cf3056354261c015af708fd2503d39b366e3713.zip |
am d02daf20: Merge "Fix punctuations strip"
* commit 'd02daf201631e5da042a43faf86e439c6904564c':
Fix punctuations strip
Diffstat (limited to 'java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java index f434a1211..916f483b9 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java @@ -449,8 +449,10 @@ final class SuggestionStripLayoutHelper { final TextView wordView = mWordViews.get(positionInStrip); wordView.setEnabled(true); wordView.setTextColor(mColorAutoCorrect); - final String punctuation = suggestedWords.getWord(positionInStrip); - wordView.setText(punctuation); + // {@link TextView#getTag()} is used to get the index in suggestedWords at + // {@link SuggestionStripView#onClick(View)}. + wordView.setTag(positionInStrip); + wordView.setText(suggestedWords.getWord(positionInStrip)); wordView.setTextScaleX(1.0f); wordView.setCompoundDrawables(null, null, null, null); stripView.addView(wordView); @@ -468,6 +470,8 @@ final class SuggestionStripLayoutHelper { final int wordWidth = (int)(width * mCenterSuggestionWeight); final CharSequence text = getEllipsizedText(word, wordWidth, wordView.getPaint()); final float wordScaleX = wordView.getTextScaleX(); + // {@link TextView#setTag()} is used to hold the word to be added to dictionary. The word + // will be extracted at {@link #getAddToDictionaryWord()}. wordView.setTag(word); wordView.setText(text); wordView.setTextScaleX(wordScaleX); @@ -497,8 +501,10 @@ final class SuggestionStripLayoutHelper { hintView.setOnClickListener(listener); } - public CharSequence getAddToDictionaryWord() { - return (CharSequence)mWordToSaveView.getTag(); + public String getAddToDictionaryWord() { + // String tag is set at + // {@link #layoutAddToDictionaryHint(String,ViewGroup,int,CharSequence,OnClickListener}. + return (String)mWordToSaveView.getTag(); } public boolean isAddToDictionaryShowing(final View v) { |