@Override protected void handleInProgressEvent(int actionCode, MotionEvent event){ switch (actionCode) { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mListener.onMoveEnd(this); resetState(); break; case MotionEvent.ACTION_MOVE: // If the gesture started before this detector was attached (somehow), // mPrevEvent will be null at this point and BaseGestureDetector's // updateStateByEvent() will crash. The following check will prevent this. if (mPrevEvent == null) { return; } updateStateByEvent(event); // Only accept the event if our relative pressure is within // a certain limit. This can help filter shaky data as a // finger is lifted. if (mCurrPressure / mPrevPressure > PRESSURE_THRESHOLD) { final boolean updatePrevious = mListener.onMove(this); if (updatePrevious) { mPrevEvent.recycle(); mPrevEvent = MotionEvent.obtain(event); } } break; } }
@Override protected void handleStartProgressEvent(int actionCode, MotionEvent event){ switch (actionCode) { case MotionEvent.ACTION_DOWN: resetState(); // In case we missed an UP/CANCEL event mPrevEvent = MotionEvent.obtain(event); mTimeDelta = 0; updateStateByEvent(event); break; case MotionEvent.ACTION_MOVE: mGestureInProgress = mListener.onMoveBegin(this); break; } }
@Override protected void handleInProgressEvent(int actionCode, MotionEvent event) { switch (actionCode) { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mListener.onMoveEnd(this); resetState(); break; case MotionEvent.ACTION_MOVE: updateStateByEvent(event); // Only accept the event if our relative pressure is within // a certain limit. This can help filter shaky data as a // finger is lifted. if (mCurrPressure / mPrevPressure > PRESSURE_THRESHOLD) { final boolean updatePrevious = mListener.onMove(this); if (updatePrevious) { mPrevEvent.recycle(); mPrevEvent = MotionEvent.obtain(event); } } break; } }
@Override protected void handleStartProgressEvent(int actionCode, MotionEvent event) { switch (actionCode) { case MotionEvent.ACTION_DOWN: resetState(); // In case we missed an UP/CANCEL event mPrevEvent = MotionEvent.obtain(event); mTimeDelta = 0; updateStateByEvent(event); break; case MotionEvent.ACTION_MOVE: mGestureInProgress = mListener.onMoveBegin(this); break; } }