@@ -59,8 +59,8 @@ public class SwipeLayout extends FrameLayout {
59
59
private boolean mSwipeEnabled = true ;
60
60
private boolean [] mSwipesEnabled = new boolean []{true , true , true , true };
61
61
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 ;
64
64
65
65
public enum DragEdge {
66
66
Left ,
@@ -403,17 +403,17 @@ else if (mCurrentDragEdge == DragEdge.Bottom && newTop > getPaddingTop())
403
403
/**
404
404
* save children's bounds, so they can restore the bound in {@link #onLayout(boolean, int, int, int, int)}
405
405
*/
406
- private void captureChildrenBound (){
406
+ private void captureChildrenBound () {
407
407
View currentBottomView = getCurrentBottomView ();
408
- if (getOpenStatus ()== Status .Close ){
408
+ if (getOpenStatus () == Status .Close ) {
409
409
mViewBoundCache .remove (currentBottomView );
410
410
return ;
411
411
}
412
412
413
413
View [] views = new View []{getSurfaceView (), currentBottomView };
414
414
for (View child : views ) {
415
415
Rect rect = mViewBoundCache .get (child );
416
- if (rect == null ){
416
+ if (rect == null ) {
417
417
rect = new Rect ();
418
418
mViewBoundCache .put (child , rect );
419
419
}
@@ -794,14 +794,15 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
794
794
void layoutPullOut () {
795
795
View surfaceView = getSurfaceView ();
796
796
Rect surfaceRect = mViewBoundCache .get (surfaceView );
797
- if (surfaceRect == null ) surfaceRect = computeSurfaceLayoutArea (false );
797
+ if (surfaceRect == null ) surfaceRect = computeSurfaceLayoutArea (false );
798
798
if (surfaceView != null ) {
799
799
surfaceView .layout (surfaceRect .left , surfaceRect .top , surfaceRect .right , surfaceRect .bottom );
800
800
bringChildToFront (surfaceView );
801
801
}
802
802
View currentBottomView = getCurrentBottomView ();
803
803
Rect bottomViewRect = mViewBoundCache .get (currentBottomView );
804
- if (bottomViewRect == null ) bottomViewRect = computeBottomLayoutAreaViaSurface (ShowMode .PullOut , surfaceRect );
804
+ if (bottomViewRect == null )
805
+ bottomViewRect = computeBottomLayoutAreaViaSurface (ShowMode .PullOut , surfaceRect );
805
806
if (currentBottomView != null ) {
806
807
currentBottomView .layout (bottomViewRect .left , bottomViewRect .top , bottomViewRect .right , bottomViewRect .bottom );
807
808
}
@@ -810,14 +811,15 @@ void layoutPullOut() {
810
811
void layoutLayDown () {
811
812
View surfaceView = getSurfaceView ();
812
813
Rect surfaceRect = mViewBoundCache .get (surfaceView );
813
- if (surfaceRect == null ) surfaceRect = computeSurfaceLayoutArea (false );
814
+ if (surfaceRect == null ) surfaceRect = computeSurfaceLayoutArea (false );
814
815
if (surfaceView != null ) {
815
816
surfaceView .layout (surfaceRect .left , surfaceRect .top , surfaceRect .right , surfaceRect .bottom );
816
817
bringChildToFront (surfaceView );
817
818
}
818
819
View currentBottomView = getCurrentBottomView ();
819
820
Rect bottomViewRect = mViewBoundCache .get (currentBottomView );
820
- if (bottomViewRect == null ) bottomViewRect = computeBottomLayoutAreaViaSurface (ShowMode .LayDown , surfaceRect );
821
+ if (bottomViewRect == null )
822
+ bottomViewRect = computeBottomLayoutAreaViaSurface (ShowMode .LayDown , surfaceRect );
821
823
if (currentBottomView != null ) {
822
824
currentBottomView .layout (bottomViewRect .left , bottomViewRect .top , bottomViewRect .right , bottomViewRect .bottom );
823
825
}
@@ -1043,10 +1045,12 @@ public boolean isBottomSwipeEnabled() {
1043
1045
public void setBottomSwipeEnabled (boolean bottomSwipeEnabled ) {
1044
1046
this .mSwipesEnabled [DragEdge .Bottom .ordinal ()] = bottomSwipeEnabled ;
1045
1047
}
1048
+
1046
1049
/***
1047
1050
* Returns the percentage of revealing at which the view below should the view finish opening
1048
1051
* 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
1050
1054
*/
1051
1055
public float getWillOpenPercentAfterOpen () {
1052
1056
return mWillOpenPercentAfterOpen ;
@@ -1055,22 +1059,27 @@ public float getWillOpenPercentAfterOpen() {
1055
1059
/***
1056
1060
* Allows to stablish at what percentage of revealing the view below should the view finish opening
1057
1061
* if it was already open before dragging
1062
+ *
1058
1063
* @param willOpenPercentAfterOpen The percentage of view revealed to trigger, default value is 0.25
1059
1064
*/
1060
1065
public void setWillOpenPercentAfterOpen (float willOpenPercentAfterOpen ) {
1061
1066
this .mWillOpenPercentAfterOpen = willOpenPercentAfterOpen ;
1062
1067
}
1068
+
1063
1069
/***
1064
1070
* Returns the percentage of revealing at which the view below should the view finish opening
1065
1071
* 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
1067
1074
*/
1068
1075
public float getWillOpenPercentAfterClose () {
1069
1076
return mWillOpenPercentAfterClose ;
1070
1077
}
1078
+
1071
1079
/***
1072
1080
* Allows to stablish at what percentage of revealing the view below should the view finish opening
1073
1081
* if it was already closed before dragging
1082
+ *
1074
1083
* @param willOpenPercentAfterClose The percentage of view revealed to trigger, default value is 0.75
1075
1084
*/
1076
1085
public void setWillOpenPercentAfterClose (float willOpenPercentAfterClose ) {
@@ -1324,7 +1333,7 @@ protected void processHandRelease(float xvel, float yvel, boolean isCloseBeforeD
1324
1333
if (currentDragEdge == null || surfaceView == null ) {
1325
1334
return ;
1326
1335
}
1327
- float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen ););
1336
+ float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen );
1328
1337
if (currentDragEdge == DragEdge .Left ) {
1329
1338
if (xvel > minVelocity ) open ();
1330
1339
else if (xvel < -minVelocity ) close ();
@@ -1563,7 +1572,7 @@ public void setDragEdge(DragEdge dragEdge) {
1563
1572
setCurrentDragEdge (dragEdge );
1564
1573
}
1565
1574
1566
- protected void onViewRemoved (View child ) {
1575
+ public void onViewRemoved (View child ) {
1567
1576
for (Map .Entry <DragEdge , View > entry : new HashMap <DragEdge , View >(mDragEdges ).entrySet ()) {
1568
1577
if (entry .getValue () == child ) {
1569
1578
mDragEdges .remove (entry .getKey ());
0 commit comments