mobile/android/base/gfx/PanZoomController.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/gfx/PanZoomController.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +package org.mozilla.gecko.gfx;
    1.10 +
    1.11 +import org.mozilla.gecko.GeckoAppShell;
    1.12 +import org.mozilla.gecko.EventDispatcher;
    1.13 +
    1.14 +import android.graphics.PointF;
    1.15 +import android.view.KeyEvent;
    1.16 +import android.view.MotionEvent;
    1.17 +import android.view.View;
    1.18 +
    1.19 +public interface PanZoomController {
    1.20 +    // The distance the user has to pan before we recognize it as such (e.g. to avoid 1-pixel pans
    1.21 +    // between the touch-down and touch-up of a click). In units of density-independent pixels.
    1.22 +    public static final float PAN_THRESHOLD = 1/16f * GeckoAppShell.getDpi();
    1.23 +
    1.24 +    // Threshold for sending touch move events to content
    1.25 +    public static final float CLICK_THRESHOLD = 1/50f * GeckoAppShell.getDpi();
    1.26 +
    1.27 +    static class Factory {
    1.28 +        static PanZoomController create(PanZoomTarget target, View view, EventDispatcher dispatcher) {
    1.29 +            return new JavaPanZoomController(target, view, dispatcher);
    1.30 +        }
    1.31 +    }
    1.32 +
    1.33 +    public void destroy();
    1.34 +
    1.35 +    public boolean onTouchEvent(MotionEvent event);
    1.36 +    public boolean onMotionEvent(MotionEvent event);
    1.37 +    public boolean onKeyEvent(KeyEvent event);
    1.38 +    public void notifyDefaultActionPrevented(boolean prevented);
    1.39 +
    1.40 +    public boolean getRedrawHint();
    1.41 +    public PointF getVelocityVector();
    1.42 +
    1.43 +    public void pageRectUpdated();
    1.44 +    public void abortPanning();
    1.45 +    public void abortAnimation();
    1.46 +
    1.47 +    public void setOverScrollMode(int overscrollMode);
    1.48 +    public int getOverScrollMode();
    1.49 +
    1.50 +    public void setOverscrollHandler(final Overscroll controller);
    1.51 +}

mercurial