Android: ignore touchscreen by user request (using a hardware key) (#5164)

* android: ignore touchscreen by user request (using a hardware key)
pull/5172/head
Martín Fernández 5 years ago committed by GitHub
parent ac15143c14
commit 10456169e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit 6301277ce89adf6350a0956444610d5f715598ab
Subproject commit e6c95941869a9c439fd80e785060d777642a159c

@ -14,6 +14,7 @@ return {
[23] = "Press", -- DPAD_CENTER
[24] = "LPgBack", -- VOLUME_UP
[25] = "LPgFwd", -- VOLUME_DOWN
[27] = "Camera", -- CAMERA
[56] = ".", -- PERIOD
[59] = "Shift", -- SHIFT_LEFT
[60] = "Shift", -- SHIFT_RIGHT

@ -322,6 +322,23 @@ function Input:handleKeyBoardEv(ev)
return keycode
end
-- The hardware camera button is used in Android to toggle the touchscreen
if keycode == "Camera" and ev.value == EVENT_VALUE_KEY_RELEASE then
local isAndroid, android = pcall(require, "android")
if isAndroid then
-- toggle touchscreen behaviour
android.toggleTouchscreenIgnored()
-- show a toast with the new behaviour
if android.isTouchscreenIgnored() then
android.notification(_("Touchscreen disabled"))
else
android.notification(_("Touchscreen enabled"))
end
end
return
end
if keycode == "Power" then
-- Kobo generates Power keycode only, we need to decide whether it's
-- power-on or power-off ourselves.

@ -1 +1 @@
Subproject commit c82631d29f0d7e8e87cdd6bad0503369513b320c
Subproject commit 788d0f0707e69fe37699e5fa6a68ef928aee0c7f
Loading…
Cancel
Save