From 5455e06b8a8056cb6b193a71c9fbd963579af359 Mon Sep 17 00:00:00 2001 From: zhulianggang Date: Thu, 20 Oct 2016 15:19:30 +0800 Subject: [PATCH] fix bug #387 --- .../src/main/java/com/daimajia/swipe/SwipeLayout.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/daimajia/swipe/SwipeLayout.java b/library/src/main/java/com/daimajia/swipe/SwipeLayout.java index 578e770f..32eebcef 100644 --- a/library/src/main/java/com/daimajia/swipe/SwipeLayout.java +++ b/library/src/main/java/com/daimajia/swipe/SwipeLayout.java @@ -402,15 +402,20 @@ else if (mCurrentDragEdge == DragEdge.Bottom && newTop > getPaddingTop()) /** * save children's bounds, so they can restore the bound in {@link #onLayout(boolean, int, int, int, int)} + * fix bug: issue,no save close value + * */ private void captureChildrenBound(){ View currentBottomView = getCurrentBottomView(); + + View[] views; if(getOpenStatus()==Status.Close){ mViewBoundCache.remove(currentBottomView); - return; + views = new View[]{getSurfaceView()}; + }else{ + views = new View[]{getSurfaceView(), currentBottomView}; } - View[] views = new View[]{getSurfaceView(), currentBottomView}; for (View child : views) { Rect rect = mViewBoundCache.get(child); if(rect==null){ @@ -1324,7 +1329,7 @@ protected void processHandRelease(float xvel, float yvel, boolean isCloseBeforeD if (currentDragEdge == null || surfaceView == null) { return; } - float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen);); + float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen); if (currentDragEdge == DragEdge.Left) { if (xvel > minVelocity) open(); else if (xvel < -minVelocity) close();