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

Commit 87706358 authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am ac7927a8: Merge "LayoutInflater should always try to generate LayoutParams...

am ac7927a8: Merge "LayoutInflater should always try to generate LayoutParams for include" into mnc-dev

* commit 'ac7927a8':
  LayoutInflater should always try to generate LayoutParams for include
parents c8b068ce ac7927a8
Loading
Loading
Loading
Loading
+12 −16
Original line number Diff line number Diff line
@@ -946,26 +946,22 @@ public abstract class LayoutInflater {
                                attrs, R.styleable.Include);
                        final int id = a.getResourceId(R.styleable.Include_id, View.NO_ID);
                        final int visibility = a.getInt(R.styleable.Include_visibility, -1);
                        final boolean hasWidth = a.hasValue(R.styleable.Include_layout_width);
                        final boolean hasHeight = a.hasValue(R.styleable.Include_layout_height);
                        a.recycle();

                        // 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
                        // included XML file.
                        // During a layoutparams generation, a runtime exception is thrown
                        // if either layout_width or layout_height is missing. We catch
                        // this exception and set localParams accordingly: true means we
                        // successfully loaded layout params from the <include /> tag,
                        // false means we need to rely on the included layout params.
                        // We try to load the layout params set in the <include /> tag.
                        // If the parent can't generate layout params (ex. missing width
                        // or height for the framework ViewGroups, though this is not
                        // necessarily true of all ViewGroups) then we expect it to throw
                        // a runtime exception.
                        // We catch this exception and set localParams accordingly: true
                        // means we successfully loaded layout params from the <include>
                        // tag, false means we need to rely on the included layout params.
                        ViewGroup.LayoutParams params = null;
                        if (hasWidth && hasHeight) {
                        try {
                            params = group.generateLayoutParams(attrs);
                        } catch (RuntimeException e) {
                            // Ignore, just fail over to child attrs.
                        }
                        }
                        if (params == null) {
                            params = group.generateLayoutParams(childAttrs);
                        }
+2 −3
Original line number Diff line number Diff line
@@ -2725,12 +2725,11 @@
        <attr name="value" />
    </declare-styleable>

    <!-- Attributes that can be assigned to an &lt;include&gt; tag. -->
    <!-- Attributes that can be assigned to an &lt;include&gt; tag.
         @hide -->
    <declare-styleable name="Include">
        <attr name="id" />
        <attr name="visibility" />
        <attr name="layout_width" />
        <attr name="layout_height" />
    </declare-styleable>

    <!-- Attributes that can be used with a {@link android.view.ViewGroup} or any