@@ -836,7 +836,7 @@ public boolean onTouchEvent(MotionEvent event) {
836
836
837
837
if (touching != null ) touching .setPressed (true );
838
838
return true ;
839
- case MotionEvent .ACTION_MOVE :{
839
+ case MotionEvent .ACTION_MOVE : {
840
840
float distanceX = event .getRawX () - sX ;
841
841
float distanceY = event .getRawY () - sY ;
842
842
float angle = Math .abs (distanceY / distanceX );
@@ -846,13 +846,13 @@ public boolean onTouchEvent(MotionEvent event) {
846
846
if (angle < 45 ) {
847
847
if (mLeftIndex != -1 && distanceX > 0 && isLeftSwipeEnabled ()) {
848
848
mCurrentDirectionIndex = mLeftIndex ;
849
- } else if (mRightIndex != -1 && isRightSwipeEnabled ()) {
849
+ } else if (mRightIndex != -1 && distanceX < 0 && isRightSwipeEnabled ()) {
850
850
mCurrentDirectionIndex = mRightIndex ;
851
851
}
852
852
} else {
853
- if (mTopIndex != -1 && distanceY < 0 && isTopSwipeEnabled ()) {
853
+ if (mTopIndex != -1 && distanceY > 0 && isTopSwipeEnabled ()) {
854
854
mCurrentDirectionIndex = mTopIndex ;
855
- } else if (mBottomIndex != -1 && isBottomSwipeEnabled ()) {
855
+ } else if (mBottomIndex != -1 && distanceY < 0 && isBottomSwipeEnabled ()) {
856
856
mCurrentDirectionIndex = mBottomIndex ;
857
857
}
858
858
}
@@ -1159,44 +1159,41 @@ public List<ViewGroup> getBottomViews() {
1159
1159
}
1160
1160
1161
1161
// 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 ) {
1163
1163
if (mDragEdges .contains (DragEdge .Left )) {
1164
1164
if (left == -1 ) {
1165
1165
mBottomViewIdsSet = false ;
1166
- }
1167
- else {
1166
+ } else {
1168
1167
mBottomViewIdMap .put (DragEdge .Left , left );
1169
1168
mBottomViewIdsSet = true ;
1170
1169
}
1171
1170
}
1172
1171
if (mDragEdges .contains (DragEdge .Right )) {
1173
1172
if (right == -1 ) {
1174
1173
mBottomViewIdsSet = false ;
1175
- }
1176
- else {
1174
+ } else {
1177
1175
mBottomViewIdMap .put (DragEdge .Right , right );
1178
1176
mBottomViewIdsSet = true ;
1179
1177
}
1180
1178
}
1181
1179
if (mDragEdges .contains (DragEdge .Top )) {
1182
1180
if (top == -1 ) {
1183
1181
mBottomViewIdsSet = false ;
1184
- }
1185
- else {
1182
+ } else {
1186
1183
mBottomViewIdMap .put (DragEdge .Top , top );
1187
1184
mBottomViewIdsSet = true ;
1188
1185
}
1189
1186
}
1190
1187
if (mDragEdges .contains (DragEdge .Bottom )) {
1191
1188
if (bottom == -1 ) {
1192
1189
mBottomViewIdsSet = false ;
1193
- }
1194
- else {
1190
+ } else {
1195
1191
mBottomViewIdMap .put (DragEdge .Bottom , bottom );
1196
1192
mBottomViewIdsSet = true ;
1197
1193
}
1198
1194
}
1199
1195
}
1196
+
1200
1197
public enum Status {
1201
1198
Middle ,
1202
1199
Open ,
@@ -1305,7 +1302,8 @@ private void processBottomLayDownMode(float xvel, float yvel) {
1305
1302
1306
1303
int l = getPaddingLeft (), t = getPaddingTop ();
1307
1304
1308
- if (xvel < 0 && mDragEdges .get (mCurrentDirectionIndex ) == DragEdge .Right ) l -= mDragDistance ;
1305
+ if (xvel < 0 && mDragEdges .get (mCurrentDirectionIndex ) == DragEdge .Right )
1306
+ l -= mDragDistance ;
1309
1307
if (xvel > 0 && mDragEdges .get (mCurrentDirectionIndex ) == DragEdge .Left ) l += mDragDistance ;
1310
1308
1311
1309
if (yvel > 0 && mDragEdges .get (mCurrentDirectionIndex ) == DragEdge .Top ) t += mDragDistance ;
@@ -1362,7 +1360,7 @@ public void open(DragEdge edge) {
1362
1360
case Bottom :
1363
1361
mCurrentDirectionIndex = mBottomIndex ;
1364
1362
}
1365
- open (true , true );
1363
+ open (true , true );
1366
1364
}
1367
1365
1368
1366
public void open (boolean smooth , DragEdge edge ) {
@@ -1376,9 +1374,9 @@ public void open(boolean smooth, DragEdge edge) {
1376
1374
case Bottom :
1377
1375
mCurrentDirectionIndex = mBottomIndex ;
1378
1376
}
1379
- open (smooth , true );
1377
+ open (smooth , true );
1380
1378
}
1381
-
1379
+
1382
1380
public void open (boolean smooth , boolean notify , DragEdge edge ) {
1383
1381
switch (edge ) {
1384
1382
case Left :
@@ -1390,9 +1388,9 @@ public void open(boolean smooth, boolean notify, DragEdge edge) {
1390
1388
case Bottom :
1391
1389
mCurrentDirectionIndex = mBottomIndex ;
1392
1390
}
1393
- open (smooth , notify );
1391
+ open (smooth , notify );
1394
1392
}
1395
-
1393
+
1396
1394
/**
1397
1395
* smoothly close surface.
1398
1396
*/
0 commit comments