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

Commit e28cd1a2 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Only request layout when removeView() actually removes a view" into lmp-mr1-dev

parents 846b71da 177ec460
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -4078,10 +4078,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * {@link #dispatchDraw(android.graphics.Canvas)} or any related method.</p>
     */
    public void removeView(View view) {
        removeViewInternal(view);
        if (removeViewInternal(view)) {
            requestLayout();
            invalidate(true);
        }
    }

    /**
     * Removes a view during layout. This is useful if in your onLayout() method,
@@ -4143,11 +4144,13 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        invalidate(true);
    }

    private void removeViewInternal(View view) {
    private boolean removeViewInternal(View view) {
        final int index = indexOfChild(view);
        if (index >= 0) {
            removeViewInternal(index, view);
            return true;
        }
        return false;
    }

    private void removeViewInternal(int index, View view) {