mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Android: ignore touchscreen by user request (using a hardware key) (#5164)
* android: ignore touchscreen by user request (using a hardware key)
This commit is contained in:
2
base
2
base
Submodule base updated: 6301277ce8...e6c9594186
@@ -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.
|
||||
|
||||
Submodule platform/android/luajit-launcher updated: c82631d29f...788d0f0707
Reference in New Issue
Block a user