Recylcing typed array and adding support for opening specific drag edge

This commit is contained in:
HarshEvilGeek 2015-02-12 11:41:08 +05:30
parent 5bf1189d1c
commit 1fd2ec7d2f
1 changed files with 43 additions and 0 deletions

View File

@ -115,6 +115,7 @@ public class SwipeLayout extends FrameLayout {
populateIndexes();
int ordinal = a.getInt(R.styleable.SwipeLayout_show_mode, ShowMode.PullOut.ordinal());
mShowMode = ShowMode.values()[ordinal];
a.recycle();
}
public interface SwipeListener {
@ -1350,6 +1351,48 @@ public class SwipeLayout extends FrameLayout {
invalidate();
}
public void open(DragEdge edge) {
switch (edge) {
case Left:
mCurrentDirectionIndex = mLeftIndex;
case Right:
mCurrentDirectionIndex = mRightIndex;
case Top:
mCurrentDirectionIndex = mTopIndex;
case Bottom:
mCurrentDirectionIndex = mBottomIndex;
}
open (true, true);
}
public void open(boolean smooth, DragEdge edge) {
switch (edge) {
case Left:
mCurrentDirectionIndex = mLeftIndex;
case Right:
mCurrentDirectionIndex = mRightIndex;
case Top:
mCurrentDirectionIndex = mTopIndex;
case Bottom:
mCurrentDirectionIndex = mBottomIndex;
}
open (smooth, true);
}
public void open(boolean smooth, boolean notify, DragEdge edge) {
switch (edge) {
case Left:
mCurrentDirectionIndex = mLeftIndex;
case Right:
mCurrentDirectionIndex = mRightIndex;
case Top:
mCurrentDirectionIndex = mTopIndex;
case Bottom:
mCurrentDirectionIndex = mBottomIndex;
}
open (smooth, notify);
}
/**
* smoothly close surface.
*/