From 22d76f32799efcdc08ad95c43dbf859b57d49e56 Mon Sep 17 00:00:00 2001 From: longerian Date: Sun, 14 Jan 2018 13:03:38 +0800 Subject: [PATCH 1/2] fix #223 --- .../android/vlayout/layout/LinearLayoutHelper.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/vlayout/src/main/java/com/alibaba/android/vlayout/layout/LinearLayoutHelper.java b/vlayout/src/main/java/com/alibaba/android/vlayout/layout/LinearLayoutHelper.java index 2e6b3a38..b21f47c2 100644 --- a/vlayout/src/main/java/com/alibaba/android/vlayout/layout/LinearLayoutHelper.java +++ b/vlayout/src/main/java/com/alibaba/android/vlayout/layout/LinearLayoutHelper.java @@ -27,9 +27,11 @@ import com.alibaba.android.vlayout.LayoutManagerHelper; import com.alibaba.android.vlayout.OrientationHelperEx; import com.alibaba.android.vlayout.VirtualLayoutManager; +import com.alibaba.android.vlayout.VirtualLayoutManager.AnchorInfoWrapper; import com.alibaba.android.vlayout.VirtualLayoutManager.LayoutParams; import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.RecyclerView.State; import android.util.Log; import android.view.View; @@ -47,6 +49,8 @@ public class LinearLayoutHelper extends BaseLayoutHelper { private int mDividerHeight = 0; + private boolean mLayoutWithAnchor = false; + public LinearLayoutHelper() { this(0); } @@ -113,8 +117,9 @@ public void layoutViews(RecyclerView.Recycler recycler, RecyclerView.State state if (!isStartLine) { if (!isOverLapMargin) { - gap = mDividerHeight; + gap = mLayoutWithAnchor ? 0 : mDividerHeight; } else { + //TODO check layout with anchor if (isLayoutEnd) { int marginTop = params.topMargin; View sibling = helper.findViewByPosition(currentPosition - 1); @@ -209,6 +214,13 @@ public void layoutViews(RecyclerView.Recycler recycler, RecyclerView.State state } handleStateOnResult(result, view); + mLayoutWithAnchor = false; + } + + @Override + public void checkAnchorInfo(State state, AnchorInfoWrapper anchorInfo, LayoutManagerHelper helper) { + super.checkAnchorInfo(state, anchorInfo, helper); + mLayoutWithAnchor = true; } @Override From 7e1b9b3c85ba480390a9c89eebf3bfe513fd4566 Mon Sep 17 00:00:00 2001 From: longerian Date: Wed, 17 Jan 2018 11:20:34 +0800 Subject: [PATCH 2/2] remove log --- .../android/vlayout/layout/StaggeredGridLayoutHelper.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/vlayout/src/main/java/com/alibaba/android/vlayout/layout/StaggeredGridLayoutHelper.java b/vlayout/src/main/java/com/alibaba/android/vlayout/layout/StaggeredGridLayoutHelper.java index 3d5c69eb..266c8355 100644 --- a/vlayout/src/main/java/com/alibaba/android/vlayout/layout/StaggeredGridLayoutHelper.java +++ b/vlayout/src/main/java/com/alibaba/android/vlayout/layout/StaggeredGridLayoutHelper.java @@ -41,7 +41,6 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.view.ViewCompat; -import android.support.v7.widget.OrientationHelper; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.LayoutParams; import android.util.Log; @@ -1189,7 +1188,6 @@ void cacheReferenceLineAndClear(boolean reverseLayout, int offset, OrientationHe } void clear() { - Log.d("Longer", "clear span"); mViews.clear(); invalidateCache(); mDeletedSize = 0;