@Override public boolean handleMoveTouchEvent(MotionEvent event) { final View view = mViewAdapter.getView(); if (!mMoveAttr.init(view, event)) { return false; } // Has over-scrolling officially started? if ((mViewAdapter.isInAbsoluteStart() && mMoveAttr.mDir) || (mViewAdapter.isInAbsoluteEnd() && !mMoveAttr.mDir)) { // Save initial over-scroll attributes for future reference. mStartAttr.mPointerId = event.getPointerId(0); mStartAttr.mAbsOffset = mMoveAttr.mAbsOffset; mStartAttr.mDir = mMoveAttr.mDir; issueStateTransition(mOverScrollingState); return mOverScrollingState.handleMoveTouchEvent(event); } return false; }
@Override public void handleEntryTransition(IDecoratorState fromState) { mCurrDragState = (mStartAttr.mDir ? STATE_DRAG_START_SIDE : STATE_DRAG_END_SIDE); mStateListener.onOverScrollStateChange(OverScrollBounceEffectDecoratorBase.this, fromState.getStateId(), this.getStateId()); } }
public OverScrollBounceEffectDecoratorBase(IOverScrollDecoratorAdapter viewAdapter, float decelerateFactor, float touchDragRatioFwd, float touchDragRatioBck) { mViewAdapter = viewAdapter; mBounceBackState = new BounceBackState(decelerateFactor); mOverScrollingState = new OverScrollingState(touchDragRatioFwd, touchDragRatioBck); mIdleState = new IdleState(); mCurrentState = mIdleState; attach(); }