Merge "Make only top bubble clickable when stack is collapsed"

This commit is contained in:
Sergey Serokurov
2022-01-07 23:25:26 +00:00
committed by Android (Google) Code Review
2 changed files with 22 additions and 0 deletions

View File

@@ -1319,6 +1319,7 @@ public class BubbleController {
* Updates the visibility of the bubbles based on current state.
* Does not un-bubble, just hides or un-hides.
* Updates stack description for TalkBack focus.
* Updates bubbles' icon views clickable states
*/
public void updateStack() {
if (mStackView == null) {
@@ -1336,6 +1337,8 @@ public class BubbleController {
}
mStackView.updateContentDescription();
mStackView.updateBubblesClickableStates();
}
@VisibleForTesting

View File

@@ -1485,6 +1485,25 @@ public class BubbleStackView extends FrameLayout
}
}
/**
* Update bubbles' icon views clickable states.
*/
public void updateBubblesClickableStates() {
for (int i = 0; i < mBubbleData.getBubbles().size(); i++) {
final Bubble bubble = mBubbleData.getBubbles().get(i);
if (bubble.getIconView() != null) {
if (mIsExpanded) {
// when stack is expanded all bubbles are clickable
bubble.getIconView().setClickable(true);
} else {
// when stack is collapsed, only the top bubble needs to be clickable,
// so that a11y ignores all the inaccessible bubbles in the stack
bubble.getIconView().setClickable(i == 0);
}
}
}
}
private void updateSystemGestureExcludeRects() {
// Exclude the region occupied by the first BubbleView in the stack
Rect excludeZone = mSystemGestureExclusionRects.get(0);