am d02daf20: Merge "Fix punctuations strip"
* commit 'd02daf201631e5da042a43faf86e439c6904564c': Fix punctuations stripmain
commit
2cf3056354
|
@ -449,8 +449,10 @@ final class SuggestionStripLayoutHelper {
|
||||||
final TextView wordView = mWordViews.get(positionInStrip);
|
final TextView wordView = mWordViews.get(positionInStrip);
|
||||||
wordView.setEnabled(true);
|
wordView.setEnabled(true);
|
||||||
wordView.setTextColor(mColorAutoCorrect);
|
wordView.setTextColor(mColorAutoCorrect);
|
||||||
final String punctuation = suggestedWords.getWord(positionInStrip);
|
// {@link TextView#getTag()} is used to get the index in suggestedWords at
|
||||||
wordView.setText(punctuation);
|
// {@link SuggestionStripView#onClick(View)}.
|
||||||
|
wordView.setTag(positionInStrip);
|
||||||
|
wordView.setText(suggestedWords.getWord(positionInStrip));
|
||||||
wordView.setTextScaleX(1.0f);
|
wordView.setTextScaleX(1.0f);
|
||||||
wordView.setCompoundDrawables(null, null, null, null);
|
wordView.setCompoundDrawables(null, null, null, null);
|
||||||
stripView.addView(wordView);
|
stripView.addView(wordView);
|
||||||
|
@ -468,6 +470,8 @@ final class SuggestionStripLayoutHelper {
|
||||||
final int wordWidth = (int)(width * mCenterSuggestionWeight);
|
final int wordWidth = (int)(width * mCenterSuggestionWeight);
|
||||||
final CharSequence text = getEllipsizedText(word, wordWidth, wordView.getPaint());
|
final CharSequence text = getEllipsizedText(word, wordWidth, wordView.getPaint());
|
||||||
final float wordScaleX = wordView.getTextScaleX();
|
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.setTag(word);
|
||||||
wordView.setText(text);
|
wordView.setText(text);
|
||||||
wordView.setTextScaleX(wordScaleX);
|
wordView.setTextScaleX(wordScaleX);
|
||||||
|
@ -497,8 +501,10 @@ final class SuggestionStripLayoutHelper {
|
||||||
hintView.setOnClickListener(listener);
|
hintView.setOnClickListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence getAddToDictionaryWord() {
|
public String getAddToDictionaryWord() {
|
||||||
return (CharSequence)mWordToSaveView.getTag();
|
// String tag is set at
|
||||||
|
// {@link #layoutAddToDictionaryHint(String,ViewGroup,int,CharSequence,OnClickListener}.
|
||||||
|
return (String)mWordToSaveView.getTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAddToDictionaryShowing(final View v) {
|
public boolean isAddToDictionaryShowing(final View v) {
|
||||||
|
|
|
@ -306,12 +306,15 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View view) {
|
public void onClick(final View view) {
|
||||||
if (mLayoutHelper.isAddToDictionaryShowing(view)) {
|
if (mLayoutHelper.isAddToDictionaryShowing(view)) {
|
||||||
mListener.addWordToUserDictionary(mLayoutHelper.getAddToDictionaryWord().toString());
|
mListener.addWordToUserDictionary(mLayoutHelper.getAddToDictionaryWord());
|
||||||
clear();
|
clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Object tag = view.getTag();
|
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)) {
|
if (!(tag instanceof Integer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue