Skip to content

Commit a40627d

Browse files
author
Fabrice Di Meglio
committed
Enforce encapsulation for MarginLayoutParams startMargin and endMargin
Change-Id: Ibaf5ade22612dfa52173978e4b520a6407162d13
1 parent e11dc0d commit a40627d

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
@@ -25535,12 +25535,12 @@ package android.view {
2553525535
method protected boolean isLayoutRtl();
2553625536
method public boolean isMarginRelative();
2553725537
method public void setLayoutDirection(int);
25538+
method public void setMarginEnd(int);
25539+
method public void setMarginStart(int);
2553825540
method public void setMargins(int, int, int, int);
2553925541
field public int bottomMargin;
25540-
field public int endMargin;
2554125542
field public int leftMargin;
2554225543
field public int rightMargin;
25543-
field public int startMargin;
2554425544
field public int topMargin;
2554525545
}
2554625546

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)