@@ -836,7 +836,7 @@ public boolean onTouchEvent(MotionEvent event) {
836836
837837 if (touching != null ) touching .setPressed (true );
838838 return true ;
839- case MotionEvent .ACTION_MOVE :{
839+ case MotionEvent .ACTION_MOVE : {
840840 float distanceX = event .getRawX () - sX ;
841841 float distanceY = event .getRawY () - sY ;
842842 float angle = Math .abs (distanceY / distanceX );
@@ -846,13 +846,13 @@ public boolean onTouchEvent(MotionEvent event) {
846846 if (angle < 45 ) {
847847 if (mLeftIndex != -1 && distanceX > 0 && isLeftSwipeEnabled ()) {
848848 mCurrentDirectionIndex = mLeftIndex ;
849- } else if (mRightIndex != -1 && isRightSwipeEnabled ()) {
849+ } else if (mRightIndex != -1 && distanceX < 0 && isRightSwipeEnabled ()) {
850850 mCurrentDirectionIndex = mRightIndex ;
851851 }
852852 } else {
853- if (mTopIndex != -1 && distanceY < 0 && isTopSwipeEnabled ()) {
853+ if (mTopIndex != -1 && distanceY > 0 && isTopSwipeEnabled ()) {
854854 mCurrentDirectionIndex = mTopIndex ;
855- } else if (mBottomIndex != -1 && isBottomSwipeEnabled ()) {
855+ } else if (mBottomIndex != -1 && distanceY < 0 && isBottomSwipeEnabled ()) {
856856 mCurrentDirectionIndex = mBottomIndex ;
857857 }
858858 }
@@ -1159,44 +1159,41 @@ public List<ViewGroup> getBottomViews() {
11591159 }
11601160
11611161 // Pass the id of the view if set, otherwise pass -1
1162- public void setBottomViewIds (int left , int right , int top , int bottom ) {
1162+ public void setBottomViewIds (int left , int right , int top , int bottom ) {
11631163 if (mDragEdges .contains (DragEdge .Left )) {
11641164 if (left == -1 ) {
11651165 mBottomViewIdsSet = false ;
1166- }
1167- else {
1166+ } else {
11681167 mBottomViewIdMap .put (DragEdge .Left , left );
11691168 mBottomViewIdsSet = true ;
11701169 }
11711170 }
11721171 if (mDragEdges .contains (DragEdge .Right )) {
11731172 if (right == -1 ) {
11741173 mBottomViewIdsSet = false ;
1175- }
1176- else {
1174+ } else {
11771175 mBottomViewIdMap .put (DragEdge .Right , right );
11781176 mBottomViewIdsSet = true ;
11791177 }
11801178 }
11811179 if (mDragEdges .contains (DragEdge .Top )) {
11821180 if (top == -1 ) {
11831181 mBottomViewIdsSet = false ;
1184- }
1185- else {
1182+ } else {
11861183 mBottomViewIdMap .put (DragEdge .Top , top );
11871184 mBottomViewIdsSet = true ;
11881185 }
11891186 }
11901187 if (mDragEdges .contains (DragEdge .Bottom )) {
11911188 if (bottom == -1 ) {
11921189 mBottomViewIdsSet = false ;
1193- }
1194- else {
1190+ } else {
11951191 mBottomViewIdMap .put (DragEdge .Bottom , bottom );
11961192 mBottomViewIdsSet = true ;
11971193 }
11981194 }
11991195 }
1196+
12001197 public enum Status {
12011198 Middle ,
12021199 Open ,
@@ -1305,7 +1302,8 @@ private void processBottomLayDownMode(float xvel, float yvel) {
13051302
13061303 int l = getPaddingLeft (), t = getPaddingTop ();
13071304
1308- if (xvel < 0 && mDragEdges .get (mCurrentDirectionIndex ) == DragEdge .Right ) l -= mDragDistance ;
1305+ if (xvel < 0 && mDragEdges .get (mCurrentDirectionIndex ) == DragEdge .Right )
1306+ l -= mDragDistance ;
13091307 if (xvel > 0 && mDragEdges .get (mCurrentDirectionIndex ) == DragEdge .Left ) l += mDragDistance ;
13101308
13111309 if (yvel > 0 && mDragEdges .get (mCurrentDirectionIndex ) == DragEdge .Top ) t += mDragDistance ;
@@ -1362,7 +1360,7 @@ public void open(DragEdge edge) {
13621360 case Bottom :
13631361 mCurrentDirectionIndex = mBottomIndex ;
13641362 }
1365- open (true , true );
1363+ open (true , true );
13661364 }
13671365
13681366 public void open (boolean smooth , DragEdge edge ) {
@@ -1376,9 +1374,9 @@ public void open(boolean smooth, DragEdge edge) {
13761374 case Bottom :
13771375 mCurrentDirectionIndex = mBottomIndex ;
13781376 }
1379- open (smooth , true );
1377+ open (smooth , true );
13801378 }
1381-
1379+
13821380 public void open (boolean smooth , boolean notify , DragEdge edge ) {
13831381 switch (edge ) {
13841382 case Left :
@@ -1390,9 +1388,9 @@ public void open(boolean smooth, boolean notify, DragEdge edge) {
13901388 case Bottom :
13911389 mCurrentDirectionIndex = mBottomIndex ;
13921390 }
1393- open (smooth , notify );
1391+ open (smooth , notify );
13941392 }
1395-
1393+
13961394 /**
13971395 * smoothly close surface.
13981396 */
0 commit comments