aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2013-06-21 10:44:14 +0900
committerTadashi G. Takaoka <takaoka@google.com>2013-06-21 13:22:37 +0900
commit9b570b5e62581f41c40c4558d95c77ad5896934c (patch)
tree1ffa203a80ff0ee801ff127c8df0e21a415a753e /java/src/com
parent0c178ffc8e21467890fcc2433cf27108c090e6fc (diff)
downloadlatinime-9b570b5e62581f41c40c4558d95c77ad5896934c.tar.gz
latinime-9b570b5e62581f41c40c4558d95c77ad5896934c.tar.xz
latinime-9b570b5e62581f41c40c4558d95c77ad5896934c.zip
Fix punctuations strip
Bug: 9508186 Change-Id: I8f0fbf4e0578cf9116d4c57e7e5747d38c89387e
Diffstat (limited to 'java/src/com')
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java14
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java5
2 files changed, 14 insertions, 5 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) {
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index b2b9427af..2284a4607 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -306,12 +306,15 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
@Override
public void onClick(final View view) {
if (mLayoutHelper.isAddToDictionaryShowing(view)) {
- mListener.addWordToUserDictionary(mLayoutHelper.getAddToDictionaryWord().toString());
+ mListener.addWordToUserDictionary(mLayoutHelper.getAddToDictionaryWord());
clear();
return;
}
final Object tag = view.getTag();
+ // Integer tag is set at
+ // {@link SuggestionStripLayoutHelper#setupWordViewsTextAndColor(SuggestedWords,int)} and
+ // {@link SuggestionStripLayoutHelper#layoutPunctuationSuggestions(SuggestedWords,ViewGroup}
if (!(tag instanceof Integer)) {
return;
}