update battery state on device resume

pull/456/head
Qingping Hou 10 years ago
parent f7b47a3634
commit 21af7b6a9f

@ -216,6 +216,14 @@ function ReaderRolling:onPageUpdate(new_page)
self:updateBatteryState()
end
function ReaderRolling:onResume()
self:updateBatteryState()
end
function ReaderRolling:onNotCharging()
self:updateBatteryState()
end
function ReaderRolling:onGotoPercent(percent)
DEBUG("goto document offset in percent:", percent)
self:gotoPercent(percent)

@ -287,10 +287,11 @@ function UIManager:run()
Device:usbPlugIn()
elseif input_event == "NotCharging" then
Device:usbPlugOut()
self:sendEvent(Event:new("NotCharging"))
elseif input_event == "Light" then
Device:getPowerDevice():toggleFrontlight()
elseif (input_event == "Power" and not Device.screen_saver_mode) or
input_event == "Suspend" then
elseif (input_event == "Power" and not Device.screen_saver_mode)
or input_event == "Suspend" then
local InfoMessage = require("ui/widget/infomessage")
self:show(InfoMessage:new{
text = _("Standby"),
@ -298,9 +299,10 @@ function UIManager:run()
})
Device:prepareSuspend()
self:scheduleIn(0.5, function() Device:Suspend() end)
elseif (input_event == "Power" and Device.screen_saver_mode) or
input_event == "Resume" then
elseif (input_event == "Power" and Device.screen_saver_mode)
or input_event == "Resume" then
Device:Resume()
self:sendEvent(Event:new("Resume"))
else
self:sendEvent(input_event)
end

Loading…
Cancel
Save