當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewDragHelper.STATE_IDLE屬性代碼示例

本文整理匯總了Java中android.support.v4.widget.ViewDragHelper.STATE_IDLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java ViewDragHelper.STATE_IDLE屬性的具體用法?Java ViewDragHelper.STATE_IDLE怎麽用?Java ViewDragHelper.STATE_IDLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.support.v4.widget.ViewDragHelper的用法示例。


在下文中一共展示了ViewDragHelper.STATE_IDLE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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

@Override
public void onViewDragStateChanged(int state) {
  int anchoredTop = (int)(mAnchorPoint*mSlideRange);

  if (mDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
    if (mSlideOffset == 0) {
      if (mSlideState != SlideState.EXPANDED) {
        updateObscuredViewVisibility();
        dispatchOnPanelExpanded(mSlideableView);
        mSlideState = SlideState.EXPANDED;
      }
    } else if (mSlideOffset == (float)anchoredTop/(float)mSlideRange) {
      if (mSlideState != SlideState.ANCHORED) {
        updateObscuredViewVisibility();
        dispatchOnPanelAnchored(mSlideableView);
        mSlideState = SlideState.ANCHORED;
      }
    } else if (mSlideState != SlideState.COLLAPSED) {
      dispatchOnPanelCollapsed(mSlideableView);
      mSlideState = SlideState.COLLAPSED;
    }
  }
}
 
開發者ID:Elias33,項目名稱:Quran,代碼行數:23,代碼來源:SlidingUpPanelLayout.java

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

示例4: tryCaptureView

@Override
public boolean tryCaptureView(View child, int pointerId) {
    isCaptureAbort = false;
    if (!enableSwipeBack) {
        return false;
    }
    if (child == null || child.getLeft() != 0 || child.getTranslationX() != 0f ||
            mViewDragState != ViewDragHelper.STATE_IDLE) {
        return false;
    }
    mIsLeftEdge = mDragHelper.isEdgeTouched(ViewDragHelper.EDGE_LEFT, pointerId);
    mTargetView = child;
    if (mIsLeftEdge || isForceIntercept()) {
        return canTryCaptureView(child);
    }
    return false;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:17,代碼來源:SwipeBackLayout.java

示例5: onViewDragStateChanged

@Override
        public void onViewDragStateChanged(int state) {
            if (mDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
                if (mSlideOffset == 0) {
                    updateObscuredViewsVisibility(mSlideableView);
                    dispatchOnPanelClosed(mSlideableView);
                    mPreservedOpenState = false;
                } else {
                    dispatchOnPanelOpened(mSlideableView);
                    mPreservedOpenState = true;
                }
                // ======================== 新加的 START ========================
//            }
                mIsSliding = false;
            } else {
                mIsSliding = true;
            }
            // ======================== 新加的 END ========================
        }
 
開發者ID:zhudongya123,項目名稱:WechatChatroomHelper,代碼行數:19,代碼來源:BGASwipeBackLayout.java

示例6: getTopLayoutFooterView

private int getTopLayoutFooterView()
{
    // 初始值
    int top = getTopFooterViewReset();

    if (getDirection() == Direction.FROM_FOOTER)
    {
        if (mViewDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE)
        {
            switch (mState)
            {
                case REFRESHING:
                case REFRESH_SUCCESS:
                case REFRESH_FAILURE:
                    top -= mFooterView.getRefreshHeight();
                    break;
            }
        } else
        {
            top = mFooterView.getTop();
        }
    }
    return top;
}
 
開發者ID:zj565061763,項目名稱:pulltorefresh,代碼行數:24,代碼來源:FPullToRefreshView.java

示例7: onViewDragStateChanged

@Override
public void onViewDragStateChanged(int state) {
    if (dragState == ViewDragHelper.STATE_IDLE && state != ViewDragHelper.STATE_IDLE) {
        notifyDragStart();
    } else if (dragState != ViewDragHelper.STATE_IDLE && state == ViewDragHelper.STATE_IDLE) {
        isMenuHidden = calculateIsMenuHidden();
        notifyDragEnd(isMenuOpened());
    }
    dragState = state;
}
 
開發者ID:yarolegovich,項目名稱:SlidingRootNav,代碼行數:10,代碼來源:SlidingRootNavLayout.java

示例8: drawChild

@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
    final boolean drawContent = child == mContentView;
    // 繪製子控件
    boolean ret = super.drawChild(canvas, child, drawingTime);
    if (mScrimOpacity > 0 && drawContent
            && mDragHelper.getViewDragState() != ViewDragHelper.STATE_IDLE) {
        // 根據拖拽狀態來繪製陰影和遮罩
        _drawShadow(canvas, child);
        _drawScrim(canvas, child);
    }
    return ret;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:SwipeBackLayout.java

示例9: drawChild

@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
    final boolean drawContent = child == mContentView;

    boolean ret = super.drawChild(canvas, child, drawingTime);
    if (mScrimOpacity > 0 && drawContent
            && mDragHelper.getViewDragState() != ViewDragHelper.STATE_IDLE) {
        drawShadow(canvas, child);
        drawScrim(canvas, child);
    }
    return ret;
}
 
