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

Commit 177ec460 authored by Alan Viverette's avatar Alan Viverette
Browse files

Only request layout when removeView() actually removes a view

BUG: 18035456
Change-Id: Iec82be63ef9fc4d0ff90d93f8f3a65328a5e1eba
parent 12c84b5d
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line 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>
     * {@link #dispatchDraw(android.graphics.Canvas)} or any related method.</p>
     */
     */
    public void removeView(View view) {
    public void removeView(View view) {
        removeViewInternal(view);
        if (removeViewInternal(view)) {
            requestLayout();
            requestLayout();
            invalidate(true);
            invalidate(true);
        }
        }
    }


    /**
    /**
     * Removes a view during layout. This is useful if in your onLayout() method,
     * 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);
        invalidate(true);
    }
    }


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


    private void removeViewInternal(int index, View view) {
    private void removeViewInternal(int index, View view) {