@@ -59,6 +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
64
63
65
public enum DragEdge {
64
66
Left ,
@@ -1041,6 +1043,39 @@ public boolean isBottomSwipeEnabled() {
1041
1043
public void setBottomSwipeEnabled (boolean bottomSwipeEnabled ) {
1042
1044
this .mSwipesEnabled [DragEdge .Bottom .ordinal ()] = bottomSwipeEnabled ;
1043
1045
}
1046
+ /***
1047
+ * Returns the percentage of revealing at which the view below should the view finish opening
1048
+ * if it was already open before dragging
1049
+ * @returns The percentage of view revealed to trigger, default value is 0.25
1050
+ */
1051
+ public float getWillOpenPercentAfterOpen () {
1052
+ return mWillOpenPercentAfterOpen ;
1053
+ }
1054
+
1055
+ /***
1056
+ * Allows to stablish at what percentage of revealing the view below should the view finish opening
1057
+ * if it was already open before dragging
1058
+ * @param willOpenPercentAfterOpen The percentage of view revealed to trigger, default value is 0.25
1059
+ */
1060
+ public void setWillOpenPercentAfterOpen (float willOpenPercentAfterOpen ) {
1061
+ this .mWillOpenPercentAfterOpen = willOpenPercentAfterOpen ;
1062
+ }
1063
+ /***
1064
+ * Returns the percentage of revealing at which the view below should the view finish opening
1065
+ * if it was already closed before dragging
1066
+ * @returns The percentage of view revealed to trigger, default value is 0.25
1067
+ */
1068
+ public float getWillOpenPercentAfterClose () {
1069
+ return mWillOpenPercentAfterClose ;
1070
+ }
1071
+ /***
1072
+ * Allows to stablish at what percentage of revealing the view below should the view finish opening
1073
+ * if it was already closed before dragging
1074
+ * @param willOpenPercentAfterClose The percentage of view revealed to trigger, default value is 0.75
1075
+ */
1076
+ public void setWillOpenPercentAfterClose (float willOpenPercentAfterClose ) {
1077
+ this .mWillOpenPercentAfterClose = willOpenPercentAfterClose ;
1078
+ }
1044
1079
1045
1080
private boolean insideAdapterView () {
1046
1081
return getAdapterView () != null ;
@@ -1289,7 +1324,7 @@ protected void processHandRelease(float xvel, float yvel, boolean isCloseBeforeD
1289
1324
if (currentDragEdge == null || surfaceView == null ) {
1290
1325
return ;
1291
1326
}
1292
- float willOpenPercent = (isCloseBeforeDragged ? .25f : .75f );
1327
+ float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen ); );
1293
1328
if (currentDragEdge == DragEdge .Left ) {
1294
1329
if (xvel > minVelocity ) open ();
1295
1330
else if (xvel < -minVelocity ) close ();
0 commit comments