本文整理汇总了Java中android.support.v4.widget.ViewDragHelper.STATE_DRAGGING属性的典型用法代码示例。如果您正苦于以下问题:Java ViewDragHelper.STATE_DRAGGING属性的具体用法?Java ViewDragHelper.STATE_DRAGGING怎么用?Java ViewDragHelper.STATE_DRAGGING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v4.widget.ViewDragHelper
的用法示例。
在下文中一共展示了ViewDragHelper.STATE_DRAGGING属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewDragStateChanged
@Override
public void onViewDragStateChanged(final int state) {
super.onViewDragStateChanged(state);
Log.e("zhou", "==============onViewDragStateChanged==================" + state);
if (mLastDragState == ViewDragHelper.STATE_SETTLING && state == ViewDragHelper.STATE_DRAGGING && mLockDirection == NONE) {
if (mViewDragHelper.smoothSlideViewTo(mContentView, mOriginX, mOriginY)) {
ViewCompat.postInvalidateOnAnimation(SwipeDrawerLayout.this);
}
}
if (state == ViewDragHelper.STATE_IDLE) {
mCurrentDirection = NONE;
if (mContentView.getLeft() == mOriginX && mContentView.getTop() == mOriginY) mLockDirection = NONE;
Log.e("zhou", "==onViewDragStateChanged===mLockDirection====" + mLockDirection);
Log.i("zhou", "***************************END*********************************************");
}
mLastDragState = state;
}
示例2: onViewDragStateChanged
/**
* Checks dragging states and notifies them.
*/
@Override
public void onViewDragStateChanged(int state) {
// If no state change, don't do anything
if (state == lastDraggingState) {
return;
}
// If last state was dragging or settling and current state is idle,
// the view has stopped moving. If the top border of the container is
// equal to the vertical draggable range, the view has being dragged out,
// so close activity is called
if ((lastDraggingState == ViewDragHelper.STATE_DRAGGING
|| lastDraggingState == ViewDragHelper.STATE_SETTLING)
&& state == ViewDragHelper.STATE_IDLE
&& topBorderDraggableContainer == dragToClose.getDraggableRange()) {
dragToClose.closeActivity();
}
// If the view has just started being dragged, notify event
if (state == ViewDragHelper.STATE_DRAGGING) {
dragToClose.onStartDraggingView();
}
// Save current state
lastDraggingState = state;
}
示例3: onViewDragStateChanged
@Override
public void onViewDragStateChanged(int state) {
super.onViewDragStateChanged(state);
/***
* 【用户体验问题】
* 处理当状态从ViewDragHelper.STATE_SETTLING --> STATE_DRAGGING --> STATE_IDLE 这样一个过程时,造成拖拽的View动画强制结束,未回到指定位置
* 【问题重现】
* 拖拽释放,当View还处在STATE_SETTLING状态时,快速点击View,造成state变换如上面描述过程,并停在该位置
*/
if (mLastDragState == ViewDragHelper.STATE_SETTLING && state == ViewDragHelper.STATE_DRAGGING) {
if (mViewDragHelper.smoothSlideViewTo(mContentView, mOriginalX, mOriginalY)) {
ViewCompat.postInvalidateOnAnimation(SwipeBackLayout.this);
}
}
if ((mLastDragState == ViewDragHelper.STATE_DRAGGING || mLastDragState == ViewDragHelper.STATE_SETTLING)
&& state == ViewDragHelper.STATE_IDLE) {
if (null != mOnSwipeBackCallback && (mContentView.getLeft() != mOriginalX || mContentView.getTop() != mOriginalY )){
mOnSwipeBackCallback.onAnimationEnd();
}
}
if (state == ViewDragHelper.STATE_IDLE) mCurDragDirection = NONE;
Log.e("zhou","------onViewDragStateChanged----------"+state);
mLastDragState = state;
}
示例4: onViewDragStateChanged
@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;
}
示例5: onViewDragStateChanged
@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;
}
示例6: onViewDragStateChanged
@Override
public void onViewDragStateChanged(final int state) {
super.onViewDragStateChanged(state);
Log.e("zhou", "==============onViewDragStateChanged==================" + state);
if (mLastDragState == ViewDragHelper.STATE_SETTLING && state == ViewDragHelper.STATE_DRAGGING && mLockDirection == NONE) {
if (mViewDragHelper.smoothSlideViewTo(mContentView, mOriginX, mOriginY)) {
ViewCompat.postInvalidateOnAnimation(SwipeToRefreshLayout.this);
}
}
switch (state) {
case ViewDragHelper.STATE_DRAGGING:
if (!(mState == COMPLETED || mState == LOADING)) {
changeState(DRAGGING);
}
break;
case ViewDragHelper.STATE_IDLE:
if (mState != LOADING){
if (COMPLETED == mState && mViewDragHelper.smoothSlideViewTo(mContentView, mOriginX, mOriginY)){
ViewCompat.postInvalidateOnAnimation(SwipeToRefreshLayout.this);
}else{
changeState(
mContentView.getTop() != mOriginY || mContentView.getLeft() != mOriginX ?
LOADING : IDLE);
}
}
mCurrentDirection = NONE;
if (mState != LOADING && mContentView.getLeft() == mOriginX && mContentView.getTop() == mOriginY)
mLockDirection = NONE;
Log.e("zhou", "==onViewDragStateChanged===mLockDirection====" + mLockDirection);
Log.i("zhou", "***************************END*********************************************");
break;
case ViewDragHelper.STATE_SETTLING:
if (!(mState == COMPLETED || mState == LOADING))changeState(SETTLING);
break;
}
mLastDragState = state;
}
示例7: onViewDragStateChanged
@Override
public void onViewDragStateChanged(int state) {
super.onViewDragStateChanged(state);
if (mLastDragState == ViewDragHelper.STATE_SETTLING && state == ViewDragHelper.STATE_DRAGGING) {
if (mViewDragHelper.smoothSlideViewTo(mContentView, mOriginX, mOriginY)) {
ViewCompat.postInvalidateOnAnimation(OverScrollLayout.this);
}
}
if (state == ViewDragHelper.STATE_IDLE) {
mCurrentDirection = NONE;
}
Log.e("zhou","==============onViewDragStateChanged=================="+state);
mLastDragState = state;
}
示例8: onSlideStateChanged
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());
}
}
}
示例9: onInterceptTouchEvent
@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;
}
示例10: onViewDragStateChanged
@Override
public void onViewDragStateChanged(int state) {
super.onViewDragStateChanged(state);
if (mListener != null) mListener.onStateChanged(state);
SwipeBackLayout.this.onViewDragStateChanged(state);
switch (state) {
case ViewDragHelper.STATE_IDLE:
onStateIdle();
if (isCaptureAbort) {
onRequestOpened();
} else {
//滚动结束
if (mTargetView.getLeft() < getMinCloseWidth()) {
// State Open
onRequestOpened();
if (mListener != null) mListener.onRequestOpened();
} else {
// State Closed
onRequestClose();
if (mListener != null) mListener.onRequestClose();
}
mTargetView = null;
}
isCaptureAbort = false;
break;
case ViewDragHelper.STATE_DRAGGING:
//开始滚动
onStateDragging();
break;
case ViewDragHelper.STATE_SETTLING:
//滑行中...
break;
}
}
示例11: onViewDragStateChanged
@Override
public void onViewDragStateChanged(int state) {
if (state == ViewDragHelper.STATE_DRAGGING) {
setStateInternal(STATE_DRAGGING);
}
}
示例12: onViewDragStateChanged
@Override
public void onViewDragStateChanged(int state) {
if (state == ViewDragHelper.STATE_DRAGGING) {
setStateInternal(STATE_DRAGGING);
}
}