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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user