@@ -30,6 +30,9 @@ public class SwipeLayout extends FrameLayout {
3030 private DragEdge mDragEdge ;
3131 private ShowMode mShowMode ;
3232
33+ private float mHorizontalSwipeOffset ;
34+ private float mVerticalSwipeOffset ;
35+
3336 private List <SwipeListener > mSwipeListeners = new ArrayList <SwipeListener >();
3437 private List <SwipeDenier > mSwipeDeniers = new ArrayList <SwipeDenier >();
3538 private Map <View , ArrayList <OnRevealListener >> mRevealListeners = new HashMap <View , ArrayList <OnRevealListener >>();
@@ -65,6 +68,8 @@ public SwipeLayout(Context context, AttributeSet attrs, int defStyle) {
6568
6669 TypedArray a = context .obtainStyledAttributes (attrs , R .styleable .SwipeLayout );
6770 int ordinal = a .getInt (R .styleable .SwipeLayout_drag_edge , DragEdge .Right .ordinal ());
71+ mHorizontalSwipeOffset =a .getDimension (R .styleable .SwipeLayout_horizontalSwipeOffset ,0 );
72+ mVerticalSwipeOffset =a .getDimension (R .styleable .SwipeLayout_verticalSwipeOffset ,0 );
6873 mDragEdge = DragEdge .values ()[ordinal ];
6974 ordinal = a .getInt (R .styleable .SwipeLayout_show_mode , ShowMode .PullOut .ordinal ());
7075 mShowMode = ShowMode .values ()[ordinal ];
@@ -657,9 +662,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
657662 super .onMeasure (widthMeasureSpec , heightMeasureSpec );
658663
659664 if (mDragEdge == DragEdge .Left || mDragEdge == DragEdge .Right )
660- mDragDistance = getBottomView ().getMeasuredWidth ();
665+ mDragDistance = getBottomView ().getMeasuredWidth ()- dp2px ( mHorizontalSwipeOffset ) ;
661666 else
662- mDragDistance = getBottomView ().getMeasuredHeight ();
667+ mDragDistance = getBottomView ().getMeasuredHeight ()- dp2px ( mVerticalSwipeOffset ) ;
663668 }
664669
665670 private boolean mTouchConsumedByChild = false ;
0 commit comments