mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
ReaderGesture: cleanup (#6292)
convert all gesture actions to use events for better modularity add network event handlers and device event handlers
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
local BD = require("ui/bidi")
|
||||
local ConfirmBox = require("ui/widget/confirmbox")
|
||||
local Device = require("device")
|
||||
local Event = require("ui/event")
|
||||
local InfoMessage = require("ui/widget/infomessage")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local _ = require("gettext")
|
||||
@@ -75,13 +75,7 @@ if Device:canReboot() then
|
||||
text = _("Reboot the device"),
|
||||
keep_menu_open = true,
|
||||
callback = function()
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("Are you sure you want to reboot the device?"),
|
||||
ok_text = _("Reboot"),
|
||||
ok_callback = function()
|
||||
UIManager:nextTick(UIManager.reboot_action)
|
||||
end,
|
||||
})
|
||||
UIManager:broadcastEvent(Event:new("Reboot"))
|
||||
end
|
||||
}
|
||||
end
|
||||
@@ -90,13 +84,7 @@ if Device:canPowerOff() then
|
||||
text = _("Power off"),
|
||||
keep_menu_open = true,
|
||||
callback = function()
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("Are you sure you want to power off the device?"),
|
||||
ok_text = _("Power off"),
|
||||
ok_callback = function()
|
||||
UIManager:nextTick(UIManager.poweroff_action)
|
||||
end,
|
||||
})
|
||||
UIManager:broadcastEvent(Event:new("PowerOff"))
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user