Bug 1402481 - Reverse incorrect sign of margin calculation. r?mcomella
MozReview-Commit-ID: ICS81o8pLOE
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/HighlightsDividerItemDecoration.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/HighlightsDividerItemDecoration.java
@@ -54,17 +54,19 @@ import android.view.View;
final int childViewType = parent.getAdapter().getItemViewType(i);
if (childViewType == StreamRecyclerAdapter.RowItemType.HIGHLIGHTS_TITLE.getViewType()
|| childViewType == StreamRecyclerAdapter.RowItemType.TOP_STORIES_TITLE.getViewType()) {
continue;
}
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
.getLayoutParams();
- final int topOfDivider = child.getTop() + params.topMargin;
+ final int dividerHeight = divider.getIntrinsicHeight();
+ // Use dividerHeight / 2 to account for divider height and place it evenly between the two views.
+ final int topOfDivider = child.getTop() - params.topMargin - dividerHeight / 2;
final int bottomOfDivider = topOfDivider + divider.getIntrinsicHeight();
divider.setBounds(left, topOfDivider, right, bottomOfDivider);
divider.draw(c);
}
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {