|
|
|
@ -43,15 +43,15 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
private ViewDragHelper mDragHelper;
|
|
|
|
private ViewDragHelper mDragHelper;
|
|
|
|
|
|
|
|
|
|
|
|
private int mDragDistance = 0;
|
|
|
|
private int mDragDistance = 0;
|
|
|
|
private LinkedHashMap<DragEdge, View> mDragEdges = new LinkedHashMap<DragEdge, View>();
|
|
|
|
private LinkedHashMap<DragEdge, View> mDragEdges = new LinkedHashMap<>();
|
|
|
|
private ShowMode mShowMode;
|
|
|
|
private ShowMode mShowMode;
|
|
|
|
|
|
|
|
|
|
|
|
private float[] mEdgeSwipesOffset = new float[4];
|
|
|
|
private float[] mEdgeSwipesOffset = new float[4];
|
|
|
|
|
|
|
|
|
|
|
|
private List<SwipeListener> mSwipeListeners = new ArrayList<SwipeListener>();
|
|
|
|
private List<SwipeListener> mSwipeListeners = new ArrayList<>();
|
|
|
|
private List<SwipeDenier> mSwipeDeniers = new ArrayList<SwipeDenier>();
|
|
|
|
private List<SwipeDenier> mSwipeDeniers = new ArrayList<>();
|
|
|
|
private Map<View, ArrayList<OnRevealListener>> mRevealListeners = new HashMap<View, ArrayList<OnRevealListener>>();
|
|
|
|
private Map<View, ArrayList<OnRevealListener>> mRevealListeners = new HashMap<>();
|
|
|
|
private Map<View, Boolean> mShowEntirely = new HashMap<View, Boolean>();
|
|
|
|
private Map<View, Boolean> mShowEntirely = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
private DoubleClickListener mDoubleClickListener;
|
|
|
|
private DoubleClickListener mDoubleClickListener;
|
|
|
|
|
|
|
|
|
|
|
|
@ -59,14 +59,14 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
private boolean[] mSwipesEnabled = new boolean[]{true, true, true, true};
|
|
|
|
private boolean[] mSwipesEnabled = new boolean[]{true, true, true, true};
|
|
|
|
private boolean mClickToClose = false;
|
|
|
|
private boolean mClickToClose = false;
|
|
|
|
|
|
|
|
|
|
|
|
public static enum DragEdge {
|
|
|
|
public enum DragEdge {
|
|
|
|
Left,
|
|
|
|
Left,
|
|
|
|
Top,
|
|
|
|
Top,
|
|
|
|
Right,
|
|
|
|
Right,
|
|
|
|
Bottom
|
|
|
|
Bottom
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static enum ShowMode {
|
|
|
|
public enum ShowMode {
|
|
|
|
LayDown,
|
|
|
|
LayDown,
|
|
|
|
PullOut
|
|
|
|
PullOut
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -111,17 +111,17 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public interface SwipeListener {
|
|
|
|
public interface SwipeListener {
|
|
|
|
public void onStartOpen(SwipeLayout layout);
|
|
|
|
void onStartOpen(SwipeLayout layout);
|
|
|
|
|
|
|
|
|
|
|
|
public void onOpen(SwipeLayout layout);
|
|
|
|
void onOpen(SwipeLayout layout);
|
|
|
|
|
|
|
|
|
|
|
|
public void onStartClose(SwipeLayout layout);
|
|
|
|
void onStartClose(SwipeLayout layout);
|
|
|
|
|
|
|
|
|
|
|
|
public void onClose(SwipeLayout layout);
|
|
|
|
void onClose(SwipeLayout layout);
|
|
|
|
|
|
|
|
|
|
|
|
public void onUpdate(SwipeLayout layout, int leftOffset, int topOffset);
|
|
|
|
void onUpdate(SwipeLayout layout, int leftOffset, int topOffset);
|
|
|
|
|
|
|
|
|
|
|
|
public void onHandRelease(SwipeLayout layout, float xvel, float yvel);
|
|
|
|
void onHandRelease(SwipeLayout layout, float xvel, float yvel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void addSwipeListener(SwipeListener l) {
|
|
|
|
public void addSwipeListener(SwipeListener l) {
|
|
|
|
@ -132,7 +132,11 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
mSwipeListeners.remove(l);
|
|
|
|
mSwipeListeners.remove(l);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static interface SwipeDenier {
|
|
|
|
public void removeAllSwipeListener() {
|
|
|
|
|
|
|
|
mSwipeListeners.clear();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public interface SwipeDenier {
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Called in onInterceptTouchEvent Determines if this swipe event should
|
|
|
|
* Called in onInterceptTouchEvent Determines if this swipe event should
|
|
|
|
* be denied Implement this interface if you are using views with swipe
|
|
|
|
* be denied Implement this interface if you are using views with swipe
|
|
|
|
@ -140,7 +144,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return true deny false allow
|
|
|
|
* @return true deny false allow
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public boolean shouldDenySwipe(MotionEvent ev);
|
|
|
|
boolean shouldDenySwipe(MotionEvent ev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void addSwipeDenier(SwipeDenier denier) {
|
|
|
|
public void addSwipeDenier(SwipeDenier denier) {
|
|
|
|
@ -156,7 +160,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public interface OnRevealListener {
|
|
|
|
public interface OnRevealListener {
|
|
|
|
public void onReveal(View child, DragEdge edge, float fraction, int distance);
|
|
|
|
void onReveal(View child, DragEdge edge, float fraction, int distance);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -326,6 +330,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
boolean isCloseBeforeDrag = true;
|
|
|
|
boolean isCloseBeforeDrag = true;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onViewReleased(View releasedChild, float xvel, float yvel) {
|
|
|
|
public void onViewReleased(View releasedChild, float xvel, float yvel) {
|
|
|
|
super.onViewReleased(releasedChild, xvel, yvel);
|
|
|
|
super.onViewReleased(releasedChild, xvel, yvel);
|
|
|
|
@ -642,7 +647,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
* to support it from API 8.
|
|
|
|
* to support it from API 8.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public interface OnLayout {
|
|
|
|
public interface OnLayout {
|
|
|
|
public void onLayout(SwipeLayout v);
|
|
|
|
void onLayout(SwipeLayout v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<OnLayout> mOnLayoutListeners;
|
|
|
|
private List<OnLayout> mOnLayoutListeners;
|
|
|
|
@ -655,23 +660,29 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
public void removeOnLayoutListener(OnLayout l) {
|
|
|
|
public void removeOnLayoutListener(OnLayout l) {
|
|
|
|
if (mOnLayoutListeners != null) mOnLayoutListeners.remove(l);
|
|
|
|
if (mOnLayoutListeners != null) mOnLayoutListeners.remove(l);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void clearDragEdge() {
|
|
|
|
public void clearDragEdge() {
|
|
|
|
mDragEdges.clear();
|
|
|
|
mDragEdges.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setDrag(DragEdge dragEdge, int childId) {
|
|
|
|
public void setDrag(DragEdge dragEdge, int childId) {
|
|
|
|
clearDragEdge();
|
|
|
|
clearDragEdge();
|
|
|
|
addDrag(dragEdge, childId);
|
|
|
|
addDrag(dragEdge, childId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setDrag(DragEdge dragEdge, View child) {
|
|
|
|
public void setDrag(DragEdge dragEdge, View child) {
|
|
|
|
clearDragEdge();
|
|
|
|
clearDragEdge();
|
|
|
|
addDrag(dragEdge, child);
|
|
|
|
addDrag(dragEdge, child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void addDrag(DragEdge dragEdge, int childId) {
|
|
|
|
public void addDrag(DragEdge dragEdge, int childId) {
|
|
|
|
addDrag(dragEdge, findViewById(childId), null);
|
|
|
|
addDrag(dragEdge, findViewById(childId), null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void addDrag(DragEdge dragEdge, View child) {
|
|
|
|
public void addDrag(DragEdge dragEdge, View child) {
|
|
|
|
addDrag(dragEdge, child, null);
|
|
|
|
addDrag(dragEdge, child, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void addDrag(DragEdge dragEdge, View child, ViewGroup.LayoutParams params) {
|
|
|
|
public void addDrag(DragEdge dragEdge, View child, ViewGroup.LayoutParams params) {
|
|
|
|
if (child == null) return;
|
|
|
|
if (child == null) return;
|
|
|
|
|
|
|
|
|
|
|
|
@ -683,16 +694,25 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int gravity = -1;
|
|
|
|
int gravity = -1;
|
|
|
|
switch (dragEdge) {
|
|
|
|
switch (dragEdge) {
|
|
|
|
case Left:gravity = Gravity.LEFT;break;
|
|
|
|
case Left:
|
|
|
|
case Right:gravity = Gravity.RIGHT;break;
|
|
|
|
gravity = Gravity.LEFT;
|
|
|
|
case Top:gravity = Gravity.TOP;break;
|
|
|
|
break;
|
|
|
|
case Bottom:gravity = Gravity.BOTTOM;break;
|
|
|
|
case Right:
|
|
|
|
|
|
|
|
gravity = Gravity.RIGHT;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Top:
|
|
|
|
|
|
|
|
gravity = Gravity.TOP;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Bottom:
|
|
|
|
|
|
|
|
gravity = Gravity.BOTTOM;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (params instanceof FrameLayout.LayoutParams) {
|
|
|
|
if (params instanceof FrameLayout.LayoutParams) {
|
|
|
|
((LayoutParams) params).gravity = gravity;
|
|
|
|
((LayoutParams) params).gravity = gravity;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
addView(child, 0, params);
|
|
|
|
addView(child, 0, params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void addView(View child, int index, ViewGroup.LayoutParams params) {
|
|
|
|
public void addView(View child, int index, ViewGroup.LayoutParams params) {
|
|
|
|
if (child == null) return;
|
|
|
|
if (child == null) return;
|
|
|
|
@ -771,6 +791,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private boolean mIsBeingDragged;
|
|
|
|
private boolean mIsBeingDragged;
|
|
|
|
|
|
|
|
|
|
|
|
private void checkCanDrag(MotionEvent ev) {
|
|
|
|
private void checkCanDrag(MotionEvent ev) {
|
|
|
|
if (mIsBeingDragged) return;
|
|
|
|
if (mIsBeingDragged) return;
|
|
|
|
if (getOpenStatus() == Status.Middle) {
|
|
|
|
if (getOpenStatus() == Status.Middle) {
|
|
|
|
@ -843,6 +864,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mIsBeingDragged = !doNothing;
|
|
|
|
mIsBeingDragged = !doNothing;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
|
|
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
|
|
|
if (!isSwipeEnabled()) {
|
|
|
|
if (!isSwipeEnabled()) {
|
|
|
|
@ -932,6 +954,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
|
|
|
|
|
|
|
|
return super.onTouchEvent(event) || mIsBeingDragged || action == MotionEvent.ACTION_DOWN;
|
|
|
|
return super.onTouchEvent(event) || mIsBeingDragged || action == MotionEvent.ACTION_DOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isClickToClose() {
|
|
|
|
public boolean isClickToClose() {
|
|
|
|
return mClickToClose;
|
|
|
|
return mClickToClose;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -987,6 +1010,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
public void setBottomSwipeEnabled(boolean bottomSwipeEnabled) {
|
|
|
|
public void setBottomSwipeEnabled(boolean bottomSwipeEnabled) {
|
|
|
|
this.mSwipesEnabled[DragEdge.Bottom.ordinal()] = bottomSwipeEnabled;
|
|
|
|
this.mSwipesEnabled[DragEdge.Bottom.ordinal()] = bottomSwipeEnabled;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private boolean insideAdapterView() {
|
|
|
|
private boolean insideAdapterView() {
|
|
|
|
return getAdapterView() != null;
|
|
|
|
return getAdapterView() != null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1011,6 +1035,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private boolean performAdapterViewItemLongClick() {
|
|
|
|
private boolean performAdapterViewItemLongClick() {
|
|
|
|
if (getOpenStatus() != Status.Close) return false;
|
|
|
|
if (getOpenStatus() != Status.Close) return false;
|
|
|
|
ViewParent t = getParent();
|
|
|
|
ViewParent t = getParent();
|
|
|
|
@ -1039,6 +1064,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onAttachedToWindow() {
|
|
|
|
protected void onAttachedToWindow() {
|
|
|
|
super.onAttachedToWindow();
|
|
|
|
super.onAttachedToWindow();
|
|
|
|
@ -1062,13 +1088,17 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OnClickListener clickListener;
|
|
|
|
OnClickListener clickListener;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void setOnClickListener(OnClickListener l) {
|
|
|
|
public void setOnClickListener(OnClickListener l) {
|
|
|
|
super.setOnClickListener(l);
|
|
|
|
super.setOnClickListener(l);
|
|
|
|
clickListener = l;
|
|
|
|
clickListener = l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OnLongClickListener longClickListener;
|
|
|
|
OnLongClickListener longClickListener;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void setOnLongClickListener(OnLongClickListener l) {
|
|
|
|
public void setOnLongClickListener(OnLongClickListener l) {
|
|
|
|
super.setOnLongClickListener(l);
|
|
|
|
super.setOnLongClickListener(l);
|
|
|
|
@ -1076,6 +1106,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Rect hitSurfaceRect;
|
|
|
|
private Rect hitSurfaceRect;
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isTouchOnSurface(MotionEvent ev) {
|
|
|
|
private boolean isTouchOnSurface(MotionEvent ev) {
|
|
|
|
View surfaceView = getSurfaceView();
|
|
|
|
View surfaceView = getSurfaceView();
|
|
|
|
if (surfaceView == null) {
|
|
|
|
if (surfaceView == null) {
|
|
|
|
@ -1087,6 +1118,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
surfaceView.getHitRect(hitSurfaceRect);
|
|
|
|
surfaceView.getHitRect(hitSurfaceRect);
|
|
|
|
return hitSurfaceRect.contains((int) ev.getX(), (int) ev.getY());
|
|
|
|
return hitSurfaceRect.contains((int) ev.getX(), (int) ev.getY());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private GestureDetector gestureDetector = new GestureDetector(getContext(), new SwipeDetector());
|
|
|
|
private GestureDetector gestureDetector = new GestureDetector(getContext(), new SwipeDetector());
|
|
|
|
|
|
|
|
|
|
|
|
class SwipeDetector extends GestureDetector.SimpleOnGestureListener {
|
|
|
|
class SwipeDetector extends GestureDetector.SimpleOnGestureListener {
|
|
|
|
@ -1097,6 +1129,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return super.onSingleTapUp(e);
|
|
|
|
return super.onSingleTapUp(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onDoubleTap(MotionEvent e) {
|
|
|
|
public boolean onDoubleTap(MotionEvent e) {
|
|
|
|
if (mDoubleClickListener != null) {
|
|
|
|
if (mDoubleClickListener != null) {
|
|
|
|
@ -1151,13 +1184,17 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
return mShowMode;
|
|
|
|
return mShowMode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**return null if there is no surface view(no children) */
|
|
|
|
/**
|
|
|
|
|
|
|
|
* return null if there is no surface view(no children)
|
|
|
|
|
|
|
|
*/
|
|
|
|
public View getSurfaceView() {
|
|
|
|
public View getSurfaceView() {
|
|
|
|
if (getChildCount() == 0) return null;
|
|
|
|
if (getChildCount() == 0) return null;
|
|
|
|
return getChildAt(getChildCount() - 1);
|
|
|
|
return getChildAt(getChildCount() - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**return null if there is no bottom view */
|
|
|
|
/**
|
|
|
|
|
|
|
|
* return null if there is no bottom view
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Nullable
|
|
|
|
@Nullable
|
|
|
|
public View getCurrentBottomView() {
|
|
|
|
public View getCurrentBottomView() {
|
|
|
|
List<View> bottoms = getBottomViews();
|
|
|
|
List<View> bottoms = getBottomViews();
|
|
|
|
@ -1166,6 +1203,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @return all bottomViews: left, top, right, bottom (may null if the edge is not set)
|
|
|
|
* @return all bottomViews: left, top, right, bottom (may null if the edge is not set)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -1364,6 +1402,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* a helper function to compute the Rect area that surface will hold in.
|
|
|
|
* a helper function to compute the Rect area that surface will hold in.
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param open open status or close status.
|
|
|
|
* @param open open status or close status.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private Rect computeSurfaceLayoutArea(boolean open) {
|
|
|
|
private Rect computeSurfaceLayoutArea(boolean open) {
|
|
|
|
@ -1438,7 +1477,7 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public interface DoubleClickListener {
|
|
|
|
public interface DoubleClickListener {
|
|
|
|
public void onDoubleClick(SwipeLayout layout, boolean surface);
|
|
|
|
void onDoubleClick(SwipeLayout layout, boolean surface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private int dp2px(float dp) {
|
|
|
|
private int dp2px(float dp) {
|
|
|
|
@ -1446,7 +1485,9 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**Deprecated, use {@link #setDrag(DragEdge, View)} */
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Deprecated, use {@link #setDrag(DragEdge, View)}
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
@Deprecated
|
|
|
|
public void setDragEdge(DragEdge dragEdge) {
|
|
|
|
public void setDragEdge(DragEdge dragEdge) {
|
|
|
|
clearDragEdge();
|
|
|
|
clearDragEdge();
|
|
|
|
@ -1463,17 +1504,22 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Map<DragEdge, View> getDragEdgeMap() {
|
|
|
|
public Map<DragEdge, View> getDragEdgeMap() {
|
|
|
|
return mDragEdges;
|
|
|
|
return mDragEdges;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**Deprecated, use {@link #getDragEdgeMap()} */
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Deprecated, use {@link #getDragEdgeMap()}
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
@Deprecated
|
|
|
|
public List<DragEdge> getDragEdges() {
|
|
|
|
public List<DragEdge> getDragEdges() {
|
|
|
|
return new ArrayList<DragEdge>(mDragEdges.keySet());
|
|
|
|
return new ArrayList<DragEdge>(mDragEdges.keySet());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**Deprecated, use {@link #setDrag(DragEdge, View)} */
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Deprecated, use {@link #setDrag(DragEdge, View)}
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
@Deprecated
|
|
|
|
public void setDragEdges(List<DragEdge> dragEdges) {
|
|
|
|
public void setDragEdges(List<DragEdge> dragEdges) {
|
|
|
|
clearDragEdge();
|
|
|
|
clearDragEdge();
|
|
|
|
@ -1488,12 +1534,15 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**Deprecated, use {@link #addDrag(DragEdge, View)} */
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Deprecated, use {@link #addDrag(DragEdge, View)}
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
@Deprecated
|
|
|
|
public void setDragEdges(DragEdge... mDragEdges) {
|
|
|
|
public void setDragEdges(DragEdge... mDragEdges) {
|
|
|
|
clearDragEdge();
|
|
|
|
clearDragEdge();
|
|
|
|
setDragEdges(Arrays.asList(mDragEdges));
|
|
|
|
setDragEdges(Arrays.asList(mDragEdges));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Deprecated, use {@link #addDrag(DragEdge, View)}
|
|
|
|
* Deprecated, use {@link #addDrag(DragEdge, View)}
|
|
|
|
* When using multiple drag edges it's a good idea to pass the ids of the views that
|
|
|
|
* When using multiple drag edges it's a good idea to pass the ids of the views that
|
|
|
|
@ -1522,13 +1571,16 @@ public class SwipeLayout extends FrameLayout {
|
|
|
|
if (currentBottomView != null) {
|
|
|
|
if (currentBottomView != null) {
|
|
|
|
if (mCurrentDragEdge == DragEdge.Left || mCurrentDragEdge == DragEdge.Right) {
|
|
|
|
if (mCurrentDragEdge == DragEdge.Left || mCurrentDragEdge == DragEdge.Right) {
|
|
|
|
mDragDistance = currentBottomView.getMeasuredWidth() - dp2px(getCurrentOffset());
|
|
|
|
mDragDistance = currentBottomView.getMeasuredWidth() - dp2px(getCurrentOffset());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
mDragDistance = currentBottomView.getMeasuredHeight() - dp2px(getCurrentOffset());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else mDragDistance = currentBottomView.getMeasuredHeight() - dp2px(getCurrentOffset());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (mShowMode == ShowMode.PullOut)
|
|
|
|
if (mShowMode == ShowMode.PullOut) {
|
|
|
|
layoutPullOut();
|
|
|
|
layoutPullOut();
|
|
|
|
else if (mShowMode == ShowMode.LayDown) layoutLayDown();
|
|
|
|
} else if (mShowMode == ShowMode.LayDown) {
|
|
|
|
|
|
|
|
layoutLayDown();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
safeBottomView();
|
|
|
|
safeBottomView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|