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

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

Merge "Un-hide ViewGroup#onViewAdded/onViewRemoved" into mnc-dev

parents 91870fa2 6690d018
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -36817,6 +36817,8 @@ package android.view {
    method public boolean onRequestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
    method public boolean onStartNestedScroll(android.view.View, android.view.View, int);
    method public void onStopNestedScroll(android.view.View);
    method public void onViewAdded(android.view.View);
    method public void onViewRemoved(android.view.View);
    method public void recomputeViewAttributes(android.view.View);
    method public void removeAllViews();
    method public void removeAllViewsInLayout();
+2 −0
Original line number Diff line number Diff line
@@ -39097,6 +39097,8 @@ package android.view {
    method public boolean onRequestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
    method public boolean onStartNestedScroll(android.view.View, android.view.View, int);
    method public void onStopNestedScroll(android.view.View);
    method public void onViewAdded(android.view.View);
    method public void onViewRemoved(android.view.View);
    method public void recomputeViewAttributes(android.view.View);
    method public void removeAllViews();
    method public void removeAllViewsInLayout();
+25 −11
Original line number Diff line number Diff line
@@ -4148,24 +4148,38 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        mOnHierarchyChangeListener = listener;
    }

    /**
     * @hide
     */
    protected void onViewAdded(View child) {
    void dispatchViewAdded(View child) {
        onViewAdded(child);
        if (mOnHierarchyChangeListener != null) {
            mOnHierarchyChangeListener.onChildViewAdded(this, child);
        }
    }

    /**
     * @hide
     * Called when a new child is added to this ViewGroup. Overrides should always
     * call super.onViewAdded.
     *
     * @param child the added child view
     */
    protected void onViewRemoved(View child) {
    public void onViewAdded(View child) {
    }

    void dispatchViewRemoved(View child) {
        onViewRemoved(child);
        if (mOnHierarchyChangeListener != null) {
            mOnHierarchyChangeListener.onChildViewRemoved(this, child);
        }
    }

    /**
     * Called when a child view is removed from this ViewGroup. Overrides should always
     * call super.onViewRemoved.
     *
     * @param child the removed child view
     */
    public void onViewRemoved(View child) {
    }

    private void clearCachedLayoutMode() {
        if (!hasBooleanFlag(FLAG_LAYOUT_MODE_WAS_EXPLICITLY_SET)) {
           mLayoutMode = LAYOUT_MODE_UNDEFINED;
@@ -4292,7 +4306,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            child.resetRtlProperties();
        }

        onViewAdded(child);
        dispatchViewAdded(child);

        if ((child.mViewFlags & DUPLICATE_PARENT_STATE) == DUPLICATE_PARENT_STATE) {
            mGroupFlags |= FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE;
@@ -4554,7 +4568,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            }
        }

        onViewRemoved(view);
        dispatchViewRemoved(view);

        if (view.getVisibility() != View.GONE) {
            notifySubtreeAccessibilityStateChangedIfNeeded();
@@ -4646,7 +4660,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager

            needGlobalAttributesUpdate(false);

            onViewRemoved(view);
            dispatchViewRemoved(view);
        }

        removeFromArray(start, count);
@@ -4729,7 +4743,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                childHasTransientStateChanged(view, false);
            }

            onViewRemoved(view);
            dispatchViewRemoved(view);

            view.mParent = null;
            children[i] = null;
@@ -4788,7 +4802,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            childHasTransientStateChanged(child, false);
        }

        onViewRemoved(child);
        dispatchViewRemoved(child);
    }

    /**
+2 −10
Original line number Diff line number Diff line
@@ -935,22 +935,14 @@ public class GridLayout extends ViewGroup {
        super.onDebugDraw(canvas);
    }

    // Add/remove

    /**
     * @hide
     */
    @Override
    protected void onViewAdded(View child) {
    public void onViewAdded(View child) {
        super.onViewAdded(child);
        invalidateStructure();
    }

    /**
     * @hide
     */
    @Override
    protected void onViewRemoved(View child) {
    public void onViewRemoved(View child) {
        super.onViewRemoved(child);
        invalidateStructure();
    }
+2 −2
Original line number Diff line number Diff line
@@ -1608,7 +1608,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    }

    @Override
    protected void onViewRemoved(View child) {
    public void onViewRemoved(View child) {
        super.onViewRemoved(child);
        // we only call our internal methods if this is actually a removal and not just a
        // notification which becomes a child notification
@@ -1745,7 +1745,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    }

    @Override
    protected void onViewAdded(View child) {
    public void onViewAdded(View child) {
        super.onViewAdded(child);
        onViewAddedInternal(child);
    }