diff options
| -rw-r--r-- | api/current.txt | 8 | ||||
| -rw-r--r-- | api/system-current.txt | 8 | ||||
| -rw-r--r-- | api/test-current.txt | 8 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 23 | ||||
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 66 | ||||
| -rw-r--r-- | core/res/res/values/attrs.xml | 47 | ||||
| -rw-r--r-- | core/res/res/values/public.xml | 21 |
7 files changed, 142 insertions, 39 deletions
diff --git a/api/current.txt b/api/current.txt index 8e73b898d423..b70d5150b29b 100644 --- a/api/current.txt +++ b/api/current.txt @@ -793,10 +793,12 @@ package android { field public static final int layout_margin = 16842998; // 0x10100f6 field public static final int layout_marginBottom = 16843002; // 0x10100fa field public static final int layout_marginEnd = 16843702; // 0x10103b6 + field public static final int layout_marginHorizontal = 16844091; // 0x101053b field public static final int layout_marginLeft = 16842999; // 0x10100f7 field public static final int layout_marginRight = 16843001; // 0x10100f9 field public static final int layout_marginStart = 16843701; // 0x10103b5 field public static final int layout_marginTop = 16843000; // 0x10100f8 + field public static final int layout_marginVertical = 16844092; // 0x101053c field public static final int layout_row = 16843643; // 0x101037b field public static final int layout_rowSpan = 16843644; // 0x101037c field public static final int layout_rowWeight = 16843864; // 0x1010458 @@ -864,7 +866,7 @@ package android { field public static final int mediaRouteTypes = 16843694; // 0x10103ae field public static final int menuCategory = 16843230; // 0x10101de field public static final int mimeType = 16842790; // 0x1010026 - field public static final int min = 16843367; // 0x1010267 + field public static final int min = 16844089; // 0x1010539 field public static final int minDate = 16843583; // 0x101033f field public static final int minEms = 16843098; // 0x101015a field public static final int minHeight = 16843072; // 0x1010140 @@ -927,11 +929,13 @@ package android { field public static final int padding = 16842965; // 0x10100d5 field public static final int paddingBottom = 16842969; // 0x10100d9 field public static final int paddingEnd = 16843700; // 0x10103b4 + field public static final int paddingHorizontal = 16844093; // 0x101053d field public static final int paddingLeft = 16842966; // 0x10100d6 field public static final int paddingMode = 16843863; // 0x1010457 field public static final int paddingRight = 16842968; // 0x10100d8 field public static final int paddingStart = 16843699; // 0x10103b3 field public static final int paddingTop = 16842967; // 0x10100d7 + field public static final int paddingVertical = 16844094; // 0x101053e field public static final int panelBackground = 16842846; // 0x101005e field public static final int panelColorBackground = 16842849; // 0x1010061 field public static final int panelColorForeground = 16842848; // 0x1010060 @@ -1050,7 +1054,7 @@ package android { field public static final int ringtonePreferenceStyle = 16842899; // 0x1010093 field public static final int ringtoneType = 16843257; // 0x10101f9 field public static final int rotation = 16843558; // 0x1010326 - field public static final int rotationAnimation = 16843688; // 0x10103a8 + field public static final int rotationAnimation = 16844090; // 0x101053a field public static final int rotationX = 16843559; // 0x1010327 field public static final int rotationY = 16843560; // 0x1010328 field public static final int roundIcon = 16844076; // 0x101052c diff --git a/api/system-current.txt b/api/system-current.txt index d5ff780d4651..1dd32ce5ea69 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -900,10 +900,12 @@ package android { field public static final int layout_margin = 16842998; // 0x10100f6 field public static final int layout_marginBottom = 16843002; // 0x10100fa field public static final int layout_marginEnd = 16843702; // 0x10103b6 + field public static final int layout_marginHorizontal = 16844091; // 0x101053b field public static final int layout_marginLeft = 16842999; // 0x10100f7 field public static final int layout_marginRight = 16843001; // 0x10100f9 field public static final int layout_marginStart = 16843701; // 0x10103b5 field public static final int layout_marginTop = 16843000; // 0x10100f8 + field public static final int layout_marginVertical = 16844092; // 0x101053c field public static final int layout_row = 16843643; // 0x101037b field public static final int layout_rowSpan = 16843644; // 0x101037c field public static final int layout_rowWeight = 16843864; // 0x1010458 @@ -971,7 +973,7 @@ package android { field public static final int mediaRouteTypes = 16843694; // 0x10103ae field public static final int menuCategory = 16843230; // 0x10101de field public static final int mimeType = 16842790; // 0x1010026 - field public static final int min = 16843367; // 0x1010267 + field public static final int min = 16844089; // 0x1010539 field public static final int minDate = 16843583; // 0x101033f field public static final int minEms = 16843098; // 0x101015a field public static final int minHeight = 16843072; // 0x1010140 @@ -1034,11 +1036,13 @@ package android { field public static final int padding = 16842965; // 0x10100d5 field public static final int paddingBottom = 16842969; // 0x10100d9 field public static final int paddingEnd = 16843700; // 0x10103b4 + field public static final int paddingHorizontal = 16844093; // 0x101053d field public static final int paddingLeft = 16842966; // 0x10100d6 field public static final int paddingMode = 16843863; // 0x1010457 field public static final int paddingRight = 16842968; // 0x10100d8 field public static final int paddingStart = 16843699; // 0x10103b3 field public static final int paddingTop = 16842967; // 0x10100d7 + field public static final int paddingVertical = 16844094; // 0x101053e field public static final int panelBackground = 16842846; // 0x101005e field public static final int panelColorBackground = 16842849; // 0x1010061 field public static final int panelColorForeground = 16842848; // 0x1010060 @@ -1157,7 +1161,7 @@ package android { field public static final int ringtonePreferenceStyle = 16842899; // 0x1010093 field public static final int ringtoneType = 16843257; // 0x10101f9 field public static final int rotation = 16843558; // 0x1010326 - field public static final int rotationAnimation = 16843688; // 0x10103a8 + field public static final int rotationAnimation = 16844090; // 0x101053a field public static final int rotationX = 16843559; // 0x1010327 field public static final int rotationY = 16843560; // 0x1010328 field public static final int roundIcon = 16844076; // 0x101052c diff --git a/api/test-current.txt b/api/test-current.txt index 4636bb393197..7784eb605a42 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -793,10 +793,12 @@ package android { field public static final int layout_margin = 16842998; // 0x10100f6 field public static final int layout_marginBottom = 16843002; // 0x10100fa field public static final int layout_marginEnd = 16843702; // 0x10103b6 + field public static final int layout_marginHorizontal = 16844091; // 0x101053b field public static final int layout_marginLeft = 16842999; // 0x10100f7 field public static final int layout_marginRight = 16843001; // 0x10100f9 field public static final int layout_marginStart = 16843701; // 0x10103b5 field public static final int layout_marginTop = 16843000; // 0x10100f8 + field public static final int layout_marginVertical = 16844092; // 0x101053c field public static final int layout_row = 16843643; // 0x101037b field public static final int layout_rowSpan = 16843644; // 0x101037c field public static final int layout_rowWeight = 16843864; // 0x1010458 @@ -864,7 +866,7 @@ package android { field public static final int mediaRouteTypes = 16843694; // 0x10103ae field public static final int menuCategory = 16843230; // 0x10101de field public static final int mimeType = 16842790; // 0x1010026 - field public static final int min = 16843367; // 0x1010267 + field public static final int min = 16844089; // 0x1010539 field public static final int minDate = 16843583; // 0x101033f field public static final int minEms = 16843098; // 0x101015a field public static final int minHeight = 16843072; // 0x1010140 @@ -927,11 +929,13 @@ package android { field public static final int padding = 16842965; // 0x10100d5 field public static final int paddingBottom = 16842969; // 0x10100d9 field public static final int paddingEnd = 16843700; // 0x10103b4 + field public static final int paddingHorizontal = 16844093; // 0x101053d field public static final int paddingLeft = 16842966; // 0x10100d6 field public static final int paddingMode = 16843863; // 0x1010457 field public static final int paddingRight = 16842968; // 0x10100d8 field public static final int paddingStart = 16843699; // 0x10103b3 field public static final int paddingTop = 16842967; // 0x10100d7 + field public static final int paddingVertical = 16844094; // 0x101053e field public static final int panelBackground = 16842846; // 0x101005e field public static final int panelColorBackground = 16842849; // 0x1010061 field public static final int panelColorForeground = 16842848; // 0x1010060 @@ -1050,7 +1054,7 @@ package android { field public static final int ringtonePreferenceStyle = 16842899; // 0x1010093 field public static final int ringtoneType = 16843257; // 0x10101f9 field public static final int rotation = 16843558; // 0x1010326 - field public static final int rotationAnimation = 16843688; // 0x10103a8 + field public static final int rotationAnimation = 16844090; // 0x101053a field public static final int rotationX = 16843559; // 0x1010327 field public static final int rotationY = 16843560; // 0x1010328 field public static final int roundIcon = 16844076; // 0x101052c diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 84d7548363d1..f9a03c09d6bc 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -4194,6 +4194,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, int endPadding = UNDEFINED_PADDING; int padding = -1; + int paddingHorizontal = -1; + int paddingVertical = -1; int viewFlagValues = 0; int viewFlagMasks = 0; @@ -4240,6 +4242,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, leftPaddingDefined = true; rightPaddingDefined = true; break; + case com.android.internal.R.styleable.View_paddingHorizontal: + paddingHorizontal = a.getDimensionPixelSize(attr, -1); + mUserPaddingLeftInitial = paddingHorizontal; + mUserPaddingRightInitial = paddingHorizontal; + leftPaddingDefined = true; + rightPaddingDefined = true; + break; + case com.android.internal.R.styleable.View_paddingVertical: + paddingVertical = a.getDimensionPixelSize(attr, -1); + break; case com.android.internal.R.styleable.View_paddingLeft: leftPadding = a.getDimensionPixelSize(attr, -1); mUserPaddingLeftInitial = leftPadding; @@ -4647,6 +4659,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback, bottomPadding = padding; mUserPaddingLeftInitial = padding; mUserPaddingRightInitial = padding; + } else { + if (paddingHorizontal >= 0) { + leftPadding = paddingHorizontal; + rightPadding = paddingHorizontal; + mUserPaddingLeftInitial = paddingHorizontal; + mUserPaddingRightInitial = paddingHorizontal; + } + if (paddingVertical >= 0) { + topPadding = paddingVertical; + bottomPadding = paddingVertical; + } } if (isRtlCompatibilityMode()) { diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index c0191ce0b791..0f8200d794ff 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -7357,34 +7357,48 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager rightMargin= margin; bottomMargin = margin; } else { - leftMargin = a.getDimensionPixelSize( - R.styleable.ViewGroup_MarginLayout_layout_marginLeft, - UNDEFINED_MARGIN); - if (leftMargin == UNDEFINED_MARGIN) { - mMarginFlags |= LEFT_MARGIN_UNDEFINED_MASK; - leftMargin = DEFAULT_MARGIN_RESOLVED; - } - rightMargin = a.getDimensionPixelSize( - R.styleable.ViewGroup_MarginLayout_layout_marginRight, - UNDEFINED_MARGIN); - if (rightMargin == UNDEFINED_MARGIN) { - mMarginFlags |= RIGHT_MARGIN_UNDEFINED_MASK; - rightMargin = DEFAULT_MARGIN_RESOLVED; + int horizontalMargin = a.getDimensionPixelSize( + R.styleable.ViewGroup_MarginLayout_layout_marginHorizontal, -1); + int verticalMargin = a.getDimensionPixelSize( + R.styleable.ViewGroup_MarginLayout_layout_marginVertical, -1); + + if (horizontalMargin >= 0) { + leftMargin = horizontalMargin; + rightMargin = horizontalMargin; + } else { + leftMargin = a.getDimensionPixelSize( + R.styleable.ViewGroup_MarginLayout_layout_marginLeft, + UNDEFINED_MARGIN); + if (leftMargin == UNDEFINED_MARGIN) { + mMarginFlags |= LEFT_MARGIN_UNDEFINED_MASK; + leftMargin = DEFAULT_MARGIN_RESOLVED; + } + rightMargin = a.getDimensionPixelSize( + R.styleable.ViewGroup_MarginLayout_layout_marginRight, + UNDEFINED_MARGIN); + if (rightMargin == UNDEFINED_MARGIN) { + mMarginFlags |= RIGHT_MARGIN_UNDEFINED_MASK; + rightMargin = DEFAULT_MARGIN_RESOLVED; + } + startMargin = a.getDimensionPixelSize( + R.styleable.ViewGroup_MarginLayout_layout_marginStart, + DEFAULT_MARGIN_RELATIVE); + endMargin = a.getDimensionPixelSize( + R.styleable.ViewGroup_MarginLayout_layout_marginEnd, + DEFAULT_MARGIN_RELATIVE); } - topMargin = a.getDimensionPixelSize( - R.styleable.ViewGroup_MarginLayout_layout_marginTop, - DEFAULT_MARGIN_RESOLVED); - bottomMargin = a.getDimensionPixelSize( - R.styleable.ViewGroup_MarginLayout_layout_marginBottom, - DEFAULT_MARGIN_RESOLVED); - - startMargin = a.getDimensionPixelSize( - R.styleable.ViewGroup_MarginLayout_layout_marginStart, - DEFAULT_MARGIN_RELATIVE); - endMargin = a.getDimensionPixelSize( - R.styleable.ViewGroup_MarginLayout_layout_marginEnd, - DEFAULT_MARGIN_RELATIVE); + if (verticalMargin >= 0) { + topMargin = verticalMargin; + bottomMargin = verticalMargin; + } else { + topMargin = a.getDimensionPixelSize( + R.styleable.ViewGroup_MarginLayout_layout_marginTop, + DEFAULT_MARGIN_RESOLVED); + bottomMargin = a.getDimensionPixelSize( + R.styleable.ViewGroup_MarginLayout_layout_marginBottom, + DEFAULT_MARGIN_RESOLVED); + } if (isMarginRelative()) { mMarginFlags |= NEED_RESOLUTION_MASK; diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 95f372c43a59..7045eafabbd5 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2239,13 +2239,23 @@ (black). --> <attr name="background" format="reference|color" /> - <!-- Sets the padding, in pixels, of all four edges. Padding is defined as - space between the edges of the view and the view's content. A views size - will include it's padding. If a {@link android.R.attr#background} + <!-- Sets the padding, in pixels, of all four edges. Padding is defined as + space between the edges of the view and the view's content. This value will take + precedence over any of the edge-specific values, including + paddingHorizontal and paddingVertical, if set. A view's size + will include its padding. If a {@link android.R.attr#background} is provided, the padding will initially be set to that (0 if the - drawable does not have padding). Explicitly setting a padding value + drawable does not have padding). Explicitly setting a padding value will override the corresponding padding found in the background. --> <attr name="padding" format="dimension" /> + <!-- Sets the padding, in pixels, of the left and right edges; see + {@link android.R.attr#padding}. This value will take precedence over + paddingLeft, paddingRight, paddingStart, and paddingEnd, if set. --> + <attr name="paddingHorizontal" format="dimension" /> + <!-- Sets the padding, in pixels, of the top and bottom edges; see + {@link android.R.attr#padding}. This value will take precedence over + paddingTop and paddingBottom, if set. --> + <attr name="paddingVertical" format="dimension" /> <!-- Sets the padding, in pixels, of the left edge; see {@link android.R.attr#padding}. --> <attr name="paddingLeft" format="dimension" /> <!-- Sets the padding, in pixels, of the top edge; see {@link android.R.attr#padding}. --> @@ -3059,7 +3069,11 @@ <attr name="layout_width" /> <attr name="layout_height" /> <!-- Specifies extra space on the left, top, right and bottom - sides of this view. This space is outside this view's bounds. + sides of this view. If both layout_margin and any of layout_marginLeft, + layout_marginRight, layout_marginStart, layout_marginEnd, + layout_marginTop, and layout_marginBottom are + also specified, the layout_margin value will take precedence over the + edge-specific values. This space is outside this view's bounds. Margin values should be positive. --> <attr name="layout_margin" format="dimension" /> <!-- Specifies extra space on the left side of this view. @@ -3086,6 +3100,29 @@ This space is outside this view's bounds. Margin values should be positive.--> <attr name="layout_marginEnd" format="dimension" /> + <!-- Specifies extra space on the left and right sides of this view. + Specifying layout_marginHorizontal is equivalent to specifying + either layout_marginLeft and layout_marginRight or + layout_marginStart and layout_marginEnd with that same value. + If both layout_marginHorizontal and any of layout_marginLeft, + layout_marginRight, layout_marginStart, and layout_marginEnd are + also specified, the layout_marginHorizontal value will take precedence over the + edge-specific values. Also, layout_margin will always take precendent over + any of these values, including layout_marginHorizontal. + This space is outside this view's bounds. + Margin values should be positive.--> + <attr name="layout_marginHorizontal" format="dimension" /> + <!-- Specifies extra space on the tyop and bottom sides of this view. + Specifying layout_marginVertical is equivalent to specifying + layout_marginTop and layout_marginBottom with that same value. + If both layout_marginVertical and either/both layout_marginTop and + layout_marginBottom are also specified, the layout_marginVertical value + will take precedence over the edge-specific values. + Also, layout_margin will always take precendent over + any of these values, including layout_marginHorizontal. + This space is outside this view's bounds. + Margin values should be positive.--> + <attr name="layout_marginVertical" format="dimension" /> </declare-styleable> <!-- Use <code>input-method</code> as the root tag of the XML resource that diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 200961f1c8a8..deeaf3509c16 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2752,6 +2752,11 @@ <public name="exampleAttr1" /> <public name="exampleAttr2" /> </public-group> + + To add a new public-group block, choose an id value that is 1 greater + than the last of that item above. For example, the last "attr" id + value above is 0x01010530, so the public-group of attrs below has + the id value of 0x01010531. =============================================================== --> <eat-comment /> @@ -2764,6 +2769,12 @@ <public name="autoSizeStepGranularity" /> <public name="autoSizeStepSizeSet" /> <public name="autoSizeMinTextSize" /> + <public name="min" /> + <public name="rotationAnimation" /> + <public name="layout_marginHorizontal" /> + <public name="layout_marginVertical" /> + <public name="paddingHorizontal" /> + <public name="paddingVertical" /> </public-group> <public-group type="style" first-id="0x010302e0"> @@ -2772,6 +2783,12 @@ <public-group type="id" first-id="0x01020041"> </public-group> - <public type="attr" name="min" /> - <public type="attr" name="rotationAnimation" /> + <!-- =============================================================== + DO NOT ADD UN-GROUPED ITEMS HERE + + Any new items (attrs, styles, ids, etc.) *must* be added in a + public-group block, as the preceding comment explains. + Items added outside of a group may have their value recalculated + every time something new is added to this file. + =============================================================== --> </resources> |