Skip to content

Commit 1fd2ec7

Browse files
committed
Recylcing typed array and adding support for opening specific drag edge
1 parent 5bf1189 commit 1fd2ec7

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

library/src/main/java/com/daimajia/swipe/SwipeLayout.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public SwipeLayout(Context context, AttributeSet attrs, int defStyle) {
115115
populateIndexes();
116116
int ordinal = a.getInt(R.styleable.SwipeLayout_show_mode, ShowMode.PullOut.ordinal());
117117
mShowMode = ShowMode.values()[ordinal];
118+
a.recycle();
118119
}
119120

120121
public interface SwipeListener {
@@ -1350,6 +1351,48 @@ public void open(boolean smooth, boolean notify) {
13501351
invalidate();
13511352
}
13521353

1354+
public void open(DragEdge edge) {
1355+
switch (edge) {
1356+
case Left:
1357+
mCurrentDirectionIndex = mLeftIndex;
1358+
case Right:
1359+
mCurrentDirectionIndex = mRightIndex;
1360+
case Top:
1361+
mCurrentDirectionIndex = mTopIndex;
1362+
case Bottom:
1363+
mCurrentDirectionIndex = mBottomIndex;
1364+
}
1365+
open (true, true);
1366+
}
1367+
1368+
public void open(boolean smooth, DragEdge edge) {
1369+
switch (edge) {
1370+
case Left:
1371+
mCurrentDirectionIndex = mLeftIndex;
1372+
case Right:
1373+
mCurrentDirectionIndex = mRightIndex;
1374+
case Top:
1375+
mCurrentDirectionIndex = mTopIndex;
1376+
case Bottom:
1377+
mCurrentDirectionIndex = mBottomIndex;
1378+
}
1379+
open (smooth, true);
1380+
}
1381+
1382+
public void open(boolean smooth, boolean notify, DragEdge edge) {
1383+
switch (edge) {
1384+
case Left:
1385+
mCurrentDirectionIndex = mLeftIndex;
1386+
case Right:
1387+
mCurrentDirectionIndex = mRightIndex;
1388+
case Top:
1389+
mCurrentDirectionIndex = mTopIndex;
1390+
case Bottom:
1391+
mCurrentDirectionIndex = mBottomIndex;
1392+
}
1393+
open (smooth, notify);
1394+
}
1395+
13531396
/**
13541397
* smoothly close surface.
13551398
*/

0 commit comments

Comments
 (0)