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

Commit f7da5697 authored by Philip Milne's avatar Philip Milne Committed by Android (Google) Code Review
Browse files

Merge "Optical bounds support for LinearLayout, TableLayout and TableRow."

parents e7fc0771 ad365cc2
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -2784,9 +2784,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        {
            paint.setColor(Color.RED);
            paint.setStyle(Paint.Style.STROKE);
            PathEffect pathEffect = paint.getPathEffect();
            int len = dipsToPixels(4);
            paint.setPathEffect(new DashPathEffect(new float[]{len, len}, 0));

            for (int i = 0; i < getChildCount(); i++) {
                View c = getChildAt(i);
@@ -2798,7 +2795,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                        c.getRight()  - insets.right  - 1,
                        c.getBottom() - insets.bottom - 1);
            }
            paint.setPathEffect(pathEffect);
        }

        // Draw margins
+18 −10
Original line number Diff line number Diff line
@@ -1431,9 +1431,9 @@ public class LinearLayout extends ViewGroup {
    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        if (mOrientation == VERTICAL) {
            layoutVertical();
            layoutVertical(l, t, r, b);
        } else {
            layoutHorizontal();
            layoutHorizontal(l, t, r, b);
        }
    }

@@ -1444,15 +1444,19 @@ public class LinearLayout extends ViewGroup {
     * @see #getOrientation()
     * @see #setOrientation(int)
     * @see #onLayout(boolean, int, int, int, int)
     * @param left
     * @param top
     * @param right
     * @param bottom
     */
    void layoutVertical() {
    void layoutVertical(int left, int top, int right, int bottom) {
        final int paddingLeft = mPaddingLeft;

        int childTop;
        int childLeft;
        
        // Where right end of child should go
        final int width = mRight - mLeft;
        final int width = right - left;
        int childRight = width - mPaddingRight;
        
        // Space available for child
@@ -1466,12 +1470,12 @@ public class LinearLayout extends ViewGroup {
        switch (majorGravity) {
           case Gravity.BOTTOM:
               // mTotalLength contains the padding already
               childTop = mPaddingTop + mBottom - mTop - mTotalLength;
               childTop = mPaddingTop + bottom - top - mTotalLength;
               break;

               // mTotalLength contains the padding already
           case Gravity.CENTER_VERTICAL:
               childTop = mPaddingTop + (mBottom - mTop - mTotalLength) / 2;
               childTop = mPaddingTop + (bottom - top - mTotalLength) / 2;
               break;

           case Gravity.TOP:
@@ -1534,8 +1538,12 @@ public class LinearLayout extends ViewGroup {
     * @see #getOrientation()
     * @see #setOrientation(int)
     * @see #onLayout(boolean, int, int, int, int)
     * @param left
     * @param top
     * @param right
     * @param bottom
     */
    void layoutHorizontal() {
    void layoutHorizontal(int left, int top, int right, int bottom) {
        final boolean isLayoutRtl = isLayoutRtl();
        final int paddingTop = mPaddingTop;

@@ -1543,7 +1551,7 @@ public class LinearLayout extends ViewGroup {
        int childLeft;
        
        // Where bottom of child should go
        final int height = mBottom - mTop;
        final int height = bottom - top;
        int childBottom = height - mPaddingBottom; 
        
        // Space available for child
@@ -1563,12 +1571,12 @@ public class LinearLayout extends ViewGroup {
        switch (Gravity.getAbsoluteGravity(majorGravity, layoutDirection)) {
            case Gravity.RIGHT:
                // mTotalLength contains the padding already
                childLeft = mPaddingLeft + mRight - mLeft - mTotalLength;
                childLeft = mPaddingLeft + right - left - mTotalLength;
                break;

            case Gravity.CENTER_HORIZONTAL:
                // mTotalLength contains the padding already
                childLeft = mPaddingLeft + (mRight - mLeft - mTotalLength) / 2;
                childLeft = mPaddingLeft + (right - left - mTotalLength) / 2;
                break;

            case Gravity.LEFT:
+1 −1
Original line number Diff line number Diff line
@@ -445,7 +445,7 @@ public class TableLayout extends LinearLayout {
    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        // enforce vertical layout
        layoutVertical();
        layoutVertical(l, t, r, b);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ public class TableRow extends LinearLayout {
    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        // enforce horizontal layout
        layoutHorizontal();
        layoutHorizontal(l, t, r, b);
    }

    /**