use of android.view.GestureDetector in project android-vision by googlesamples.
the class OcrCaptureActivity method onCreate.
/**
* Initializes the UI and creates the detector pipeline.
*/
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.ocr_capture);
mPreview = (CameraSourcePreview) findViewById(R.id.preview);
mGraphicOverlay = (GraphicOverlay<OcrGraphic>) findViewById(R.id.graphicOverlay);
// read parameters from the intent used to launch the activity.
boolean autoFocus = getIntent().getBooleanExtra(AutoFocus, false);
boolean useFlash = getIntent().getBooleanExtra(UseFlash, false);
// Check for the camera permission before accessing the camera. If the
// permission is not granted yet, request permission.
int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
if (rc == PackageManager.PERMISSION_GRANTED) {
createCameraSource(autoFocus, useFlash);
} else {
requestCameraPermission();
}
gestureDetector = new GestureDetector(this, new CaptureGestureListener());
scaleGestureDetector = new ScaleGestureDetector(this, new ScaleListener());
Snackbar.make(mGraphicOverlay, "Tap to capture. Pinch/Stretch to zoom", Snackbar.LENGTH_LONG).show();
}
use of android.view.GestureDetector in project android-app-common-tasks by multidots.
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.GestureDetector in project MultiPhotoPicker by wangeason.
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.GestureDetector in project wire-android by wireapp.
the class TouchImageView method sharedConstructing.
private void sharedConstructing(Context context) {
super.setClickable(true);
this.context = context;
scaleDetector = new ScaleGestureDetector(context, new ScaleListener());
gestureDetector = new GestureDetector(context, new GestureListener());
matrix = new Matrix();
prevMatrix = new Matrix();
m = new float[9];
normalizedScale = 1;
if (scaleType == null) {
scaleType = 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.GestureDetector in project diary by billthefarmer.
the class Diary method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textView = (EditText) findViewById(R.id.text);
scrollView = (ScrollView) findViewById(R.id.scroll);
markdownView = (MarkdownView) findViewById(R.id.markdown);
accept = findViewById(R.id.accept);
edit = findViewById(R.id.edit);
WebSettings settings = markdownView.getSettings();
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);
setListeners();
gestureDetector = new GestureDetector(this, new GestureListener());
if (savedInstanceState == null)
today();
else {
setDate(new GregorianCalendar((Integer) savedInstanceState.get(YEAR), (Integer) savedInstanceState.get(MONTH), (Integer) savedInstanceState.get(DAY)));
shown = (Boolean) savedInstanceState.get(SHOWN);
}
// Copy help text to today's page if no entries
if (prevEntry == null && nextEntry == null && textView.length() == 0)
textView.setText(getHelp());
}
Aggregations