Search in sources :

Example 6 with ScaleGestureDetector

use of android.view.ScaleGestureDetector in project TouchImageView by MikeOrtiz.

the class TouchImageView method sharedConstructing.

private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
Also used : Matrix(android.graphics.Matrix) GestureDetector(android.view.GestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector)

Example 7 with ScaleGestureDetector

use of android.view.ScaleGestureDetector in project Signal-Android by WhisperSystems.

the class MotionView method init.

private void init(@NonNull Context context, @Nullable AttributeSet attrs) {
    // I fucking love Android
    setWillNotDraw(false);
    selectedLayerPaint = new Paint();
    selectedLayerPaint.setAlpha((int) (255 * Constants.SELECTED_LAYER_ALPHA));
    selectedLayerPaint.setAntiAlias(true);
    this.editText = new EditText(context, attrs);
    ViewCompat.setAlpha(this.editText, 0);
    this.editText.setLayoutParams(new LayoutParams(1, 1, Gravity.TOP | Gravity.LEFT));
    this.editText.setClickable(false);
    this.editText.setBackgroundColor(Color.TRANSPARENT);
    this.editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 1);
    this.editText.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    this.addView(editText);
    this.editText.clearFocus();
    this.editText.addTextChangedListener(this);
    // init listeners
    this.scaleGestureDetector = new ScaleGestureDetector(context, new ScaleListener());
    this.rotateGestureDetector = new RotateGestureDetector(context, new RotateListener());
    this.moveGestureDetector = new MoveGestureDetector(context, new MoveListener());
    this.gestureDetectorCompat = new GestureDetectorCompat(context, new TapsListener());
    setOnTouchListener(onTouchListener);
    updateUI();
}
Also used : EditText(android.widget.EditText) MoveGestureDetector(org.thoughtcrime.securesms.scribbles.multitouch.MoveGestureDetector) Paint(android.graphics.Paint) ScaleGestureDetector(android.view.ScaleGestureDetector) RotateGestureDetector(org.thoughtcrime.securesms.scribbles.multitouch.RotateGestureDetector) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat)

Example 8 with ScaleGestureDetector

use of android.view.ScaleGestureDetector in project uCrop by Yalantis.

the class GestureCropImageView method setupGestureListeners.

private void setupGestureListeners() {
    mGestureDetector = new GestureDetector(getContext(), new GestureListener(), null, true);
    mScaleDetector = new ScaleGestureDetector(getContext(), new ScaleListener());
    mRotateDetector = new RotationGestureDetector(new RotateListener());
}
Also used : RotationGestureDetector(com.yalantis.ucrop.util.RotationGestureDetector) GestureDetector(android.view.GestureDetector) RotationGestureDetector(com.yalantis.ucrop.util.RotationGestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector)

Example 9 with ScaleGestureDetector

use of android.view.ScaleGestureDetector in project Klyph by jonathangerbaud.

the class ImageViewTouch method init.

@Override
protected void init(Context context, AttributeSet attrs, int defStyle) {
    super.init(context, attrs, defStyle);
    mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
    mGestureListener = getGestureListener();
    mScaleListener = getScaleListener();
    mScaleDetector = new ScaleGestureDetector(getContext(), mScaleListener);
    mGestureDetector = new GestureDetector(getContext(), mGestureListener, null, true);
    mDoubleTapDirection = 1;
}
Also used : GestureDetector(android.view.GestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector)

Example 10 with ScaleGestureDetector

use of android.view.ScaleGestureDetector in project android by owncloud.

the class TouchImageViewCustom method sharedConstructing.

private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());
    matrix = new Matrix();
    prevMatrix = new Matrix();
    m = new float[9];
    normalizedScale = 1;
    if (mScaleType == null) {
        mScaleType = ScaleType.FIT_CENTER;
    }
    minScale = 1;
    maxScale = 3;
    superMinScale = SUPER_MIN_MULTIPLIER * minScale;
    superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);
    setState(State.NONE);
    onDrawReady = false;
    super.setOnTouchListener(new PrivateOnTouchListener());
}
Also used : Matrix(android.graphics.Matrix) GestureDetector(android.view.GestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector) ScaleGestureDetector(android.view.ScaleGestureDetector)

Aggregations

ScaleGestureDetector (android.view.ScaleGestureDetector)46 GestureDetector (android.view.GestureDetector)23 Paint (android.graphics.Paint)8 Matrix (android.graphics.Matrix)7 LayoutInflater (android.view.LayoutInflater)6 WindowManager (android.view.WindowManager)6 MotionEvent (android.view.MotionEvent)5 Point (android.graphics.Point)4 GestureDetectorCompat (android.support.v4.view.GestureDetectorCompat)4 ImageView (android.widget.ImageView)3 SuppressLint (android.annotation.SuppressLint)2 PackageManager (android.content.pm.PackageManager)2 PointF (android.graphics.PointF)2 Rect (android.graphics.Rect)2 View (android.view.View)2 ViewParent (android.view.ViewParent)2 Scroller (android.widget.Scroller)2 Drawable (android.graphics.drawable.Drawable)1 ScaleGestureDetectorCompat (android.support.v4.view.ScaleGestureDetectorCompat)1 FastOutLinearInInterpolator (android.support.v4.view.animation.FastOutLinearInInterpolator)1