avoid launching multiple shutter actions at pressing volumes

This commit is contained in:
tibbi 2018-06-08 14:11:43 +02:00
parent d57eb9ef98
commit d7c4c76640
1 changed files with 3 additions and 2 deletions

View File

@ -128,7 +128,8 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
mIsHardwareShutterHandled = true
shutterPressed()
true
} else if (config.volumeButtonsAsShutter && (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP)) {
} else if (!mIsHardwareShutterHandled && config.volumeButtonsAsShutter && (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP)) {
mIsHardwareShutterHandled = true
shutterPressed()
true
} else {
@ -137,7 +138,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
}
override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean {
if (keyCode == KeyEvent.KEYCODE_CAMERA) {
if (keyCode == KeyEvent.KEYCODE_CAMERA || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
mIsHardwareShutterHandled = false
}
return super.onKeyUp(keyCode, event)