Exemplo n.º 1
0
 private void postLongClickRunnable() {
   myLongClickPerformed = false;
   myPendingPress = false;
   if (myPendingLongClickRunnable == null) {
     myPendingLongClickRunnable = new LongClickRunnable();
   }
   postDelayed(myPendingLongClickRunnable, 2 * ViewConfiguration.getLongPressTimeout());
 }
Exemplo n.º 2
0
 @Override
 public boolean onKeyUp(int keyCode, KeyEvent event) {
   if (myKeyUnderTracking != -1) {
     if (myKeyUnderTracking == keyCode) {
       final boolean longPress =
           System.currentTimeMillis()
               > myTrackingStartTime + ViewConfiguration.getLongPressTimeout();
       ZLApplication.Instance().runActionByKey(keyCode, longPress);
     }
     myKeyUnderTracking = -1;
     return true;
   } else {
     final ZLKeyBindings bindings = ZLApplication.Instance().keyBindings();
     return bindings.hasBinding(keyCode, false) || bindings.hasBinding(keyCode, true);
   }
 }
Exemplo n.º 3
0
 private void sendCancelEvent() {
   if (DEBUG) {
     PtrCLog.d(LOG_TAG, "send cancel event");
   }
   MotionEvent last = mDownEvent;
   last = mLastMoveEvent;
   MotionEvent e =
       MotionEvent.obtain(
           last.getDownTime(),
           last.getEventTime() + ViewConfiguration.getLongPressTimeout(),
           MotionEvent.ACTION_CANCEL,
           last.getX(),
           last.getY(),
           last.getMetaState());
   dispatchTouchEventSupper(e);
 }
Exemplo n.º 4
0
 private void sendCancelEvent() {
   if (DEBUG) {
     PtrCLog.d(LOG_TAG, "send cancel event");
   }
   // The ScrollChecker will update position and lead to send cancel event when mLastMoveEvent is
   // null.
   // fix #104, #80, #92
   if (mLastMoveEvent == null) {
     return;
   }
   MotionEvent last = mLastMoveEvent;
   MotionEvent e =
       MotionEvent.obtain(
           last.getDownTime(),
           last.getEventTime() + ViewConfiguration.getLongPressTimeout(),
           MotionEvent.ACTION_CANCEL,
           last.getX(),
           last.getY(),
           last.getMetaState());
   dispatchTouchEventSupper(e);
 }