Android ScaleGestureDetector - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ScaleGestureDetector class.

This code example shows how to use the following methods: getFocusX, getFocusY, getScaleFactor
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getFocusX, getFocusY, getScaleFactor
        private float mLastY;
         
        private class Listener implements ScaleGestureDetector.OnScaleGestureListener {
 
            public boolean onScale(ScaleGestureDetector detector) {
                float scale = detector.getScaleFactor();
                 
                Log.d("ttest", "Scale: " + scale);
                 
                // Limit the scale so our object doesn't get too big or disappear 
                if (mScale * scale > 0.1f) {
                    if (mScale * scale < 10.f) {
                        mScale *= scale;
                    } else { 
                        mScale = 10.f;
                    } 
                } else { 
                    mScale = 0.1f;
                } 
                 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getScaleFactor
    } 
 
    private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
        @Override 
        public boolean onScale(ScaleGestureDetector detector) {
            mRender.onActionScale(detector.getScaleFactor());
            return true; 
        } 
    } 
} 
 
 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isInProgress, onTouchEvent
        } 
    } 
 
    @Override 
    public boolean onTouchEvent(MotionEvent ev) {
        mScaleDetector.onTouchEvent(ev);
 
        boolean ret = false;
        float x = ev.getX();
        float y = ev.getY();
 
        final int action = ev.getAction();
 
        switch (action & MotionEvent.ACTION_MASK) {
        case MotionEvent.ACTION_DOWN: {
            mRender.onActionDown(x, y);
            mActivePointerId = ev.getPointerId(0);
            ret = true;
            break; 
        } 

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getScaleFactor
    } 
 
    private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
        @Override 
        public boolean onScale(ScaleGestureDetector detector) {
            mRender.onActionScale(detector.getScaleFactor());
            return true; 
        } 
    } 
 
    public void onSensorChanged(SensorEvent event) {
        // we received a sensor event. it is a good practice to check 
        // that we received the proper event 
        if (mUseSensor) {
            if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
                // convert the rotation-vector to a 4x4 matrix. the matrix 
                // is interpreted by Open GL as the inverse of the 
                // rotation-vector, which is what we want. 
                SensorManager.getRotationMatrixFromVector(
                        mRotationMatrix , event.values);
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android ScaleGestureDetector Questions & Answers:

Other Android ScaleGestureDetector Examples

34:		int oldMeasuredWidth, oldMeasuredHeight;
35:	
36:		ScaleGestureDetector mScaleDetector;
37:	
38:		Context context;

Read More

See Code Examples for Android ScaleGestureDetector Methods: