Aperture: Don't handle keypresses when capture preview is open

Change-Id: Ida102c9a9572479b66748f9288565828bba75d69
diff --git a/app/src/main/java/org/lineageos/aperture/CameraActivity.kt b/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
index 8545ce1..0217602 100644
--- a/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
@@ -610,7 +610,9 @@
     }
 
     override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
-        return when (keyCode) {
+        return if (capturePreviewLayout.isVisible) {
+            super.onKeyDown(keyCode, event)
+        } else when (keyCode) {
             KeyEvent.KEYCODE_FOCUS -> {
                 if (event?.repeatCount == 1) {
                     viewFinderTouchEvent = null
@@ -631,7 +633,9 @@
     }
 
     override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
-        return when (keyCode) {
+        return if (capturePreviewLayout.isVisible) {
+            super.onKeyUp(keyCode, event)
+        } else when (keyCode) {
             KeyEvent.KEYCODE_CAMERA,
             KeyEvent.KEYCODE_VOLUME_UP,
             KeyEvent.KEYCODE_VOLUME_DOWN -> {