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());
}
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();
}
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());
}
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;
}
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());
}
Aggregations