本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
}