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


Java ViewDragHelper.STATE_SETTLING属性代码示例

本文整理汇总了Java中android.support.v4.widget.ViewDragHelper.STATE_SETTLING属性的典型用法代码示例。如果您正苦于以下问题:Java ViewDragHelper.STATE_SETTLING属性的具体用法?Java ViewDragHelper.STATE_SETTLING怎么用?Java ViewDragHelper.STATE_SETTLING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.support.v4.widget.ViewDragHelper的用法示例。


在下文中一共展示了ViewDragHelper.STATE_SETTLING属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: updateViewByState

/**
 * 根据状态改变view
 *
 * @param anim
 */
private void updateViewByState(boolean anim)
{
    int left = mIsChecked ? getLeftChecked() : getLeftNormal();

    if (mViewThumb.getLeft() != left)
    {
        if (mIsDebug)
        {
            Log.i(TAG, "updateViewByState anim:" + anim);
        }

        if (anim)
        {
            mViewDragHelper.smoothSlideViewTo(mViewThumb, left, mViewThumb.getTop());
        } else
        {
            mViewThumb.layout(left, mViewThumb.getTop(), left + mViewThumb.getMeasuredWidth(), mViewThumb.getBottom());
        }
        invalidate();
    }

    if (mViewDragHelper.getViewDragState() == ViewDragHelper.STATE_SETTLING)
    {
        //触发滚动成功,不需要立即更新view的可见状态,动画结束后更新
        mIsScrollerStarted = true;
    } else
    {
        // 立即更新view的可见状态
        updateViewVisibilityByState();
    }
    mViewThumb.setSelected(mIsChecked);

    if (mOnViewPositionChangedCallback != null)
    {
        mOnViewPositionChangedCallback.onViewPositionChanged(FSwitchButton.this);
    }
}
 
开发者ID:zj565061763,项目名称:switchbutton,代码行数:42,代码来源:FSwitchButton.java

示例9: 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


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