Bug 1402481 - Reverse incorrect sign of margin calculation. r?mcomella draft
authorChenxia Liu <liuche@mozilla.com>
Fri, 22 Sep 2017 09:12:38 -0700
changeset 669353 5f7c7f7d23d2e0e08de18937036ca9ef65c47249
parent 668548 ca7d18dbacbf103d74a3213d8d08a7c3e4def9a2
child 669359 adc8a2f76e4007210f845d8c586b90c5ee3e33c4
push id81307
push usercliu@mozilla.com
push dateFri, 22 Sep 2017 22:54:28 +0000
reviewersmcomella
bugs1402481
milestone58.0a1
Bug 1402481 - Reverse incorrect sign of margin calculation. r?mcomella MozReview-Commit-ID: ICS81o8pLOE
mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/HighlightsDividerItemDecoration.java
--- 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) {