當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。