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

Commit b3a8c543 authored by Philip Milne's avatar Philip Milne
Browse files

Accomodate margins in child measurements.

Also:

. Cater for components that are GONE.
. Include code to draw component bounds and margins when in DEBUG mode.

Change-Id: I688f8b638469eb11987ebb207b7db1dc953e84e7
parent cd8ad7c7
Loading
Loading
Loading
Loading
+149 −64
Original line number Original line Diff line number Diff line
@@ -170,7 +170,6 @@ public class GridLayout extends ViewGroup {


    private static final String TAG = GridLayout.class.getName();
    private static final String TAG = GridLayout.class.getName();
    private static final boolean DEBUG = false;
    private static final boolean DEBUG = false;
    private static Paint GRID_PAINT;
    private static final double GOLDEN_RATIO = (1 + Math.sqrt(5)) / 2;
    private static final double GOLDEN_RATIO = (1 + Math.sqrt(5)) / 2;
    private static final int MIN = 0;
    private static final int MIN = 0;
    private static final int PRF = 1;
    private static final int PRF = 1;
@@ -196,15 +195,6 @@ public class GridLayout extends ViewGroup {
    private static final int ROW_ORDER_PRESERVED = styleable.GridLayout_rowOrderPreserved;
    private static final int ROW_ORDER_PRESERVED = styleable.GridLayout_rowOrderPreserved;
    private static final int COLUMN_ORDER_PRESERVED = styleable.GridLayout_columnOrderPreserved;
    private static final int COLUMN_ORDER_PRESERVED = styleable.GridLayout_columnOrderPreserved;


    // Static initialization

    static {
        if (DEBUG) {
            GRID_PAINT = new Paint();
            GRID_PAINT.setColor(Color.argb(50, 255, 255, 255));
        }
    }

    // Instance variables
    // Instance variables


    private final Axis mHorizontalAxis = new Axis(true);
    private final Axis mHorizontalAxis = new Axis(true);
@@ -605,7 +595,9 @@ public class GridLayout extends ViewGroup {
                int row = 0;
                int row = 0;
                int col = 0;
                int col = 0;
                for (int i = 0, N = getChildCount(); i < N; i++) {
                for (int i = 0, N = getChildCount(); i < N; i++) {
                    LayoutParams lp = getLayoutParams1(getChildAt(i));
                    View c = getChildAt(i);
                    if (isGone(c)) continue;
                    LayoutParams lp = getLayoutParams1(c);


                    Group colGroup = lp.columnGroup;
                    Group colGroup = lp.columnGroup;
                    Interval cols = colGroup.span;
                    Interval cols = colGroup.span;
@@ -703,6 +695,15 @@ public class GridLayout extends ViewGroup {
        graphics.drawLine(dx + x1, dy + y1, dx + x2, dy + y2, paint);
        graphics.drawLine(dx + x1, dy + y1, dx + x2, dy + y2, paint);
    }
    }


    private void drawRectangle(Canvas graphics, int x1, int y1, int x2, int y2, Paint paint) {
        // x2 = x2 - 1;
        // y2 = y2 - 1;
        graphics.drawLine(x1, y1, x1, y2, paint);
        graphics.drawLine(x1, y1, x2, y1, paint);
        graphics.drawLine(x1, y2, x2, y2, paint);
        graphics.drawLine(x2, y1, x2, y2, paint);
    }

    @Override
    @Override
    protected void onDraw(Canvas canvas) {
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        super.onDraw(canvas);
@@ -711,15 +712,46 @@ public class GridLayout extends ViewGroup {
            int height = getHeight() - getPaddingTop() - getPaddingBottom();
            int height = getHeight() - getPaddingTop() - getPaddingBottom();
            int width = getWidth() - getPaddingLeft() - getPaddingRight();
            int width = getWidth() - getPaddingLeft() - getPaddingRight();


            Paint paint = new Paint();
            paint.setColor(Color.argb(50, 255, 255, 255));

            int[] xs = mHorizontalAxis.locations;
            int[] xs = mHorizontalAxis.locations;
            if (xs != null) {
                for (int i = 0, length = xs.length; i < length; i++) {
                for (int i = 0, length = xs.length; i < length; i++) {
                    int x = xs[i];
                    int x = xs[i];
                drawLine(canvas, x, 0, x, height - 1, GRID_PAINT);
                    drawLine(canvas, x, 0, x, height - 1, paint);
                }
                }
            }

            int[] ys = mVerticalAxis.locations;
            int[] ys = mVerticalAxis.locations;
            if (ys != null) {
                for (int i = 0, length = ys.length; i < length; i++) {
                for (int i = 0, length = ys.length; i < length; i++) {
                    int y = ys[i];
                    int y = ys[i];
                drawLine(canvas, 0, y, width - 1, y, GRID_PAINT);
                    drawLine(canvas, 0, y, width - 1, y, paint);
                }
            }
            // Draw bounds
            paint.setColor(Color.BLUE);

            for (int i = 0; i < getChildCount(); i++) {
                View c = getChildAt(i);
                drawRectangle(canvas,
                        c.getLeft(),
                        c.getTop(),
                        c.getRight(),
                        c.getBottom(), paint);
            }

            // Draw margins
            paint.setColor(Color.YELLOW);

            for (int i = 0; i < getChildCount(); i++) {
                View c = getChildAt(i);
                drawRectangle(canvas,
                        c.getLeft() - getMargin(c, true, true),
                        c.getTop() - getMargin(c, true, false),
                        c.getRight() + getMargin(c, false, true),
                        c.getBottom() + getMargin(c, false, false), paint);
            }
            }
        }
        }
    }
    }
@@ -758,9 +790,35 @@ public class GridLayout extends ViewGroup {


    // Measurement
    // Measurement


    private boolean isGone(View c) {
        return c.getVisibility() == View.GONE;
    }

    private void measureChildWithMargins(View child,
            int parentWidthMeasureSpec, int parentHeightMeasureSpec) {

        LayoutParams lp = getLayoutParams(child);
        int hMargins = getMargin(child, true, true) + getMargin(child, false, true);
        int childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec,
                mPaddingLeft + mPaddingRight + hMargins, lp.width);
        int vMargins = getMargin(child, true, false) + getMargin(child, false, false);
        int childHeightMeasureSpec = getChildMeasureSpec(parentHeightMeasureSpec,
                mPaddingTop + mPaddingBottom + vMargins, lp.height);

        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
    }

    private void measureChildrenWithMargins(int widthMeasureSpec, int heightMeasureSpec) {
        for (int i = 0, N = getChildCount(); i < N; i++) {
            View c = getChildAt(i);
            if (isGone(c)) continue;
            measureChildWithMargins(c, widthMeasureSpec, heightMeasureSpec);
        }
    }

    @Override
    @Override
    protected void onMeasure(int widthSpec, int heightSpec) {
    protected void onMeasure(int widthSpec, int heightSpec) {
        measureChildren(widthSpec, heightSpec);
        measureChildrenWithMargins(widthSpec, heightSpec);


        int computedWidth = getPaddingLeft() + mHorizontalAxis.getMin() + getPaddingRight();
        int computedWidth = getPaddingLeft() + mHorizontalAxis.getMin() + getPaddingRight();
        int computedHeight = getPaddingTop() + mVerticalAxis.getMin() + getPaddingBottom();
        int computedHeight = getPaddingTop() + mVerticalAxis.getMin() + getPaddingBottom();
@@ -824,26 +882,27 @@ public class GridLayout extends ViewGroup {
        mHorizontalAxis.layout(targetWidth - paddingLeft - paddingRight);
        mHorizontalAxis.layout(targetWidth - paddingLeft - paddingRight);
        mVerticalAxis.layout(targetHeight - paddingTop - paddingBottom);
        mVerticalAxis.layout(targetHeight - paddingTop - paddingBottom);


        for (int i = 0, size = getChildCount(); i < size; i++) {
        for (int i = 0, N = getChildCount(); i < N; i++) {
            View view = getChildAt(i);
            View c = getChildAt(i);
            LayoutParams lp = getLayoutParams(view);
            if (isGone(c)) continue;
            LayoutParams lp = getLayoutParams(c);
            Group columnGroup = lp.columnGroup;
            Group columnGroup = lp.columnGroup;
            Group rowGroup = lp.rowGroup;
            Group rowGroup = lp.rowGroup;


            Interval colSpan = columnGroup.span;
            Interval colSpan = columnGroup.span;
            Interval rowSpan = rowGroup.span;
            Interval rowSpan = rowGroup.span;


            int x1 = mHorizontalAxis.getLocationIncludingMargin(view, true, colSpan.min);
            int x1 = mHorizontalAxis.getLocationIncludingMargin(c, true, colSpan.min);
            int y1 = mVerticalAxis.getLocationIncludingMargin(view, true, rowSpan.min);
            int y1 = mVerticalAxis.getLocationIncludingMargin(c, true, rowSpan.min);


            int x2 = mHorizontalAxis.getLocationIncludingMargin(view, false, colSpan.max);
            int x2 = mHorizontalAxis.getLocationIncludingMargin(c, false, colSpan.max);
            int y2 = mVerticalAxis.getLocationIncludingMargin(view, false, rowSpan.max);
            int y2 = mVerticalAxis.getLocationIncludingMargin(c, false, rowSpan.max);


            int cellWidth = x2 - x1;
            int cellWidth = x2 - x1;
            int cellHeight = y2 - y1;
            int cellHeight = y2 - y1;


            int pWidth = getMeasurement(view, true, PRF);
            int pWidth = getMeasurement(c, true, PRF);
            int pHeight = getMeasurement(view, false, PRF);
            int pHeight = getMeasurement(c, false, PRF);


            Alignment hAlign = columnGroup.alignment;
            Alignment hAlign = columnGroup.alignment;
            Alignment vAlign = rowGroup.alignment;
            Alignment vAlign = rowGroup.alignment;
@@ -859,18 +918,18 @@ public class GridLayout extends ViewGroup {
            int c2ay = protect(vAlign.getAlignmentValue(null, cellHeight - rowBounds.size(), type));
            int c2ay = protect(vAlign.getAlignmentValue(null, cellHeight - rowBounds.size(), type));


            if (mAlignmentMode == ALIGN_MARGINS) {
            if (mAlignmentMode == ALIGN_MARGINS) {
                int leftMargin = getMargin(view, true, true);
                int leftMargin = getMargin(c, true, true);
                int topMargin = getMargin(view, true, false);
                int topMargin = getMargin(c, true, false);
                int rightMargin = getMargin(view, false, true);
                int rightMargin = getMargin(c, false, true);
                int bottomMargin = getMargin(view, false, false);
                int bottomMargin = getMargin(c, false, false);


                // Same calculation as getMeasurementIncludingMargin()
                // Same calculation as getMeasurementIncludingMargin()
                int mWidth = leftMargin + pWidth + rightMargin;
                int mWidth = leftMargin + pWidth + rightMargin;
                int mHeight = topMargin + pHeight + bottomMargin;
                int mHeight = topMargin + pHeight + bottomMargin;


                // Alignment offsets: the location of the view relative to its alignment group.
                // Alignment offsets: the location of the view relative to its alignment group.
                int a2vx = colBounds.before - hAlign.getAlignmentValue(view, mWidth, type);
                int a2vx = colBounds.before - hAlign.getAlignmentValue(c, mWidth, type);
                int a2vy = rowBounds.before - vAlign.getAlignmentValue(view, mHeight, type);
                int a2vy = rowBounds.before - vAlign.getAlignmentValue(c, mHeight, type);


                dx = c2ax + a2vx + leftMargin;
                dx = c2ax + a2vx + leftMargin;
                dy = c2ay + a2vy + topMargin;
                dy = c2ay + a2vy + topMargin;
@@ -879,19 +938,19 @@ public class GridLayout extends ViewGroup {
                cellHeight -= topMargin + bottomMargin;
                cellHeight -= topMargin + bottomMargin;
            } else {
            } else {
                // Alignment offsets: the location of the view relative to its alignment group.
                // Alignment offsets: the location of the view relative to its alignment group.
                int a2vx = colBounds.before - hAlign.getAlignmentValue(view, pWidth, type);
                int a2vx = colBounds.before - hAlign.getAlignmentValue(c, pWidth, type);
                int a2vy = rowBounds.before - vAlign.getAlignmentValue(view, pHeight, type);
                int a2vy = rowBounds.before - vAlign.getAlignmentValue(c, pHeight, type);


                dx = c2ax + a2vx;
                dx = c2ax + a2vx;
                dy = c2ay + a2vy;
                dy = c2ay + a2vy;
            }
            }


            int width = hAlign.getSizeInCell(view, pWidth, cellWidth, type);
            int width = hAlign.getSizeInCell(c, pWidth, cellWidth, type);
            int height = vAlign.getSizeInCell(view, pHeight, cellHeight, type);
            int height = vAlign.getSizeInCell(c, pHeight, cellHeight, type);


            int cx = paddingLeft + x1 + dx;
            int cx = paddingLeft + x1 + dx;
            int cy = paddingTop + y1 + dy;
            int cy = paddingTop + y1 + dy;
            view.layout(cx, cy, cx + width, cy + height);
            c.layout(cx, cy, cx + width, cy + height);
        }
        }
    }
    }


@@ -946,8 +1005,10 @@ public class GridLayout extends ViewGroup {
        private int maxIndex() {
        private int maxIndex() {
            // note the number Integer.MIN_VALUE + 1 comes up in undefined cells
            // note the number Integer.MIN_VALUE + 1 comes up in undefined cells
            int count = -1;
            int count = -1;
            for (int i = 0, size = getChildCount(); i < size; i++) {
            for (int i = 0, N = getChildCount(); i < N; i++) {
                LayoutParams params = getLayoutParams(getChildAt(i));
                View c = getChildAt(i);
                if (isGone(c)) continue;
                LayoutParams params = getLayoutParams(c);
                Group g = horizontal ? params.columnGroup : params.rowGroup;
                Group g = horizontal ? params.columnGroup : params.rowGroup;
                count = max(count, g.span.min);
                count = max(count, g.span.min);
                count = max(count, g.span.max);
                count = max(count, g.span.max);
@@ -980,9 +1041,13 @@ public class GridLayout extends ViewGroup {
        private PackedMap<Group, Bounds> createGroupBounds() {
        private PackedMap<Group, Bounds> createGroupBounds() {
            int N = getChildCount();
            int N = getChildCount();
            Group[] groups = new Group[N];
            Group[] groups = new Group[N];
            Arrays.fill(groups, Group.GONE);
            Bounds[] bounds = new Bounds[N];
            Bounds[] bounds = new Bounds[N];
            Arrays.fill(bounds, Bounds.GONE);
            for (int i = 0; i < N; i++) {
            for (int i = 0; i < N; i++) {
                LayoutParams lp = getLayoutParams(getChildAt(i));
                View c = getChildAt(i);
                if (isGone(c)) continue;
                LayoutParams lp = getLayoutParams(c);
                Group group = horizontal ? lp.columnGroup : lp.rowGroup;
                Group group = horizontal ? lp.columnGroup : lp.rowGroup;


                groups[i] = group;
                groups[i] = group;
@@ -993,11 +1058,13 @@ public class GridLayout extends ViewGroup {
        }
        }


        private void computeGroupBounds() {
        private void computeGroupBounds() {
            for (int i = 0; i < groupBounds.values.length; i++) {
            Bounds[] values = groupBounds.values;
                groupBounds.values[i].reset();
            for (int i = 0; i < values.length; i++) {
                values[i].reset();
            }
            }
            for (int i = 0, N = getChildCount(); i < N; i++) {
            for (int i = 0, N = getChildCount(); i < N; i++) {
                View c = getChildAt(i);
                View c = getChildAt(i);
                if (isGone(c)) continue;
                LayoutParams lp = getLayoutParams(c);
                LayoutParams lp = getLayoutParams(c);
                Group g = horizontal ? lp.columnGroup : lp.rowGroup;
                Group g = horizontal ? lp.columnGroup : lp.rowGroup;


@@ -1159,11 +1226,13 @@ public class GridLayout extends ViewGroup {
        // todo unify with findUsed above. Both routines analyze which rows/columns are empty.
        // todo unify with findUsed above. Both routines analyze which rows/columns are empty.
        private Collection<Interval> getSpacers() {
        private Collection<Interval> getSpacers() {
            List<Interval> result = new ArrayList<Interval>();
            List<Interval> result = new ArrayList<Interval>();
            int N = getCount() + 1;
            int V = getCount() + 1;
            int[] leadingEdgeCount = new int[N];
            int[] leadingEdgeCount = new int[V];
            int[] trailingEdgeCount = new int[N];
            int[] trailingEdgeCount = new int[V];
            for (int i = 0, size = getChildCount(); i < size; i++) {
            for (int i = 0, N = getChildCount(); i < N; i++) {
                LayoutParams lp = getLayoutParams(getChildAt(i));
                View c = getChildAt(i);
                if (isGone(c)) continue;
                LayoutParams lp = getLayoutParams(c);
                Group g = horizontal ? lp.columnGroup : lp.rowGroup;
                Group g = horizontal ? lp.columnGroup : lp.rowGroup;
                Interval span = g.span;
                Interval span = g.span;
                leadingEdgeCount[span.min]++;
                leadingEdgeCount[span.min]++;
@@ -1174,9 +1243,9 @@ public class GridLayout extends ViewGroup {


            // treat the parent's edges like peer edges of the opposite type
            // treat the parent's edges like peer edges of the opposite type
            trailingEdgeCount[0] = 1;
            trailingEdgeCount[0] = 1;
            leadingEdgeCount[N - 1] = 1;
            leadingEdgeCount[V - 1] = 1;


            for (int i = 0; i < N; i++) {
            for (int i = 0; i < V; i++) {
                if (trailingEdgeCount[i] > 0) {
                if (trailingEdgeCount[i] > 0) {
                    lastTrailingEdge = i;
                    lastTrailingEdge = i;
                    continue; // if this is also a leading edge, don't add a space of length zero
                    continue; // if this is also a leading edge, don't add a space of length zero
@@ -1189,24 +1258,25 @@ public class GridLayout extends ViewGroup {
        }
        }


        private Arc[] createArcs() {
        private Arc[] createArcs() {
            List<Arc> spanToSize = new ArrayList<Arc>();
            List<Arc> result = new ArrayList<Arc>();


            // Add all the preferred elements that were not defined by the user.
            // Add all the preferred elements that were not defined by the user.
            PackedMap<Interval, MutableInt> spanSizes = getSpanSizes();
            PackedMap<Interval, MutableInt> spanSizes = getSpanSizes();
            for (int i = 0; i < spanSizes.keys.length; i++) {
            for (int i = 0; i < spanSizes.keys.length; i++) {
                Interval key = spanSizes.keys[i];
                Interval key = spanSizes.keys[i];
                if (key == Interval.GONE) continue;
                MutableInt value = spanSizes.values[i];
                MutableInt value = spanSizes.values[i];
                // todo remove value duplicate
                // todo remove value duplicate
                include2(spanToSize, key, value, value, accommodateBothMinAndMax);
                include2(result, key, value, value, accommodateBothMinAndMax);
            }
            }


            // Find redundant rows/cols and glue them together with 0-length arcs to link the tree
            // Find redundant rows/cols and glue them together with 0-length arcs to link the tree
            boolean[] used = findUsed(spanToSize);
            boolean[] used = findUsed(result);
            for (int i = 0; i < getCount(); i++) {
            for (int i = 0; i < getCount(); i++) {
                if (!used[i]) {
                if (!used[i]) {
                    Interval span = new Interval(i, i + 1);
                    Interval span = new Interval(i, i + 1);
                    include(spanToSize, span, new MutableInt(0));
                    include(result, span, new MutableInt(0));
                    include(spanToSize, span.inverse(), new MutableInt(0));
                    include(result, span.inverse(), new MutableInt(0));
                }
                }
            }
            }


@@ -1214,15 +1284,15 @@ public class GridLayout extends ViewGroup {
                // Add preferred gaps
                // Add preferred gaps
                for (int i = 0; i < getCount(); i++) {
                for (int i = 0; i < getCount(); i++) {
                    if (used[i]) {
                    if (used[i]) {
                        include2(spanToSize, new Interval(i, i + 1), 0, 0, false);
                        include2(result, new Interval(i, i + 1), 0, 0, false);
                    }
                    }
                }
                }
            } else {
            } else {
                for (Interval gap : getSpacers()) {
                for (Interval gap : getSpacers()) {
                    include2(spanToSize, gap, 0, 0, false);
                    include2(result, gap, 0, 0, false);
                }
                }
            }
            }
            Arc[] arcs = spanToSize.toArray(new Arc[spanToSize.size()]);
            Arc[] arcs = result.toArray(new Arc[result.size()]);
            return topologicalSort(arcs, 0);
            return topologicalSort(arcs, 0);
        }
        }


@@ -1310,8 +1380,9 @@ public class GridLayout extends ViewGroup {


        private void computeMargins(boolean leading) {
        private void computeMargins(boolean leading) {
            int[] margins = leading ? leadingMargins : trailingMargins;
            int[] margins = leading ? leadingMargins : trailingMargins;
            for (int i = 0, size = getChildCount(); i < size; i++) {
            for (int i = 0, N = getChildCount(); i < N; i++) {
                View c = getChildAt(i);
                View c = getChildAt(i);
                if (isGone(c)) continue;
                LayoutParams lp = getLayoutParams(c);
                LayoutParams lp = getLayoutParams(c);
                Group g = horizontal ? lp.columnGroup : lp.rowGroup;
                Group g = horizontal ? lp.columnGroup : lp.rowGroup;
                Interval span = g.span;
                Interval span = g.span;
@@ -1388,7 +1459,9 @@ public class GridLayout extends ViewGroup {


        private void computeWeights() {
        private void computeWeights() {
            for (int i = 0, N = getChildCount(); i < N; i++) {
            for (int i = 0, N = getChildCount(); i < N; i++) {
                LayoutParams lp = getLayoutParams(getChildAt(i));
                View c = getChildAt(i);
                if (isGone(c)) continue;
                LayoutParams lp = getLayoutParams(c);
                Group g = horizontal ? lp.columnGroup : lp.rowGroup;
                Group g = horizontal ? lp.columnGroup : lp.rowGroup;
                Interval span = g.span;
                Interval span = g.span;
                int penultimateIndex = span.max - 1;
                int penultimateIndex = span.max - 1;
@@ -1914,6 +1987,8 @@ public class GridLayout extends ViewGroup {
    of the values for each View.
    of the values for each View.
    */
    */
    private static class Bounds {
    private static class Bounds {
        private static final Bounds GONE = new Bounds();

        public int before;
        public int before;
        public int after;
        public int after;


@@ -1956,6 +2031,8 @@ public class GridLayout extends ViewGroup {
     * {@code x} such that {@code min <= x < max}.
     * {@code x} such that {@code min <= x < max}.
     */
     */
    /* package */ static class Interval {
    /* package */ static class Interval {
        private static final Interval GONE = new Interval(UNDEFINED, UNDEFINED);

        /**
        /**
         * The minimum value.
         * The minimum value.
         */
         */
@@ -2041,6 +2118,8 @@ public class GridLayout extends ViewGroup {
     * {@code span} and {@code alignment}.
     * {@code span} and {@code alignment}.
     */
     */
    public static class Group {
    public static class Group {
        private static final Group GONE = new Group(Interval.GONE, Alignment.GONE);

        /**
        /**
         * The grid indices of the leading and trailing edges of this cell group for the
         * The grid indices of the leading and trailing edges of this cell group for the
         * appropriate axis.
         * appropriate axis.
@@ -2167,6 +2246,13 @@ public class GridLayout extends ViewGroup {
     * #BASELINE} and {@link #FILL}.
     * #BASELINE} and {@link #FILL}.
     */
     */
    public static abstract class Alignment {
    public static abstract class Alignment {
        private static final Alignment GONE = new Alignment() {
            public int getAlignmentValue(View view, int viewSize, int measurementType) {
                assert false;
                return 0;
            }
        };

        /**
        /**
         * Returns an alignment value. In the case of vertical alignments the value
         * Returns an alignment value. In the case of vertical alignments the value
         * returned should indicate the distance from the top of the view to the
         * returned should indicate the distance from the top of the view to the
@@ -2269,7 +2355,6 @@ public class GridLayout extends ViewGroup {
                return baseline;
                return baseline;
            }
            }
        }
        }

    };
    };


    /**
    /**
+2 −15
Original line number Original line Diff line number Diff line
@@ -29,10 +29,7 @@




    <com.android.internal.widget.DigitalClock android:id="@+id/time"
    <com.android.internal.widget.DigitalClock android:id="@+id/time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="18dip"
        android:layout_marginBottom="18dip"
        android:layout_marginRight="-4dip"
        android:layout_gravity="right">
        android:layout_gravity="right">


        <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
        <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
@@ -63,8 +60,6 @@


    <LinearLayout
    <LinearLayout
        android:orientation="horizontal"
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right">
        android:layout_gravity="right">


        <TextView
        <TextView
@@ -90,8 +85,6 @@


    <TextView
    <TextView
        android:id="@+id/status1"
        android:id="@+id/status1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textSize="@*android:dimen/keyguard_pattern_unlock_status_line_font_size"
        android:textSize="@*android:dimen/keyguard_pattern_unlock_status_line_font_size"
        android:drawablePadding="4dip"
        android:drawablePadding="4dip"
@@ -100,8 +93,6 @@


    <TextView
    <TextView
        android:id="@+id/status2"
        android:id="@+id/status2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentTop="true"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textSize="@*android:dimen/keyguard_pattern_unlock_status_line_font_size"
        android:textSize="@*android:dimen/keyguard_pattern_unlock_status_line_font_size"
@@ -112,9 +103,8 @@


    <com.android.internal.widget.LockPatternView
    <com.android.internal.widget.LockPatternView
        android:id="@+id/lockPattern"
        android:id="@+id/lockPattern"
        android:layout_width="300dip"
        android:layout_width="match_parent"
        android:layout_height="300dip"
        android:layout_height="match_parent"
        android:layout_rowWeight="1"
        android:layout_marginTop="8dip"
        android:layout_marginTop="8dip"
        android:layout_marginRight="8dip"
        android:layout_marginRight="8dip"
        android:layout_marginBottom="4dip"
        android:layout_marginBottom="4dip"
@@ -123,8 +113,6 @@


    <TextView
    <TextView
        android:id="@+id/carrier"
        android:id="@+id/carrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_gravity="center_horizontal"
        android:singleLine="true"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:ellipsize="marquee"
@@ -136,7 +124,6 @@
    <LinearLayout
    <LinearLayout
        android:orientation="horizontal"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center">
        android:layout_gravity="center">


        <Button android:id="@+id/emergencyCallButton"
        <Button android:id="@+id/emergencyCallButton"