Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bce4d986 authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "View pressed state dispatching tweaks"

parents 74c96101 035a1fcd
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -5048,16 +5048,17 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     *        the View's internal state from a previously set "pressed" state.
     */
    public void setPressed(boolean pressed) {
        if (pressed == ((mPrivateFlags & PRESSED) == PRESSED)) {
            return;
        }
        final boolean needsRefresh = pressed != ((mPrivateFlags & PRESSED) == PRESSED);
        if (pressed) {
            mPrivateFlags |= PRESSED;
        } else {
            mPrivateFlags &= ~PRESSED;
        }
        if (needsRefresh) {
            refreshDrawableState();
        }
        dispatchSetPressed(pressed);
    }
+7 −1
Original line number Diff line number Diff line
@@ -2770,7 +2770,13 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        final View[] children = mChildren;
        final int count = mChildrenCount;
        for (int i = 0; i < count; i++) {
            children[i].setPressed(pressed);
            final View child = children[i];
            // Children that are clickable on their own should not
            // show a pressed state when their parent view does.
            // Clearing a pressed state always propagates.
            if (!pressed || (!child.isClickable() && !child.isLongClickable())) {
                child.setPressed(pressed);
            }
        }
    }