From 1c72aa2607fa23f4a2b7253825ec88468afe1141 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 22 Aug 2016 15:43:34 -0700 Subject: Fixes #709: Fix spacing on grids with starting header --- .../java/github/daneren2005/dsub/view/GridSpacingDecoration.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java b/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java index a33746c4..45b34b9f 100644 --- a/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java +++ b/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java @@ -78,7 +78,7 @@ public class GridSpacingDecoration extends RecyclerView.ItemDecoration { outRect.left = halfSpacing - margins; outRect.right = halfSpacing - margins; - if (isTopEdge(childIndex, spanCount)) { + if (isTopEdge(childIndex, spanIndex, spanCount)) { outRect.top = spacing - doubleMargins; } @@ -123,8 +123,8 @@ public class GridSpacingDecoration extends RecyclerView.ItemDecoration { return spanIndex == spanCount - 1; } - protected boolean isTopEdge(int childIndex, int spanCount) { - return childIndex < spanCount; + protected boolean isTopEdge(int childIndex, int spanIndex, int spanCount) { + return childIndex < spanCount && childIndex == spanIndex; } protected boolean isBottomEdge(int childIndex, int childCount, int spanCount) { -- cgit v1.2.3