@@ -59,6 +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 ;
6264
6365 public enum DragEdge {
6466 Left ,
@@ -1041,6 +1043,39 @@ public boolean isBottomSwipeEnabled() {
10411043 public void setBottomSwipeEnabled (boolean bottomSwipeEnabled ) {
10421044 this .mSwipesEnabled [DragEdge .Bottom .ordinal ()] = bottomSwipeEnabled ;
10431045 }
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+ }
10441079
10451080 private boolean insideAdapterView () {
10461081 return getAdapterView () != null ;
@@ -1289,7 +1324,7 @@ protected void processHandRelease(float xvel, float yvel, boolean isCloseBeforeD
12891324 if (currentDragEdge == null || surfaceView == null ) {
12901325 return ;
12911326 }
1292- float willOpenPercent = (isCloseBeforeDragged ? .25f : .75f );
1327+ float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen ); );
12931328 if (currentDragEdge == DragEdge .Left ) {
12941329 if (xvel > minVelocity ) open ();
12951330 else if (xvel < -minVelocity ) close ();
0 commit comments