Java Code Examples for android.support.v4.widget.ViewDragHelper#STATE_SETTLING
The following examples show how to use
android.support.v4.widget.ViewDragHelper#STATE_SETTLING .
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: SwipeRevealLayout.java From SwipeRevealLayoutExample with MIT License | 6 votes |
@Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (isDragLocked()) { return super.onInterceptTouchEvent(ev); } mDragHelper.processTouchEvent(ev); mGestureDetector.onTouchEvent(ev); accumulateDragDist(ev); boolean couldBecomeClick = couldBecomeClick(ev); boolean settling = mDragHelper.getViewDragState() == ViewDragHelper.STATE_SETTLING; boolean idleAfterScrolled = mDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE && mIsScrolling; // must be placed as the last statement mPrevX = ev.getX(); // return true => intercept, cannot trigger onClick event return !couldBecomeClick && (settling || idleAfterScrolled); }
Example 2
Source File: SwipeRevealLayout.java From SwipeRevealLayout with MIT License | 6 votes |
@Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (isDragLocked()) { return super.onInterceptTouchEvent(ev); } mDragHelper.processTouchEvent(ev); mGestureDetector.onTouchEvent(ev); accumulateDragDist(ev); boolean couldBecomeClick = couldBecomeClick(ev); boolean settling = mDragHelper.getViewDragState() == ViewDragHelper.STATE_SETTLING; boolean idleAfterScrolled = mDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE && mIsScrolling; // must be placed as the last statement mPrevX = ev.getX(); mPrevY = ev.getY(); // return true => intercept, cannot trigger onClick event return !couldBecomeClick && (settling || idleAfterScrolled); }
Example 3
Source File: OuterLayout.java From dragqueen with Apache License 2.0 | 6 votes |
@Override public void onViewDragStateChanged(int state) { if (state == mDraggingState) { // no change return; } if ((mDraggingState == ViewDragHelper.STATE_DRAGGING || mDraggingState == ViewDragHelper.STATE_SETTLING) && state == ViewDragHelper.STATE_IDLE) { // the view stopped from moving. if (mDraggingBorder == 0) { onStopDraggingToClosed(); } else if (mDraggingBorder == mVerticalRange) { mIsOpen = true; } } if (state == ViewDragHelper.STATE_DRAGGING) { onStartDragging(); } mDraggingState = state; }
Example 4
Source File: MonthWeekMaterialCalendarView.java From monthweekmaterialcalendarview with Apache License 2.0 | 5 votes |
public void setMode(Mode mode) { if (mDragHelper.getViewDragState() == ViewDragHelper.STATE_SETTLING) { return; } //如果点击了月模式并且当前模式不是月模式的话 if (mode.equals(Mode.MONTH)) { // 月模式切月模式 if (currentMode.equals(Mode.MONTH)) { isModeChange = false; } //周模式切月模式 if (currentMode.equals(Mode.WEEK)) { isModeChange = true; } setWeek2MonthMode(); return; } if (mode.equals(Mode.WEEK)) { //周模式切周模式 if (currentMode.equals(Mode.WEEK)) { isModeChange = false; } //月模式切周模式 if (currentMode.equals(Mode.MONTH)) { isModeChange = true; } setMonth2WeekMode(); } }
Example 5
Source File: SwipeBackLayout.java From Readhub with Apache License 2.0 | 5 votes |
@Override public void onViewDragStateChanged(int state) { if (state == draggingState) return; if ((draggingState == ViewDragHelper.STATE_DRAGGING || draggingState == ViewDragHelper.STATE_SETTLING) && state == ViewDragHelper.STATE_IDLE) { // the view stopped from moving. if (draggingOffset == getDragRange()) { finish(); } } draggingState = state; }
Example 6
Source File: SwipeBackLayout.java From LLApp with Apache License 2.0 | 5 votes |
@Override public void onViewDragStateChanged(int state) { if (state == draggingState) return; if ((draggingState == ViewDragHelper.STATE_DRAGGING || draggingState == ViewDragHelper.STATE_SETTLING) && state == ViewDragHelper.STATE_IDLE) { // the view stopped from moving. if (draggingOffset == getDragRange()) { finish(); } } draggingState = state; }
Example 7
Source File: SwipeBackLayout.java From SwipeBack with Apache License 2.0 | 5 votes |
@Override public void onViewDragStateChanged(int state) { if (state == draggingState) return; if ((draggingState == ViewDragHelper.STATE_DRAGGING || draggingState == ViewDragHelper.STATE_SETTLING) && state == ViewDragHelper.STATE_IDLE) { // the view stopped from moving. if (draggingOffset == getDragRange()) { onFinishListener.onFinishState(); } } draggingState = state; }
Example 8
Source File: OuterLayout.java From dragqueen with Apache License 2.0 | 4 votes |
public boolean isMoving() { return (mDraggingState == ViewDragHelper.STATE_DRAGGING || mDraggingState == ViewDragHelper.STATE_SETTLING); }