Search in sources :

Example 1 with RotateGestureDetector

use of org.thoughtcrime.securesms.scribbles.multitouch.RotateGestureDetector 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)

Aggregations

Paint (android.graphics.Paint)1 GestureDetectorCompat (android.support.v4.view.GestureDetectorCompat)1 ScaleGestureDetector (android.view.ScaleGestureDetector)1 EditText (android.widget.EditText)1 MoveGestureDetector (org.thoughtcrime.securesms.scribbles.multitouch.MoveGestureDetector)1 RotateGestureDetector (org.thoughtcrime.securesms.scribbles.multitouch.RotateGestureDetector)1