Example usage for android.view ScaleGestureDetector ScaleGestureDetector

List of usage examples for android.view ScaleGestureDetector ScaleGestureDetector

Introduction

In this page you can find the example usage for android.view ScaleGestureDetector ScaleGestureDetector.

Prototype

public ScaleGestureDetector(Context context, OnScaleGestureListener listener) 

Source Link

Document

Creates a ScaleGestureDetector with the supplied listener.

Usage

From source file:MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mImageView = (ImageView) findViewById(R.id.imageView);
    mScaleGestureDetector = new ScaleGestureDetector(this, new ScaleListener());
}

From source file:com.yek.keyboard.devicespecific.AskV8GestureDetector.java

public AskV8GestureDetector(Context context, AskOnGestureListener listener) {
    super(context, listener, null, true/*ignore multi-touch*/);

    mListener = listener;//from  w w  w .  ja va2  s.c  om

    mScaleGestureDetector = new ScaleGestureDetector(context,
            new ScaleGestureDetector.SimpleOnScaleGestureListener() {
                @Override
                public boolean onScale(ScaleGestureDetector detector) {
                    final float factor = detector.getScaleFactor();
                    if (factor > 1.1)
                        return mListener.onSeparate(factor);
                    else if (factor < 0.9)
                        return mListener.onPinch(factor);

                    return false;
                }
            });
}

From source file:com.anysoftkeyboard.devicespecific.AskV8GestureDetector.java

public AskV8GestureDetector(Context context, AskOnGestureListener listener) {
    super(context, listener, null, true/*ignore multi-touch*/);

    mListener = listener;/*from ww w  .  j a  v a 2 s.co m*/

    mScaleGestureDetector = new ScaleGestureDetector(context,
            new ScaleGestureDetector.SimpleOnScaleGestureListener() {
                @Override
                public boolean onScale(ScaleGestureDetector detector) {
                    final float factor = detector.getScaleFactor();
                    Log.d(TAG, "onScale factor " + factor);

                    if (factor > 1.1)
                        return mListener.onSeparate(factor);
                    else if (factor < 0.9)
                        return mListener.onPinch(factor);

                    return false;
                }
            });
}

From source file:com.xgleng.androiddemo.touchscreen.CommonGestures.java

public CommonGestures(Context ctx) {
    mContext = ctx;//from   www .jav a 2  s . co  m
    mTapGestureDetector = new GestureDetectorCompat(mContext, new TapGestureListener());
    mScaleDetector = new ScaleGestureDetector(mContext, new ScaleDetectorListener());
}

From source file:com.anandmuralidhar.assimpandroid.GestureClass.java

public GestureClass(Activity activity) {

    // instantiate two listeners for detecting double-tap/drag and pinch-zoom
    mTapScrollDetector = new GestureDetectorCompat(activity, new MyTapScrollListener());
    mScaleDetector = new ScaleGestureDetector(activity.getApplicationContext(), new ScaleListener());

}

From source file:cn.kylinhuang.play.view.CommonGestures.java

@SuppressLint("NewApi")
public CommonGestures(Activity ctx) {
    mContext = ctx;// ww  w.ja va 2  s .co  m
    mDoubleTapGestureDetector = new GestureDetectorCompat(mContext, new DoubleTapGestureListener());
    mTapGestureDetector = new GestureDetectorCompat(mContext, new TapGestureListener());
    mScaleDetector = new ScaleGestureDetector(mContext, new ScaleDetectorListener());
}

From source file:com.community.yuequ.player.CommonGestures.java

public CommonGestures(Activity ctx) {
    mContext = ctx;/*from   ww w. j  av  a2  s  .  c o m*/
    mDoubleTapGestureDetector = new GestureDetectorCompat(mContext, new DoubleTapGestureListener());
    mTapGestureDetector = new GestureDetectorCompat(mContext, new TapGestureListener());
    mScaleDetector = new ScaleGestureDetector(mContext, new ScaleDetectorListener());
}

From source file:cn.goodjobs.common.view.photodraweeview.ScaleDragDetector.java

public ScaleDragDetector(Context context, OnScaleDragGestureListener scaleDragGestureListener) {
    mScaleDetector = new ScaleGestureDetector(context, this);
    mScaleDragGestureListener = scaleDragGestureListener;

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mTouchSlop = configuration.getScaledTouchSlop();
}

From source file:com.google.android.apps.santatracker.dasherdancer.NoSwipeViewPager.java

public void setGestureDetectorListeners(Context context, OnGestureListener listener,
        OnScaleGestureListener scaleListener) {
    mGestureDetector = new GestureDetector(context, listener);
    mScaleGestureDetector = new ScaleGestureDetector(context, scaleListener);
}

From source file:net.henryco.opalette.api.glES.glSurface.view.OPallSurfaceTouchListener.java

private OPallSurfaceTouchListener setScaleDetector(Context context) {
    this.scaleDetector = new ScaleGestureDetector(context,
            new ScaleGestureDetector.SimpleOnScaleGestureListener() {
                @Override//w  ww  .  ja va 2  s. c  o  m
                public boolean onScale(ScaleGestureDetector detector) {
                    if (onScale != null) {
                        scaled = true;
                        return onScale.apply(detector);
                    }
                    return false;
                }
            });
    return this;
}