コード例 #1
0
  private boolean onTouchStart(MotionEvent event) {
    // user is taking control of movement, so stop
    // any auto-movement we have going
    stopAnimationTimer();

    switch (mState) {
      case ANIMATED_ZOOM:
        // We just interrupted a double-tap animation, so force a redraw in
        // case this touchstart is just a tap that doesn't end up triggering
        // a redraw
        mTarget.setForceRedraw();
        // fall through
      case FLING:
      case BOUNCE:
      case NOTHING:
      case WAITING_LISTENERS:
        startTouch(event.getX(0), event.getY(0), event.getEventTime());
        return false;
      case TOUCHING:
      case PANNING:
      case PANNING_LOCKED:
      case PANNING_HOLD:
      case PANNING_HOLD_LOCKED:
      case PINCHING:
        Log.e(LOGTAG, "Received impossible touch down while in " + mState);
        return false;
    }
    Log.e(LOGTAG, "Unhandled case " + mState + " in onTouchStart");
    return false;
  }
コード例 #2
0
  private void finishAnimation() {
    checkMainThread();

    stopAnimationTimer();

    // Force a viewport synchronisation
    mTarget.setForceRedraw();
  }
コード例 #3
0
  @Override
  public void onScaleEnd(SimpleScaleGestureDetector detector) {
    if (mState == PanZoomState.ANIMATED_ZOOM) return;

    // switch back to the touching state
    startTouch(detector.getFocusX(), detector.getFocusY(), detector.getEventTime());

    // Force a viewport synchronisation
    mTarget.setForceRedraw();

    PointF point = new PointF(detector.getFocusX(), detector.getFocusY());
    GeckoEvent event =
        GeckoEvent.createNativeGestureEvent(
            GeckoEvent.ACTION_MAGNIFY_END, point, getMetrics().zoomFactor);

    if (event == null) {
      return;
    }

    GeckoAppShell.sendEventToGecko(event);
  }