Bug 1402481 - Reverse incorrect sign of margin calculation. r=mcomella
authorChenxia Liu <liuche@mozilla.com>
Fri, 22 Sep 2017 09:12:38 -0700
changeset 382557 2b59b2d150ce2214ce26ba0ede07674c70e17c67
parent 382556 722e1226aa7a1676dfa936d01ba00920ef2736c1
child 382558 5870f25b4a832dccf8277548eaa83c8d80edc4a6
push id51908
push usercliu@mozilla.com
push dateFri, 22 Sep 2017 22:56:06 +0000
treeherderautoland@2b59b2d150ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1402481
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
@@ -56,17 +56,19 @@ import android.view.View;
             final int childViewType = parent.getAdapter().getItemViewType(childPosition);
             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) {