Skip to content

Commit b967464

Browse files
Fabrice Di MeglioAndroid (Google) Code Review
authored andcommitted
Merge "Enforce encapsulation for MarginLayoutParams startMargin and endMargin" into jb-mr1-dev
2 parents 4f8da32 + a40627d commit b967464

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

api/current.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25551,12 +25551,12 @@ package android.view {
2555125551
method protected boolean isLayoutRtl();
2555225552
method public boolean isMarginRelative();
2555325553
method public void setLayoutDirection(int);
25554+
method public void setMarginEnd(int);
25555+
method public void setMarginStart(int);
2555425556
method public void setMargins(int, int, int, int);
2555525557
field public int bottomMargin;
25556-
field public int endMargin;
2555725558
field public int leftMargin;
2555825559
field public int rightMargin;
25559-
field public int startMargin;
2556025560
field public int topMargin;
2556125561
}
2556225562

core/java/android/view/ViewGroup.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5568,15 +5568,15 @@ public static class MarginLayoutParams extends ViewGroup.LayoutParams {
55685568
* to this field.
55695569
*/
55705570
@ViewDebug.ExportedProperty(category = "layout")
5571-
public int startMargin = DEFAULT_RELATIVE;
5571+
private int startMargin = DEFAULT_RELATIVE;
55725572

55735573
/**
55745574
* The end margin in pixels of the child.
55755575
* Call {@link ViewGroup#setLayoutParams(LayoutParams)} after reassigning a new value
55765576
* to this field.
55775577
*/
55785578
@ViewDebug.ExportedProperty(category = "layout")
5579-
public int endMargin = DEFAULT_RELATIVE;
5579+
private int endMargin = DEFAULT_RELATIVE;
55805580

55815581
/**
55825582
* The default start and end margin.
@@ -5723,6 +5723,17 @@ public void setMarginsRelative(int start, int top, int end, int bottom) {
57235723
initialRightMargin = 0;
57245724
}
57255725

5726+
/**
5727+
* Sets the relative start margin.
5728+
*
5729+
* @param start the start marging size
5730+
*
5731+
* @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
5732+
*/
5733+
public void setMarginStart(int start) {
5734+
startMargin = start;
5735+
}
5736+
57265737
/**
57275738
* Returns the start margin in pixels.
57285739
*
@@ -5741,6 +5752,17 @@ public int getMarginStart() {
57415752
}
57425753
}
57435754

5755+
/**
5756+
* Sets the relative end margin.
5757+
*
5758+
* @param end the end marging size
5759+
*
5760+
* @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
5761+
*/
5762+
public void setMarginEnd(int end) {
5763+
endMargin = end;
5764+
}
5765+
57445766
/**
57455767
* Returns the end margin in pixels.
57465768
*

0 commit comments

Comments
 (0)