Aperture: Add KEYCODE_FOCUS/KEYCODE_CAMERA support
Change-Id: I6568f2d9c8445c6aeeb7d8a1e81a170a718e42ff
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index 5762238..cf88fb0 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -437,6 +437,14 @@
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
return when (keyCode) {
+ KeyEvent.KEYCODE_FOCUS -> {
+ if (event?.repeatCount == 1) {
+ viewFinderTouchEvent = null
+ viewFinder.performClick()
+ }
+ true
+ }
+ KeyEvent.KEYCODE_CAMERA,
KeyEvent.KEYCODE_VOLUME_UP,
KeyEvent.KEYCODE_VOLUME_DOWN -> {
if (cameraMode == CameraMode.VIDEO && shutterButton.isEnabled && event?.repeatCount == 1) {
@@ -450,6 +458,7 @@
override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
return when (keyCode) {
+ KeyEvent.KEYCODE_CAMERA,
KeyEvent.KEYCODE_VOLUME_UP,
KeyEvent.KEYCODE_VOLUME_DOWN -> {
if (cameraMode != CameraMode.QR && shutterButton.isEnabled) {