Java 类android.view.ScaleGestureDetector.OnScaleGestureListener 实例源码

项目:ZoomableView    文件:ScaleHandler.java   
public ScaleHandlerFroyo(Context c, ScaleListener listener) {
    mScaleListener = listener;
    mScaleDetector = new android.view.ScaleGestureDetector(c, new OnScaleGestureListener() {

        @Override
        public void onScaleEnd(ScaleGestureDetector detector) {
            mScaleListener.onScaleEnd(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY());
        }

        @Override
        public boolean onScaleBegin(ScaleGestureDetector detector) {
            return mScaleListener.onScaleBegin(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY());
        }

        @Override
        public boolean onScale(ScaleGestureDetector detector) {
            return mScaleListener.onScale(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY());
        }
    });
}
项目:exciting-app    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:MontageCam    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:ForeverLibrary    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:TAG    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:PictureBeautify    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:TheSceneryAlong    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:OSBuild    文件:ReaderActivity.java   
private void init()
{
    sharedPreferences = getSharedPreferences(getPackageName(), MODE_PRIVATE);

    mtv_reader = (MyTextView) findViewById(R.id.mtv_reader);

    scaled_density = getResources().getDisplayMetrics().scaledDensity;
    text_size_dp_default = mtv_reader.getTextSize() / scaled_density;

    mtv_reader.setTextSize(text_size_dp_default +
        sharedPreferences.getFloat("reader_text_size_dp_extra", 0.0f));

    scaleGestureDetector = new ScaleGestureDetector(this, new OnScaleGestureListener()
    {
        @Override
        public boolean onScale(ScaleGestureDetector p1)
        {
            return false;
        }

        @Override
        public boolean onScaleBegin(ScaleGestureDetector p1)
        {
            return true;
        }

        @Override
        public void onScaleEnd(ScaleGestureDetector p1)
        {
            final float SCALE_FACTOR = p1.getScaleFactor();
            if (SCALE_FACTOR >= 0.8f && SCALE_FACTOR <= 1.2f)
            {
                return;
            }

            final float OLD_TEXT_SIZE_DP = mtv_reader.getTextSize() / scaled_density;
            if (OLD_TEXT_SIZE_DP <= text_size_dp_default - 4.0f && SCALE_FACTOR <= 1.0f)
            {
                return;
            }
            if (OLD_TEXT_SIZE_DP >= text_size_dp_default + 4.0f && SCALE_FACTOR > 1.0f)
            {
                return;
            }

            final float NEW_TEXT_SIZE_DP = SCALE_FACTOR > 1.0f ? (OLD_TEXT_SIZE_DP + 4.0f)
                : (OLD_TEXT_SIZE_DP - 4.0f);

            //Unit: dp
            sharedPreferences.edit().putFloat("reader_text_size_dp_extra",
                NEW_TEXT_SIZE_DP - text_size_dp_default).commit();
            mtv_reader.setTextSize(NEW_TEXT_SIZE_DP);
        }
    });

    mtv_reader.setOnTouchListener(new OnTouchListener()
    {
        @Override
        public boolean onTouch(View p1, MotionEvent p2)
        {
            switch (p2.getPointerCount())
            {
                case 2:
                {
                    //Disallow HorizontalScrollView to intercept touch events.
                    p1.getParent().requestDisallowInterceptTouchEvent(true);
                    //Disallow ScrollView to intercept touch events.
                    p1.getParent().getParent().requestDisallowInterceptTouchEvent(true);
                    return scaleGestureDetector.onTouchEvent(p2);
                }
                default:
                    return false;
            }
        }
    });
}
项目:DoubanOnline    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:JadeHS-Navigator    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:itmarry    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:Klyph    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:silent-text-android    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:NeXT_pyp    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:NeXT_pyp    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:NeXT_pyp    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:ImageViewZoom    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:android-blur    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:BeeFramework_Android    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}
项目:Qmusic    文件:ImageViewTouch.java   
protected OnScaleGestureListener getScaleListener() {
    return new ScaleListener();
}