当前位置: 首页>>代码示例>>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;未经允许,请勿转载。