Skip to content

Commit

Permalink
Fix broken back button press
Browse files Browse the repository at this point in the history
  • Loading branch information
t895 authored and thestinger committed Jan 6, 2025
1 parent 11cff0e commit f6520dd
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,6 @@ open class MainActivity : AppCompatActivity(),
}

override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK) {
finish()
return true
}

// there are no camera controls in qr mode
if (camConfig.isQRMode) {
return super.onKeyUp(keyCode, event)
Expand All @@ -535,15 +530,15 @@ open class MainActivity : AppCompatActivity(),
cameraControl.zoomOut()
}
}
return true
return super.onKeyUp(keyCode, event)
}

override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
// Pretend as if the event was handled by the app (avoid volume bar from appearing)
return true
}
return super.onKeyUp(keyCode, event)
return super.onKeyDown(keyCode, event)
}

override fun onResume() {
Expand Down

0 comments on commit f6520dd

Please sign in to comment.