avoid launching multiple shutter actions at pressing volumes
This commit is contained in:
parent
d57eb9ef98
commit
d7c4c76640
|
@ -128,7 +128,8 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
||||||
mIsHardwareShutterHandled = true
|
mIsHardwareShutterHandled = true
|
||||||
shutterPressed()
|
shutterPressed()
|
||||||
true
|
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()
|
shutterPressed()
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
|
@ -137,7 +138,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean {
|
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
|
mIsHardwareShutterHandled = false
|
||||||
}
|
}
|
||||||
return super.onKeyUp(keyCode, event)
|
return super.onKeyUp(keyCode, event)
|
||||||
|
|
Loading…
Reference in New Issue