Code example for ScaleGestureDetector

Methods: getCurrentSpanX

0
 
	mScaleGestureDetector = new ScaleGestureDetector(
	        context,
		new ScaleGestureDetector.SimpleOnScaleGestureListener() {
		    public boolean onScaleBegin(ScaleGestureDetector d) {
                        Log.i("Ringdroid", "ScaleBegin " + d.getCurrentSpanX());
                        mInitialScaleSpan = Math.abs(d.getCurrentSpanX());
			return true; 
		    } 
		    public boolean onScale(ScaleGestureDetector d) {
                        float scale = Math.abs(d.getCurrentSpanX());
                        Log.i("Ringdroid", "Scale " + (scale - mInitialScaleSpan));
                        if (scale - mInitialScaleSpan > 40) {
                            mListener.waveformZoomIn();
                            mInitialScaleSpan = scale;
                        } 
                        if (scale - mInitialScaleSpan < -40) {
                            mListener.waveformZoomOut();
                            mInitialScaleSpan = scale;
                        } 
			return true;