From 1fd2ec7d2f189c71211534cc6dbddde4b6c442b3 Mon Sep 17 00:00:00 2001 From: HarshEvilGeek Date: Thu, 12 Feb 2015 11:41:08 +0530 Subject: [PATCH] Recylcing typed array and adding support for opening specific drag edge --- .../java/com/daimajia/swipe/SwipeLayout.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/library/src/main/java/com/daimajia/swipe/SwipeLayout.java b/library/src/main/java/com/daimajia/swipe/SwipeLayout.java index 2bdb74c..6e100e6 100644 --- a/library/src/main/java/com/daimajia/swipe/SwipeLayout.java +++ b/library/src/main/java/com/daimajia/swipe/SwipeLayout.java @@ -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. */