Merge "Set content descrition of words in suggestions strip"
This commit is contained in:
commit
d022df49bd
3 changed files with 9 additions and 8 deletions
|
@ -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" />
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue