Java Code Examples for android.support.v4.widget.ViewDragHelper#STATE_DRAGGING

The following examples show how to use android.support.v4.widget.ViewDragHelper#STATE_DRAGGING . 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: OuterLayout.java    From dragqueen with Apache License 2.0 6 votes vote down vote up
@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 2
Source File: DragLayout.java    From TestChat with Apache License 2.0 5 votes vote down vote up
@Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
//                如果符合条件直接截获事件由自己在onTouchEvent方法中处理
//                如果在释放自动滑动的过程中点击,会导致停止动画
                boolean result = mViewDragHelper.shouldInterceptTouchEvent(ev) && mGestureDetector.onTouchEvent(ev);
//                这里是为了防止在滑动的过程中,突然点击,导致被点击的页面停止滑动的的情况发生
                if (!result && mViewDragHelper.getViewDragState() == ViewDragHelper.STATE_DRAGGING && ev.getAction() == MotionEvent.ACTION_UP) {
                        if (getChildAt(2).getLeft() < range / 2) {
                                closeMenu();
                        } else {
                                openMenu();
                        }
                }
                return result;
        }
 
Example 3
Source File: SwipeBackLayout.java    From Readhub with Apache License 2.0 5 votes vote down vote up
@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 4
Source File: SwipeBackLayout.java    From SwipeBack with Apache License 2.0 5 votes vote down vote up
@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 5
Source File: BaseActivity.java    From FriendBook with GNU General Public License v3.0 5 votes vote down vote up
protected void onSlideStateChanged(int state) {
    if(getWindowIsTranslucent()){
        return;
    }
    if (state == ViewDragHelper.STATE_DRAGGING) {
        Drawable windowBackground = getWindowBackground();
        if (windowBackground != null) {
            getWindow().setBackgroundDrawable(windowBackground);
        } else {
            getWindow().setBackgroundDrawable(getDefaultWindowBackground());
        }
    }
}
 
Example 6
Source File: SwipeBackLayout.java    From LLApp with Apache License 2.0 5 votes vote down vote up
@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: SwipeRevealLayout.java    From SwipeRevealLayout with MIT License 5 votes vote down vote up
@Override
public void onViewDragStateChanged(int state) {
    super.onViewDragStateChanged(state);
    final int prevState = mState;

    switch (state) {
        case ViewDragHelper.STATE_DRAGGING:
            mState = STATE_DRAGGING;
            break;

        case ViewDragHelper.STATE_IDLE:

            // drag edge is left or right
            if (mDragEdge == DRAG_EDGE_LEFT || mDragEdge == DRAG_EDGE_RIGHT) {
                if (mMainView.getLeft() == mRectMainClose.left) {
                    mState = STATE_CLOSE;
                } else {
                    mState = STATE_OPEN;
                }
            }

            // drag edge is top or bottom
            else {
                if (mMainView.getTop() == mRectMainClose.top) {
                    mState = STATE_CLOSE;
                } else {
                    mState = STATE_OPEN;
                }
            }
            break;
    }

    if (mDragStateChangeListener != null && !mAborted && prevState != mState) {
        mDragStateChangeListener.onDragStateChanged(mState);
    }
}
 
Example 8
Source File: ViewPagerBottomSheetBehavior.java    From ViewPagerBottomSheet with Apache License 2.0 4 votes vote down vote up
@Override
public void onViewDragStateChanged(int state) {
    if (state == ViewDragHelper.STATE_DRAGGING) {
        setStateInternal(STATE_DRAGGING);
    }
}
 
Example 9
Source File: OuterLayout.java    From dragqueen with Apache License 2.0 4 votes vote down vote up
public boolean isMoving() {
    return (mDraggingState == ViewDragHelper.STATE_DRAGGING ||
            mDraggingState == ViewDragHelper.STATE_SETTLING);
}
 
Example 10
Source File: SheetBehavior.java    From AndroidSweetBehavior with Apache License 2.0 4 votes vote down vote up
@Override
public void onViewDragStateChanged(int state) {
    if (state == ViewDragHelper.STATE_DRAGGING) {
        setStateInternal(STATE_DRAGGING);
    }
}
 
Example 11
Source File: GoogleMapsBottomSheetBehavior.java    From Google-Maps-BottomSheet with The Unlicense 4 votes vote down vote up
@Override
public void onViewDragStateChanged(int state) {
    if (state == ViewDragHelper.STATE_DRAGGING) {
        setStateInternal(STATE_DRAGGING);
    }
}
 
Example 12
Source File: RNBottomSheetBehavior.java    From react-native-bottom-sheet-behavior with MIT License 4 votes vote down vote up
@Override
public void onViewDragStateChanged( int state ) {
  if ( state == ViewDragHelper.STATE_DRAGGING ) {
    setStateInternal( STATE_DRAGGING );
  }
}
 
Example 13
Source File: TopSheetBehavior.java    From AndroidTopSheet with Apache License 2.0 4 votes vote down vote up
@Override
public void onViewDragStateChanged(int state) {
    if (state == ViewDragHelper.STATE_DRAGGING) {
        setStateInternal(STATE_DRAGGING);
    }
}
 
Example 14
Source File: AnchorBottomSheetBehavior.java    From anchor-bottom-sheet-behavior with Apache License 2.0 4 votes vote down vote up
@Override
public void onViewDragStateChanged(int state) {
    if (state == ViewDragHelper.STATE_DRAGGING) {
        setStateInternal(STATE_DRAGGING);
    }
}
 
Example 15
Source File: AnchorSheetBehavior.java    From AnchorSheetBehavior with Apache License 2.0 4 votes vote down vote up
@Override
public void onViewDragStateChanged(int state) {
    if (state == ViewDragHelper.STATE_DRAGGING) {
        setStateInternal(STATE_DRAGGING);
    }
}
 
Example 16
Source File: BottomSheetBehaviorGoogleMapsLike.java    From Nibo with MIT License 4 votes vote down vote up
@Override
public void onViewDragStateChanged(int state) {
    if (state == ViewDragHelper.STATE_DRAGGING) {
        setStateInternal(STATE_DRAGGING);
    }
}
 
Example 17
Source File: BottomSheetBehaviorV2.java    From paper-launcher with MIT License 4 votes vote down vote up
@Override
public void onViewDragStateChanged(int state) {
    if (state == ViewDragHelper.STATE_DRAGGING) {
        setStateInternal(STATE_DRAGGING);
    }
}
 
Example 18
Source File: ViewPagerBottomSheetBehavior.java    From FabulousFilter with Apache License 2.0 4 votes vote down vote up
@Override
public void onViewDragStateChanged(int state) {
    if (state == ViewDragHelper.STATE_DRAGGING) {
        setStateInternal(STATE_DRAGGING);
    }
}