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

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

Merge "Fix for bug 6050753."

parents b84814b2 c29f0315
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -6949,7 +6949,7 @@ package android.content.res {
    method public int getIndexCount();
    method public int getIndexCount();
    method public int getInt(int, int);
    method public int getInt(int, int);
    method public int getInteger(int, int);
    method public int getInteger(int, int);
    method public int getLayoutDimension(int, java.lang.String);
    method public deprecated int getLayoutDimension(int, java.lang.String);
    method public int getLayoutDimension(int, int);
    method public int getLayoutDimension(int, int);
    method public java.lang.String getNonResourceString(int);
    method public java.lang.String getNonResourceString(int);
    method public java.lang.String getPositionDescription();
    method public java.lang.String getPositionDescription();
+8 −1
Original line number Original line Diff line number Diff line
@@ -475,7 +475,14 @@ public class TypedArray {
     * 
     * 
     * @return Attribute dimension value multiplied by the appropriate 
     * @return Attribute dimension value multiplied by the appropriate 
     * metric and truncated to integer pixels.
     * metric and truncated to integer pixels.
     *
     * @throws RuntimeException
     *             if this TypedArray does not contain an entry for <code>index</code>
     *
     * @deprecated Use {@link #getLayoutDimension(int, int)} instead.
     *
     */
     */
    @Deprecated
    public int getLayoutDimension(int index, String name) {
    public int getLayoutDimension(int index, String name) {
        index *= AssetManager.STYLE_NUM_ENTRIES;
        index *= AssetManager.STYLE_NUM_ENTRIES;
        final int[] data = mData;
        final int[] data = mData;
+47 −53
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import android.graphics.Canvas;
import android.os.Handler;
import android.os.Handler;
import android.os.Message;
import android.os.Message;
import android.widget.FrameLayout;
import android.widget.FrameLayout;
import com.android.internal.R;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserException;


@@ -810,21 +811,14 @@ public abstract class LayoutInflater {
                        // We try to load the layout params set in the <include /> tag. If
                        // We try to load the layout params set in the <include /> tag. If
                        // they don't exist, we will rely on the layout params set in the
                        // they don't exist, we will rely on the layout params set in the
                        // included XML file.
                        // included XML file.
                        // During a layoutparams generation, a runtime exception is thrown
                        TypedArray ta = getContext().obtainStyledAttributes(attrs,
                        // if either layout_width or layout_height is missing. We catch
                                                            R.styleable.ViewGroup_Layout);
                        // this exception and set localParams accordingly: true means we
                        boolean definesBothWidthAndHeight =
                        // successfully loaded layout params from the <include /> tag,
                                ta.hasValue(R.styleable.ViewGroup_Layout_layout_width) &&
                        // false means we need to rely on the included layout params.
                                ta.hasValue(R.styleable.ViewGroup_Layout_layout_height);
                        ViewGroup.LayoutParams params = null;
                        AttributeSet attributes = definesBothWidthAndHeight ? attrs : childAttrs;
                        try {
                        view.setLayoutParams(group.generateLayoutParams(attributes));
                            params = group.generateLayoutParams(attrs);
                        ta.recycle();
                        } catch (RuntimeException e) {
                            params = group.generateLayoutParams(childAttrs);
                        } finally {
                            if (params != null) {
                                view.setLayoutParams(params);
                            }
                        }


                        // Inflate all children.
                        // Inflate all children.
                        rInflate(childParser, view, childAttrs, true);
                        rInflate(childParser, view, childAttrs, true);
+7 −3
Original line number Original line Diff line number Diff line
@@ -5436,15 +5436,19 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        }
        }


        /**
        /**
         * Extracts the layout parameters from the supplied attributes.
         * Extracts the <code>width</code> and <code>height</code> layout parameters
         * from the supplied TypedArray, <code>a</code>, and assigns them
         * to the appropriate fields. If, <code>a</code>, does not contain an
         * entry for either attribute, the value, {@link ViewGroup.LayoutParams#WRAP_CONTENT},
         * is used as a default.
         *
         *
         * @param a the style attributes to extract the parameters from
         * @param a the style attributes to extract the parameters from
         * @param widthAttr the identifier of the width attribute
         * @param widthAttr the identifier of the width attribute
         * @param heightAttr the identifier of the height attribute
         * @param heightAttr the identifier of the height attribute
         */
         */
        protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) {
        protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) {
            width = a.getLayoutDimension(widthAttr, "layout_width");
            width = a.getLayoutDimension(widthAttr, WRAP_CONTENT);
            height = a.getLayoutDimension(heightAttr, "layout_height");
            height = a.getLayoutDimension(heightAttr, WRAP_CONTENT);
        }
        }


        /**
        /**
+6 −0
Original line number Original line Diff line number Diff line
@@ -603,6 +603,12 @@ public class FrameLayout extends ViewGroup {
         */
         */
        public int gravity = -1;
        public int gravity = -1;


        @Override
        protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) {
            width = a.getLayoutDimension(widthAttr, MATCH_PARENT);
            height = a.getLayoutDimension(heightAttr, MATCH_PARENT);
        }

        /**
        /**
         * {@inheritDoc}
         * {@inheritDoc}
         */
         */
Loading