Skip to content

Commit

Permalink
[TimePicker][a11y] Make Talkback announce selected state for clock items
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 413955068
  • Loading branch information
paulfthomas authored and josefigueroa168 committed Dec 6, 2021
1 parent 6a3ea94 commit fcc68a2
Showing 1 changed file with 8 additions and 7 deletions.
Expand Up @@ -261,17 +261,18 @@ private void findIntersectingTextView() {
offsetDescendantRectToMyCoords(tv, textViewRect);

scratch.set(textViewRect);
RadialGradient radialGradient = getGradientForTextView(selectorBox, scratch);
tv.getPaint().setShader(radialGradient);
if (RectF.intersects(selectorBox, scratch)) {
tv.getPaint().setShader(getGradient(selectorBox));
tv.setSelected(true);
} else {
tv.getPaint().setShader(null); // clear
tv.setSelected(false);
}
tv.invalidate();
}
}

private RadialGradient getGradientForTextView(RectF selectorBox, RectF tvBox) {
if (!RectF.intersects(selectorBox, tvBox)) {
return null;
}

private RadialGradient getGradient(RectF selectorBox) {
return new RadialGradient(
(selectorBox.centerX() - scratch.left),
(selectorBox.centerY() - scratch.top),
Expand Down

0 comments on commit fcc68a2

Please sign in to comment.