Java Code Examples for androidx.customview.widget.ViewDragHelper#EDGE_LEFT
The following examples show how to use
androidx.customview.widget.ViewDragHelper#EDGE_LEFT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DuoDrawerLayout.java From duo-navigation-drawer with Apache License 2.0 | 5 votes |
@Override public void onEdgeDragStarted(int edgeFlags, int pointerId) { mIsEdgeDrag = true; if (tryCaptureView(mContentView, pointerId) && edgeFlags == ViewDragHelper.EDGE_LEFT) { mViewDragHelper.captureChildView(mContentView, pointerId); } }
Example 2
Source File: ViewDragFrame.java From zone-sdk with MIT License | 5 votes |
public void setMoveType(int moveType) { if(moveType!=ViewDragHelper.EDGE_LEFT&&moveType!=ViewDragHelper.EDGE_RIGHT) throw new IllegalArgumentException("参数异常!"); mViewDragHelper.setEdgeTrackingEnabled(moveType); this.moveType = moveType; }
Example 3
Source File: ViewDragFrame.java From zone-sdk with MIT License | 5 votes |
@Override public int clampViewPositionHorizontal(View child, int left, int dx) { int returnValue = 0; //通过条件 控制 在什么范围滑动 if (mMainView == child) { log("left:" + left + "\t dx:" + dx); switch (moveType) { case ViewDragHelper.EDGE_RIGHT: if (left >= -MaxMoveLength && left < 0) { returnValue = left; } else if (left >= 0) { returnValue = 0; } else { returnValue = -MaxMoveLength; } break; case ViewDragHelper.EDGE_LEFT: if (left <= MaxMoveLength && left > 0) { returnValue = left; } else if (left <= 0) { returnValue = 0; } else { returnValue = MaxMoveLength; } break; } } return returnValue; }
Example 4
Source File: ViewDragFrame.java From zone-sdk with MIT License | 5 votes |
public void open() { open = true; switch (moveType) { case ViewDragHelper.EDGE_RIGHT: mViewDragHelper.smoothSlideViewTo(mMainView, -MaxMoveLength, 0); break; case ViewDragHelper.EDGE_LEFT: mViewDragHelper.smoothSlideViewTo(mMainView, MaxMoveLength, 0); break; } ViewCompat.postInvalidateOnAnimation(this);//兼容刷新的 }