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

Commit a3e49a4b authored by Alan Viverette's avatar Alan Viverette
Browse files

Propagate drawable hotspots when duplicate parent state is enabled

Makes hotspot-centered ripples "just work" everywhere that old-style
pressed states work.

BUG: 17407652
Change-Id: Id4802662aea537959122f029e85aa576cf51b641
parent f2f3bde6
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -5721,6 +5721,28 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        }
    }

    @Override
    public void drawableHotspotChanged(float x, float y) {
        super.drawableHotspotChanged(x, y);

        if ((mGroupFlags & FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE) != 0) {
            if ((mGroupFlags & FLAG_ADD_STATES_FROM_CHILDREN) != 0) {
                throw new IllegalStateException("addStateFromChildren cannot be enabled if a"
                        + " child has duplicateParentState set to true");
            }

            final View[] children = mChildren;
            final int count = mChildrenCount;

            for (int i = 0; i < count; i++) {
                final View child = children[i];
                if ((child.mViewFlags & DUPLICATE_PARENT_STATE) != 0) {
                    child.drawableHotspotChanged(x, y);
                }
            }
        }
    }

    @Override
    protected int[] onCreateDrawableState(int extraSpace) {
        if ((mGroupFlags & FLAG_ADD_STATES_FROM_CHILDREN) == 0) {