Bug 1385988 - HighlightsDividerItemDecoration: Use adapter position and not current position in parent view. r=mcomella
authorSebastian Kaspari <s.kaspari@gmail.com>
Fri, 08 Sep 2017 17:08:05 +0200
changeset 429283 ae513db6d626f1032a62e1af81e2277390783810
parent 429282 40df319376b8b788ce75435c17117a0134a447f8
child 429284 8616624d6d1ce534cd501b3522d2b73642f87d3a
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1385988
milestone57.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 1385988 - HighlightsDividerItemDecoration: Use adapter position and not current position in parent view. r=mcomella MozReview-Commit-ID: Ih6USplyBTb
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
@@ -32,21 +32,27 @@ import android.view.View;
     }
 
     @Override
     public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
         final int left = parent.getPaddingLeft();
         final int right = parent.getWidth() - parent.getPaddingRight();
 
         final int childCount = parent.getChildCount();
-        for (int i = START_DRAWING_AT_POSITION; i < childCount; i++) {
+        for (int i = 0; i < childCount; i++) {
             final View child = parent.getChildAt(i);
+
+            if (parent.getChildAdapterPosition(child) < START_DRAWING_AT_POSITION) {
+                continue;
+            }
+
             if (child.getVisibility() == View.GONE) {
                 continue;
             }
+
             final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                     .getLayoutParams();
             final int top = child.getBottom() + params.bottomMargin;
             final int bottom = top + divider.getIntrinsicHeight();
             divider.setBounds(left, top, right, bottom);
             divider.draw(c);
         }
     }