File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -5048,16 +5048,17 @@ public void setLongClickable(boolean longClickable) {
50485048 * the View's internal state from a previously set "pressed" state.
50495049 */
50505050 public void setPressed(boolean pressed) {
5051- if (pressed == ((mPrivateFlags & PRESSED) == PRESSED)) {
5052- return;
5053- }
5051+ final boolean needsRefresh = pressed != ((mPrivateFlags & PRESSED) == PRESSED);
50545052
50555053 if (pressed) {
50565054 mPrivateFlags |= PRESSED;
50575055 } else {
50585056 mPrivateFlags &= ~PRESSED;
50595057 }
5060- refreshDrawableState();
5058+
5059+ if (needsRefresh) {
5060+ refreshDrawableState();
5061+ }
50615062 dispatchSetPressed(pressed);
50625063 }
50635064
Original file line number Diff line number Diff line change @@ -2770,7 +2770,13 @@ protected void dispatchSetPressed(boolean pressed) {
27702770 final View [] children = mChildren ;
27712771 final int count = mChildrenCount ;
27722772 for (int i = 0 ; i < count ; i ++) {
2773- children [i ].setPressed (pressed );
2773+ final View child = children [i ];
2774+ // Children that are clickable on their own should not
2775+ // show a pressed state when their parent view does.
2776+ // Clearing a pressed state always propagates.
2777+ if (!pressed || (!child .isClickable () && !child .isLongClickable ())) {
2778+ child .setPressed (pressed );
2779+ }
27742780 }
27752781 }
27762782
You can’t perform that action at this time.
0 commit comments