当前位置: 首页>>代码示例>>Java>>正文


Java ViewDragHelper.STATE_DRAGGING属性代码示例

本文整理汇总了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;
}
 
开发者ID:zhouphenix,项目名称:Multi-SwipeToRefreshLayout,代码行数:17,代码来源:SwipeDrawerLayout.java

示例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;
}
 
开发者ID:davidmigloz,项目名称:drag-to-close,代码行数:27,代码来源:DragHelperCallback.java

示例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;
}
 
开发者ID:zhouphenix,项目名称:Multi-SwipeBackLayout,代码行数:26,代码来源:SwipeBackLayout.java

示例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;
}
 
开发者ID:drakeet,项目名称:rebase-android,代码行数:15,代码来源:SwipeBackLayout.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:SwipeBackLayout.java

示例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;
}
 
开发者ID:zhouphenix,项目名称:Multi-SwipeToRefreshLayout,代码行数:39,代码来源:SwipeToRefreshLayout.java

示例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;
}
 
开发者ID:zhouphenix,项目名称:Multi-SwipeToRefreshLayout,代码行数:14,代码来源:OverScrollLayout.java

示例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());
        }
    }
}
 
开发者ID:z-chu,项目名称:FriendBook,代码行数:13,代码来源:BaseActivity.java

示例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;
        }
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:15,代码来源:DragLayout.java

示例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;
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:36,代码来源:SwipeBackLayout.java

示例11: onViewDragStateChanged

@Override
public void onViewDragStateChanged(int state) {
    if (state == ViewDragHelper.STATE_DRAGGING) {
        setStateInternal(STATE_DRAGGING);
    }
}
 
开发者ID:Krupen,项目名称:FabulousFilter,代码行数:6,代码来源:ViewPagerBottomSheetBehavior.java

示例12: onViewDragStateChanged

@Override
public void onViewDragStateChanged(int state) {
  if (state == ViewDragHelper.STATE_DRAGGING) {
    setStateInternal(STATE_DRAGGING);
  }
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:6,代码来源:BottomSheetBehavior.java


注:本文中的android.support.v4.widget.ViewDragHelper.STATE_DRAGGING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。