am 09a5321c: Merge "Revert "Revert "This restores JB MR0 behavior where the framework throws an exception for improper layouts that are missing layout_width and/or layout_height.""" into jb-mr1-dev
* commit '09a5321c60c02d944684abb98e0daec9dd810fab': Revert "Revert "This restores JB MR0 behavior where the framework throws an exception for improper layouts that are missing layout_width and/or layout_height.""
This commit is contained in:
@@ -7094,7 +7094,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 deprecated int getLayoutDimension(int, java.lang.String);
|
method public 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();
|
||||||
@@ -16151,7 +16151,7 @@ package android.os {
|
|||||||
|
|
||||||
public class Looper {
|
public class Looper {
|
||||||
method public void dump(android.util.Printer, java.lang.String);
|
method public void dump(android.util.Printer, java.lang.String);
|
||||||
method public static android.os.Looper getMainLooper();
|
method public static synchronized android.os.Looper getMainLooper();
|
||||||
method public java.lang.Thread getThread();
|
method public java.lang.Thread getThread();
|
||||||
method public static void loop();
|
method public static void loop();
|
||||||
method public static android.os.Looper myLooper();
|
method public static android.os.Looper myLooper();
|
||||||
|
|||||||
@@ -475,14 +475,7 @@ 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;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ 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;
|
||||||
|
|
||||||
@@ -811,14 +810,21 @@ 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.
|
||||||
TypedArray ta = getContext().obtainStyledAttributes(attrs,
|
// During a layoutparams generation, a runtime exception is thrown
|
||||||
R.styleable.ViewGroup_Layout);
|
// if either layout_width or layout_height is missing. We catch
|
||||||
boolean definesBothWidthAndHeight =
|
// this exception and set localParams accordingly: true means we
|
||||||
ta.hasValue(R.styleable.ViewGroup_Layout_layout_width) &&
|
// successfully loaded layout params from the <include /> tag,
|
||||||
ta.hasValue(R.styleable.ViewGroup_Layout_layout_height);
|
// false means we need to rely on the included layout params.
|
||||||
AttributeSet attributes = definesBothWidthAndHeight ? attrs : childAttrs;
|
ViewGroup.LayoutParams params = null;
|
||||||
view.setLayoutParams(group.generateLayoutParams(attributes));
|
try {
|
||||||
ta.recycle();
|
params = group.generateLayoutParams(attrs);
|
||||||
|
} 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);
|
||||||
|
|||||||
@@ -5624,19 +5624,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the <code>width</code> and <code>height</code> layout parameters
|
* Extracts the layout parameters from the supplied attributes.
|
||||||
* 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, WRAP_CONTENT);
|
width = a.getLayoutDimension(widthAttr, "layout_width");
|
||||||
height = a.getLayoutDimension(heightAttr, WRAP_CONTENT);
|
height = a.getLayoutDimension(heightAttr, "layout_height");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -608,12 +608,6 @@ 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}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -297,6 +297,33 @@ public class RadioGroup extends LinearLayout {
|
|||||||
public LayoutParams(MarginLayoutParams source) {
|
public LayoutParams(MarginLayoutParams source) {
|
||||||
super(source);
|
super(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Fixes the child's width to
|
||||||
|
* {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} and the child's
|
||||||
|
* height to {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT}
|
||||||
|
* when not specified in the XML file.</p>
|
||||||
|
*
|
||||||
|
* @param a the styled attributes set
|
||||||
|
* @param widthAttr the width attribute to fetch
|
||||||
|
* @param heightAttr the height attribute to fetch
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void setBaseAttributes(TypedArray a,
|
||||||
|
int widthAttr, int heightAttr) {
|
||||||
|
|
||||||
|
if (a.hasValue(widthAttr)) {
|
||||||
|
width = a.getLayoutDimension(widthAttr, "layout_width");
|
||||||
|
} else {
|
||||||
|
width = WRAP_CONTENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a.hasValue(heightAttr)) {
|
||||||
|
height = a.getLayoutDimension(heightAttr, "layout_height");
|
||||||
|
} else {
|
||||||
|
height = WRAP_CONTENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -741,9 +741,14 @@ public class TableLayout extends LinearLayout {
|
|||||||
* @param heightAttr the height attribute to fetch
|
* @param heightAttr the height attribute to fetch
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) {
|
protected void setBaseAttributes(TypedArray a,
|
||||||
|
int widthAttr, int heightAttr) {
|
||||||
this.width = MATCH_PARENT;
|
this.width = MATCH_PARENT;
|
||||||
this.height = a.getLayoutDimension(heightAttr, WRAP_CONTENT);
|
if (a.hasValue(heightAttr)) {
|
||||||
|
this.height = a.getLayoutDimension(heightAttr, "layout_height");
|
||||||
|
} else {
|
||||||
|
this.height = WRAP_CONTENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -505,8 +505,19 @@ public class TableRow extends LinearLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) {
|
protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) {
|
||||||
width = a.getLayoutDimension(widthAttr, MATCH_PARENT);
|
// We don't want to force users to specify a layout_width
|
||||||
height = a.getLayoutDimension(heightAttr, WRAP_CONTENT);
|
if (a.hasValue(widthAttr)) {
|
||||||
|
width = a.getLayoutDimension(widthAttr, "layout_width");
|
||||||
|
} else {
|
||||||
|
width = MATCH_PARENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't want to force users to specify a layout_height
|
||||||
|
if (a.hasValue(heightAttr)) {
|
||||||
|
height = a.getLayoutDimension(heightAttr, "layout_height");
|
||||||
|
} else {
|
||||||
|
height = WRAP_CONTENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user