本文整理汇总了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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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 ========================
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例13: onViewDragStateChanged
@Override
public void onViewDragStateChanged(int state) {
if (dragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
setDrawerState(drawerState);
slideOffset = getTargetSlideOffset();
requestLayout();
}
}
示例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;
}
}
}
示例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);
}
}
}
}