開發者ID:QMUI,項目名稱:QMUI_Android,代碼行數:12,代碼來源:SwipeBackLayout.java

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

示例11: canTryCaptureView

/**
     * 滑動返回處理
     */
    @Override
    protected boolean canTryCaptureView(View child) {
        if (!isMainLayout()) {
            return false;
        }

        if (isBackPress ||
                mLastShowViewPattern == null ||
                mLastShowViewPattern.interrupt ||
                mLastShowViewPattern.isAnimToStart ||
                isFinishing ||
                mViewDragState != ViewDragHelper.STATE_IDLE ||
                needDragClose) {
//            if (mLastShowViewPattern != null) {
//                checkInterruptAndRemove(mLastShowViewPattern.mIView);
//            }
            return false;
        }

        if (getScreenOrientation() != Configuration.ORIENTATION_PORTRAIT) {
            //非豎屏, 禁用滑動返回
            return false;
        }

        if (getAttachViewSize() > 1) {
            if (/*!mLastShowViewPattern.mIView.isDialog()//最前的不是對話框
                    &&*/ mLastShowViewPattern.mIView.canTryCaptureView()//激活滑動關閉
                    && mLastShowViewPattern.mView == child) {
                hideSoftInput();
                return true;
            } else {
                return false;
            }
        } else if (enableRootSwipe) {
            hideSoftInput();
            return true;
        }
        return false;
    }
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:42,代碼來源:UILayoutImpl.java

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

示例13: onViewDragStateChanged

@Override
public void onViewDragStateChanged(int state) {
  if (dragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
    setDrawerState(drawerState);
    slideOffset = getTargetSlideOffset();
    requestLayout();
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:8,代碼來源:QuickAttachmentDrawer.java

示例14: onViewDragStateChanged

@Override
public void onViewDragStateChanged(int state) {
    if (mDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
        if (mSlideOffset == 0) {
            updateObscuredViewsVisibility(mSlideableView);
            dispatchOnPanelClosed(mSlideableView);
            mPreservedOpenState = false;
        } else {
            dispatchOnPanelOpened(mSlideableView);
            mPreservedOpenState = true;
        }
    }
}
 
開發者ID:Jusenr,項目名稱:RX_Demo,代碼行數:13,代碼來源:ResideLayout.java

示例15: onViewDragStateChanged

@Override
public void onViewDragStateChanged(int state) {
    if (mDragHelper == null)
        return;

    if (mDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
        mSlidedProgress = computeSlidedProgress(mSlidingUpPanel.getPanelView().getTop());

        if (mSlidedProgress == 1) {
            if (mSlidingUpPanel.getSlideState() != EXPANDED) {
                mSlidingUpPanel.setSlideState(EXPANDED);
                if (mPanelSlideListener != null) {
                    mPanelSlideListener.onPanelExpanded(mSlidingUpPanel);
                }
            }
        } else if (mSlidedProgress == 0) {
            if (mSlidingUpPanel.getSlideState() != COLLAPSED) {
                mSlidingUpPanel.setSlideState(COLLAPSED);
                if (mPanelSlideListener != null) {
                    mPanelSlideListener.onPanelCollapsed(mSlidingUpPanel);
                }
            }
        } else if (mSlidedProgress < 0) {
            mSlidingUpPanel.setSlideState(HIDDEN);
            if (mPanelSlideListener != null) {
                mPanelSlideListener.onPanelHidden(mSlidingUpPanel);
            }
        }
    }
}
 
開發者ID:woxingxiao,項目名稱:SlidingUpPanelLayout,代碼行數:30,代碼來源:SlidingUpPanelLayout.java


注:本文中的android.support.v4.widget.ViewDragHelper.STATE_IDLE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。