本文整理匯總了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);
}
}
}
}