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

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

Merge "Remove call to setPadding() in setUseDefaultMargins()."

parents 284585aa b559976a
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -395,10 +395,6 @@ public class GridLayout extends ViewGroup {
     */
    public void setUseDefaultMargins(boolean useDefaultMargins) {
        mUseDefaultMargins = useDefaultMargins;
        if (useDefaultMargins) {
            int padding = mDefaultGap;
            setPadding(padding, padding, padding, padding);
        }
        requestLayout();
    }

@@ -740,6 +736,10 @@ public class GridLayout extends ViewGroup {
        graphics.drawLine(dx + x1, dy + y1, dx + x2, dy + y2, paint);
    }

    private static void drawRect(Canvas canvas, int x1, int y1, int x2, int y2, Paint paint) {
        canvas.drawRect(x1, y1, x2 - 1, y2 - 1, paint);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
@@ -772,14 +772,14 @@ public class GridLayout extends ViewGroup {
            paint.setColor(Color.BLUE);
            for (int i = 0; i < getChildCount(); i++) {
                View c = getChildAt(i);
                canvas.drawRect(c.getLeft(), c.getTop(), c.getRight(), c.getBottom(), paint);
                drawRect(canvas, c.getLeft(), c.getTop(), c.getRight(), c.getBottom(), paint);
            }

            // Draw margins
            paint.setColor(Color.MAGENTA);
            for (int i = 0; i < getChildCount(); i++) {
                View c = getChildAt(i);
                canvas.drawRect(
                drawRect(canvas,
                        c.getLeft() - getMargin1(c, true, true),
                        c.getTop() - getMargin1(c, false, true),
                        c.getRight() + getMargin1(c, true, false),
+5 −4
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@

        android:useDefaultMargins="true"
        android:alignmentMode="alignBounds"
        android:rowOrderPreserved="false"

        android:columnCount="4"
        >
@@ -49,7 +50,7 @@
            />

    <EditText
            android:layout_width="64dip"
            android:ems="10"
            />

    <TextView
@@ -60,13 +61,13 @@
            />

    <EditText
            android:layout_width="32dip"
            android:ems="8"
            />

    <Space
            android:layout_row="4"
            android:layout_row="2"
            android:layout_rowSpan="3"
            android:layout_column="2"
            android:layout_margin="0dip"
            android:layout_gravity="fill"
            />

+4 −12
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ public class Activity2 extends Activity {
        p.setUseDefaultMargins(true);
        p.setAlignmentMode(ALIGN_BOUNDS);
        p.setRowOrderPreserved(false);
        p.setPadding(0, 0, 0, 0);

        Spec row1 = spec(0);
        Spec row2 = spec(1);
@@ -75,12 +74,9 @@ public class Activity2 extends Activity {
        }
        {
            EditText c = new EditText(context);
            c.setEms(10);
            c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
            {
                LayoutParams lp = new LayoutParams(row3, col2);
                lp.width = (int) c.getPaint().measureText("Frederick.W.Flintstone");
                p.addView(c, lp);
            }
            p.addView(c, new LayoutParams(row3, col2));
        }
        {
            TextView c = new TextView(context);
@@ -89,17 +85,13 @@ public class Activity2 extends Activity {
        }
        {
            TextView c = new EditText(context);
            c.setEms(8);
            c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD);
            {
                LayoutParams lp = new LayoutParams(row4, col2);
                lp.width = (int) c.getPaint().measureText("************");
                p.addView(c, lp);
            }
            p.addView(c, new LayoutParams(row4, col2));
        }
        {
            Space c = new Space(context);
            LayoutParams lp = new LayoutParams(row5, col3);
            lp.setMargins(0, 0, 0, 0);
            p.addView(c, lp);
        }
        {