Skip to content

Instantly share code, notes, and snippets.

View glumes's full-sized avatar
🎯
Focusing

glumes glumes

🎯
Focusing
View GitHub Profile
@glumes
glumes / AndroidCamera2TouchToFocus.java
Created September 26, 2017 09:01 — forked from royshil/AndroidCamera2TouchToFocus.java
How to implement Touch-to-Focus in Android using Camera2 APIs
//Override in your touch-enabled view (this can be differen than the view you use for displaying the cam preview)
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
final int actionMasked = motionEvent.getActionMasked();
if (actionMasked != MotionEvent.ACTION_DOWN) {
return false;
}
if (mManualFocusEngaged) {
Log.d(TAG, "Manual focus already engaged");
return true;