@Override public boolean onInterceptTouchEvent(MotionEvent ev) { // Widgets are disabled. This widget is a system one // do not check for longpress events and let the // touch events fall through to the children if (mWidgetsDisabled) { return false; } // Watch for longpress events at this level to make sure // users can always pick up this widget switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: mLongPressHelper.postCheckForLongPress(ev); break; case MotionEvent.ACTION_MOVE: mLongPressHelper.onMove(ev); break; case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mLongPressHelper.cancelLongPress(); break; } // Otherwise continue letting touch events fall through to children return false; }
@Override public boolean onTouchEvent(MotionEvent ev) { // Widgets are disabled. This widget is a system one // do not check for longpress events if (mWidgetsDisabled) { return true; } // Watch for longpress events at this level to make sure // users can always pick up this widget switch (ev.getAction()) { case MotionEvent.ACTION_MOVE: mLongPressHelper.onMove(ev); break; case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mLongPressHelper.cancelLongPress(); break; } // We return true here to ensure that we will get cancel / up signal // even if none of our children have requested touch. return true; }