@@ -59,8 +59,8 @@ public class SwipeLayout extends FrameLayout {
5959 private boolean mSwipeEnabled = true ;
6060 private boolean [] mSwipesEnabled = new boolean []{true , true , true , true };
6161 private boolean mClickToClose = false ;
62- private float mWillOpenPercentAfterOpen = 0.75f ;
63- private float mWillOpenPercentAfterClose = 0.25f ;
62+ private float mWillOpenPercentAfterOpen = 0.75f ;
63+ private float mWillOpenPercentAfterClose = 0.25f ;
6464
6565 public enum DragEdge {
6666 Left ,
@@ -403,17 +403,17 @@ else if (mCurrentDragEdge == DragEdge.Bottom && newTop > getPaddingTop())
403403 /**
404404 * save children's bounds, so they can restore the bound in {@link #onLayout(boolean, int, int, int, int)}
405405 */
406- private void captureChildrenBound (){
406+ private void captureChildrenBound () {
407407 View currentBottomView = getCurrentBottomView ();
408- if (getOpenStatus ()== Status .Close ){
408+ if (getOpenStatus () == Status .Close ) {
409409 mViewBoundCache .remove (currentBottomView );
410410 return ;
411411 }
412412
413413 View [] views = new View []{getSurfaceView (), currentBottomView };
414414 for (View child : views ) {
415415 Rect rect = mViewBoundCache .get (child );
416- if (rect == null ){
416+ if (rect == null ) {
417417 rect = new Rect ();
418418 mViewBoundCache .put (child , rect );
419419 }
@@ -794,14 +794,15 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
794794 void layoutPullOut () {
795795 View surfaceView = getSurfaceView ();
796796 Rect surfaceRect = mViewBoundCache .get (surfaceView );
797- if (surfaceRect == null ) surfaceRect = computeSurfaceLayoutArea (false );
797+ if (surfaceRect == null ) surfaceRect = computeSurfaceLayoutArea (false );
798798 if (surfaceView != null ) {
799799 surfaceView .layout (surfaceRect .left , surfaceRect .top , surfaceRect .right , surfaceRect .bottom );
800800 bringChildToFront (surfaceView );
801801 }
802802 View currentBottomView = getCurrentBottomView ();
803803 Rect bottomViewRect = mViewBoundCache .get (currentBottomView );
804- if (bottomViewRect == null ) bottomViewRect = computeBottomLayoutAreaViaSurface (ShowMode .PullOut , surfaceRect );
804+ if (bottomViewRect == null )
805+ bottomViewRect = computeBottomLayoutAreaViaSurface (ShowMode .PullOut , surfaceRect );
805806 if (currentBottomView != null ) {
806807 currentBottomView .layout (bottomViewRect .left , bottomViewRect .top , bottomViewRect .right , bottomViewRect .bottom );
807808 }
@@ -810,14 +811,15 @@ void layoutPullOut() {
810811 void layoutLayDown () {
811812 View surfaceView = getSurfaceView ();
812813 Rect surfaceRect = mViewBoundCache .get (surfaceView );
813- if (surfaceRect == null ) surfaceRect = computeSurfaceLayoutArea (false );
814+ if (surfaceRect == null ) surfaceRect = computeSurfaceLayoutArea (false );
814815 if (surfaceView != null ) {
815816 surfaceView .layout (surfaceRect .left , surfaceRect .top , surfaceRect .right , surfaceRect .bottom );
816817 bringChildToFront (surfaceView );
817818 }
818819 View currentBottomView = getCurrentBottomView ();
819820 Rect bottomViewRect = mViewBoundCache .get (currentBottomView );
820- if (bottomViewRect == null ) bottomViewRect = computeBottomLayoutAreaViaSurface (ShowMode .LayDown , surfaceRect );
821+ if (bottomViewRect == null )
822+ bottomViewRect = computeBottomLayoutAreaViaSurface (ShowMode .LayDown , surfaceRect );
821823 if (currentBottomView != null ) {
822824 currentBottomView .layout (bottomViewRect .left , bottomViewRect .top , bottomViewRect .right , bottomViewRect .bottom );
823825 }
@@ -1043,10 +1045,12 @@ public boolean isBottomSwipeEnabled() {
10431045 public void setBottomSwipeEnabled (boolean bottomSwipeEnabled ) {
10441046 this .mSwipesEnabled [DragEdge .Bottom .ordinal ()] = bottomSwipeEnabled ;
10451047 }
1048+
10461049 /***
10471050 * Returns the percentage of revealing at which the view below should the view finish opening
10481051 * if it was already open before dragging
1049- * @returns The percentage of view revealed to trigger, default value is 0.25
1052+ *
1053+ * @returns The percentage of view revealed to trigger, default value is 0.25
10501054 */
10511055 public float getWillOpenPercentAfterOpen () {
10521056 return mWillOpenPercentAfterOpen ;
@@ -1055,22 +1059,27 @@ public float getWillOpenPercentAfterOpen() {
10551059 /***
10561060 * Allows to stablish at what percentage of revealing the view below should the view finish opening
10571061 * if it was already open before dragging
1062+ *
10581063 * @param willOpenPercentAfterOpen The percentage of view revealed to trigger, default value is 0.25
10591064 */
10601065 public void setWillOpenPercentAfterOpen (float willOpenPercentAfterOpen ) {
10611066 this .mWillOpenPercentAfterOpen = willOpenPercentAfterOpen ;
10621067 }
1068+
10631069 /***
10641070 * Returns the percentage of revealing at which the view below should the view finish opening
10651071 * if it was already closed before dragging
1066- * @returns The percentage of view revealed to trigger, default value is 0.25
1072+ *
1073+ * @returns The percentage of view revealed to trigger, default value is 0.25
10671074 */
10681075 public float getWillOpenPercentAfterClose () {
10691076 return mWillOpenPercentAfterClose ;
10701077 }
1078+
10711079 /***
10721080 * Allows to stablish at what percentage of revealing the view below should the view finish opening
10731081 * if it was already closed before dragging
1082+ *
10741083 * @param willOpenPercentAfterClose The percentage of view revealed to trigger, default value is 0.75
10751084 */
10761085 public void setWillOpenPercentAfterClose (float willOpenPercentAfterClose ) {
@@ -1324,7 +1333,7 @@ protected void processHandRelease(float xvel, float yvel, boolean isCloseBeforeD
13241333 if (currentDragEdge == null || surfaceView == null ) {
13251334 return ;
13261335 }
1327- float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen ););
1336+ float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen );
13281337 if (currentDragEdge == DragEdge .Left ) {
13291338 if (xvel > minVelocity ) open ();
13301339 else if (xvel < -minVelocity ) close ();
@@ -1563,7 +1572,7 @@ public void setDragEdge(DragEdge dragEdge) {
15631572 setCurrentDragEdge (dragEdge );
15641573 }
15651574
1566- protected void onViewRemoved (View child ) {
1575+ public void onViewRemoved (View child ) {
15671576 for (Map .Entry <DragEdge , View > entry : new HashMap <DragEdge , View >(mDragEdges ).entrySet ()) {
15681577 if (entry .getValue () == child ) {
15691578 mDragEdges .remove (entry .getKey ());
0 commit comments