Skip to content

Commit

Permalink
make the padding parameter order the same as in the Android Framework (
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin authored and elihart committed Oct 18, 2018
1 parent ba610e5 commit 7f81c8b
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions epoxy-adapter/src/main/java/com/airbnb/epoxy/Carousel.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ public void setPadding(@Nullable Padding padding) {
* @see #setPadding(Padding)
*/
public static class Padding {
public final int top;
public final int bottom;
public final int left;
public final int top;
public final int right;
public final int bottom;
public final int itemSpacing;
public final PaddingType paddingType;

Expand All @@ -357,21 +357,21 @@ public static Padding resource(@DimenRes int paddingRes, @DimenRes int itemSpaci
}

/**
* @param topRes Top padding as dimension resource.
* @param bottomRes Bottom padding as dimension resource.
* @param leftRes Left padding as dimension resource.
* @param topRes Top padding as dimension resource.
* @param rightRes Right padding as dimension resource.
* @param bottomRes Bottom padding as dimension resource.
* @param itemSpacingRes Space as dimension resource to add between each carousel item. Will be
* implemented via an item decoration.
*/
public static Padding resource(
@DimenRes int topRes,
@DimenRes int bottomRes,
@DimenRes int leftRes,
@DimenRes int topRes,
@DimenRes int rightRes,
@DimenRes int bottomRes,
@DimenRes int itemSpacingRes) {
return new Padding(
topRes, bottomRes, leftRes, rightRes, itemSpacingRes, PaddingType.RESOURCE);
leftRes, topRes, rightRes, bottomRes, itemSpacingRes, PaddingType.RESOURCE);
}

/**
Expand All @@ -386,20 +386,20 @@ public static Padding dp(
}

/**
* @param topDp Top padding in dp.
* @param bottomDp Bottom padding in dp.
* @param leftDp Left padding in dp.
* @param topDp Top padding in dp.
* @param rightDp Right padding in dp.
* @param bottomDp Bottom padding in dp.
* @param itemSpacingDp Space in dp to add between each carousel item. Will be implemented via
* an item decoration.
*/
public static Padding dp(
@Dimension(unit = Dimension.DP) int topDp,
@Dimension(unit = Dimension.DP) int bottomDp,
@Dimension(unit = Dimension.DP) int leftDp,
@Dimension(unit = Dimension.DP) int topDp,
@Dimension(unit = Dimension.DP) int rightDp,
@Dimension(unit = Dimension.DP) int bottomDp,
@Dimension(unit = Dimension.DP) int itemSpacingDp) {
return new Padding(topDp, bottomDp, leftDp, rightDp, itemSpacingDp, PaddingType.DP);
return new Padding(leftDp, topDp, rightDp, bottomDp, itemSpacingDp, PaddingType.DP);
}

/**
Expand All @@ -412,34 +412,34 @@ public Padding(@Px int paddingPx, @Px int itemSpacingPx) {
}

/**
* @param topPx Top padding in pixels.
* @param bottomPx Bottom padding in pixels.
* @param leftPx Left padding in pixels.
* @param topPx Top padding in pixels.
* @param rightPx Right padding in pixels.
* @param bottomPx Bottom padding in pixels.
* @param itemSpacingPx Space in pixels to add between each carousel item. Will be implemented
* via an item decoration.
*/
public Padding(
@Px int topPx, @Px int bottomPx, @Px int leftPx, @Px int rightPx, @Px int itemSpacingPx) {
this(topPx, bottomPx, leftPx, rightPx, itemSpacingPx, PaddingType.PX);
@Px int leftPx, @Px int topPx, @Px int rightPx, @Px int bottomPx, @Px int itemSpacingPx) {
this(leftPx, topPx, rightPx, bottomPx, itemSpacingPx, PaddingType.PX);
}

/**
* @param top Top padding.
* @param bottom Bottom padding.
* @param left Left padding.
* @param top Top padding.
* @param right Right padding.
* @param bottom Bottom padding.
* @param itemSpacing Space to add between each carousel item. Will be implemented via an item
* decoration.
* @param paddingType Unit / Type of the given paddings/ itemspacing.
*/
private Padding(
int top, int bottom, int left, int right, int itemSpacing, PaddingType paddingType) {
int left, int top, int right, int bottom, int itemSpacing, PaddingType paddingType) {

this.top = top;
this.bottom = bottom;
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
this.itemSpacing = itemSpacing;
this.paddingType = paddingType;
}
Expand All @@ -455,27 +455,27 @@ public boolean equals(Object o) {

Padding padding = (Padding) o;

if (top != padding.top) {
if (left != padding.left) {
return false;
}
if (bottom != padding.bottom) {
if (top != padding.top) {
return false;
}
if (left != padding.left) {
if (right != padding.right) {
return false;
}
if (right != padding.right) {
if (bottom != padding.bottom) {
return false;
}
return itemSpacing == padding.itemSpacing;
}

@Override
public int hashCode() {
int result = top;
result = 31 * result + bottom;
result = 31 * result + left;
int result = left;
result = 31 * result + top;
result = 31 * result + right;
result = 31 * result + bottom;
result = 31 * result + itemSpacing;
return result;
}
Expand Down

0 comments on commit 7f81c8b

Please sign in to comment.