am d022df49: Merge "Set content descrition of words in suggestions strip"

* commit 'd022df49bd083b3de68463295d04bbcaadb479a6':
  Set content descrition of words in suggestions strip
main
Tadashi G. Takaoka 2014-06-09 13:04:54 +00:00 committed by Android Git Automerger
commit 5ddbe65a51
3 changed files with 9 additions and 8 deletions

View File

@ -23,6 +23,8 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/suggestions_strip_divider"
android:clickable="false"
android:longClickable="false"
android:contentDescription="@null"
android:padding="0dp"
android:gravity="center" />

View File

@ -379,10 +379,9 @@ final class SuggestionStripLayoutHelper {
} else {
wordView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
}
// Disable this suggestion if the suggestion is null or empty.
// TODO: Fix disabled {@link TextView}'s content description.
wordView.setEnabled(!TextUtils.isEmpty(word));
// {@link StyleSpan} in a content description may cause an issue of TTS/TalkBack.
// Use a simple {@link String} to avoid the issue.
wordView.setContentDescription(TextUtils.isEmpty(word) ? null : word.toString());
final CharSequence text = getEllipsizedText(word, width, wordView.getPaint());
final float scaleX = getTextScaleX(word, width, wordView.getPaint());
wordView.setText(text); // TextView.setText() resets text scale x to 1.0.
@ -461,14 +460,15 @@ final class SuggestionStripLayoutHelper {
}
final TextView wordView = mWordViews.get(positionInStrip);
wordView.setEnabled(true);
wordView.setTextColor(mColorAutoCorrect);
final String punctuation = punctuationSuggestions.getLabel(positionInStrip);
// {@link TextView#getTag()} is used to get the index in suggestedWords at
// {@link SuggestionStripView#onClick(View)}.
wordView.setTag(positionInStrip);
wordView.setText(punctuationSuggestions.getLabel(positionInStrip));
wordView.setText(punctuation);
wordView.setContentDescription(punctuation);
wordView.setTextScaleX(1.0f);
wordView.setCompoundDrawables(null, null, null, null);
wordView.setTextColor(mColorAutoCorrect);
stripView.addView(wordView);
setLayoutWeight(wordView, 1.0f, mSuggestionsStripHeight);
}

View File

@ -163,7 +163,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
word.setOnLongClickListener(this);
mWordViews.add(word);
final View divider = inflater.inflate(R.layout.suggestion_divider, null);
divider.setOnClickListener(this);
mDividerViews.add(divider);
final TextView info = new TextView(context, null, R.attr.suggestionWordStyle);
info.setTextColor(Color.WHITE);