Merge "Add @InspectableProperty annotations to LayoutParams"

This commit is contained in:
Ashley Rose
2019-03-06 18:38:18 +00:00
committed by Android (Google) Code Review
8 changed files with 34 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ import android.view.ViewDebug;
import android.view.ViewGroup;
import android.view.ViewHierarchyEncoder;
import android.view.Window;
import android.view.inspector.InspectableProperty;
import android.widget.SpinnerAdapter;
import java.lang.annotation.Retention;
@@ -1374,6 +1375,9 @@ public abstract class ActionBar {
@ViewDebug.IntToString(from = Gravity.CENTER, to = "CENTER"),
@ViewDebug.IntToString(from = Gravity.FILL, to = "FILL")
})
@InspectableProperty(
name = "layout_gravity",
valueType = InspectableProperty.ValueType.GRAVITY)
public int gravity = Gravity.NO_GRAVITY;
public LayoutParams(@NonNull Context c, AttributeSet attrs) {

View File

@@ -7845,6 +7845,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
@ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),
@ViewDebug.IntToString(from = WRAP_CONTENT, to = "WRAP_CONTENT")
})
@InspectableProperty(name = "layout_width", enumMapping = {
@InspectableProperty.EnumMap(name = "match_parent", value = MATCH_PARENT),
@InspectableProperty.EnumMap(name = "wrap_content", value = WRAP_CONTENT)
})
public int width;
/**
@@ -7856,6 +7860,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
@ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),
@ViewDebug.IntToString(from = WRAP_CONTENT, to = "WRAP_CONTENT")
})
@InspectableProperty(name = "layout_height", enumMapping = {
@InspectableProperty.EnumMap(name = "match_parent", value = MATCH_PARENT),
@InspectableProperty.EnumMap(name = "wrap_content", value = WRAP_CONTENT)
})
public int height;
/**
@@ -8028,6 +8036,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* to this field.
*/
@ViewDebug.ExportedProperty(category = "layout")
@InspectableProperty(name = "layout_marginLeft")
public int leftMargin;
/**
@@ -8036,6 +8045,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* to this field.
*/
@ViewDebug.ExportedProperty(category = "layout")
@InspectableProperty(name = "layout_marginTop")
public int topMargin;
/**
@@ -8044,6 +8054,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* to this field.
*/
@ViewDebug.ExportedProperty(category = "layout")
@InspectableProperty(name = "layout_marginRight")
public int rightMargin;
/**
@@ -8052,6 +8063,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* to this field.
*/
@ViewDebug.ExportedProperty(category = "layout")
@InspectableProperty(name = "layout_marginBottom")
public int bottomMargin;
/**

View File

@@ -21,6 +21,7 @@ import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.inspector.InspectableProperty;
import android.widget.RemoteViews.RemoteView;
@@ -159,10 +160,12 @@ public class AbsoluteLayout extends ViewGroup {
/**
* The horizontal, or X, location of the child within the view group.
*/
@InspectableProperty(name = "layout_x")
public int x;
/**
* The vertical, or Y, location of the child within the view group.
*/
@InspectableProperty(name = "layout_y")
public int y;
/**

View File

@@ -443,6 +443,9 @@ public class FrameLayout extends ViewGroup {
* @see android.view.Gravity
* @attr ref android.R.styleable#FrameLayout_Layout_layout_gravity
*/
@InspectableProperty(
name = "layout_gravity",
valueType = InspectableProperty.ValueType.GRAVITY)
public int gravity = UNSPECIFIED_GRAVITY;
public LayoutParams(@NonNull Context c, @Nullable AttributeSet attrs) {

View File

@@ -1987,6 +1987,7 @@ public class LinearLayout extends ViewGroup {
* will be pro-rated among all views whose weight is greater than 0.
*/
@ViewDebug.ExportedProperty(category = "layout")
@InspectableProperty(name = "layout_weight")
public float weight;
/**
@@ -2010,6 +2011,9 @@ public class LinearLayout extends ViewGroup {
@ViewDebug.IntToString(from = Gravity.CENTER, to = "CENTER"),
@ViewDebug.IntToString(from = Gravity.FILL, to = "FILL")
})
@InspectableProperty(
name = "layout_gravity",
valueType = InspectableProperty.ValueType.GRAVITY)
public int gravity = -1;
/**

View File

@@ -1286,6 +1286,7 @@ public class RelativeLayout extends ViewGroup {
* the anchor's visibility is GONE.
*/
@ViewDebug.ExportedProperty(category = "layout")
@InspectableProperty(name = "layout_alignWithParentIfMissing")
public boolean alignWithParent;
public LayoutParams(Context c, AttributeSet attrs) {

View File

@@ -26,6 +26,7 @@ import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
import android.view.ViewHierarchyEncoder;
import android.view.inspector.InspectableProperty;
/**
* <p>A layout that arranges its children horizontally. A TableRow should
@@ -398,12 +399,14 @@ public class TableRow extends LinearLayout {
* <p>The column index of the cell represented by the widget.</p>
*/
@ViewDebug.ExportedProperty(category = "layout")
@InspectableProperty(name = "layout_column")
public int column;
/**
* <p>The number of columns the widgets spans over.</p>
*/
@ViewDebug.ExportedProperty(category = "layout")
@InspectableProperty(name = "layout_span")
public int span;
private static final int LOCATION = 0;

View File

@@ -46,6 +46,7 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import android.view.animation.Interpolator;
import android.view.inspector.InspectableProperty;
import android.widget.EdgeEffect;
import android.widget.Scroller;
@@ -2779,6 +2780,9 @@ public class ViewPager extends ViewGroup {
* Where to position the view page within the overall ViewPager
* container; constants are defined in {@link android.view.Gravity}.
*/
@InspectableProperty(
name = "layout_gravity",
valueType = InspectableProperty.ValueType.GRAVITY)
public int gravity;
/**