mirror of
https://github.com/koreader/koreader
synced 2024-11-11 19:11:14 +00:00
Prefix battery percentage w/ a + when charging.
Adresses comments on MR. Add a comment explaining the magic behind CRe's charging icon when using CRE's full (top) status bar.
This commit is contained in:
parent
02938163b9
commit
ce5f66ccbc
@ -196,8 +196,7 @@ end
|
|||||||
|
|
||||||
function ReaderFooter:getBatteryInfo()
|
function ReaderFooter:getBatteryInfo()
|
||||||
local powerd = Device:getPowerDevice()
|
local powerd = Device:getPowerDevice()
|
||||||
--local state = powerd:isCharging() and -1 or powerd:getCapacity()
|
return "B:" .. (powerd:isCharging() and "+" or "") .. powerd:getCapacity() .. "%"
|
||||||
return "B:" .. powerd:getCapacity() .. "%"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ReaderFooter:getTimeInfo()
|
function ReaderFooter:getTimeInfo()
|
||||||
|
@ -499,6 +499,7 @@ function ReaderRolling:updateBatteryState()
|
|||||||
DEBUG("update battery state")
|
DEBUG("update battery state")
|
||||||
if self.view.view_mode == "page" then
|
if self.view.view_mode == "page" then
|
||||||
local powerd = Device:getPowerDevice()
|
local powerd = Device:getPowerDevice()
|
||||||
|
-- -1 is CR_BATTERY_STATE_CHARGING @ crengine/crengine/include/lvdocview.h
|
||||||
local state = powerd:isCharging() and -1 or powerd:getCapacity()
|
local state = powerd:isCharging() and -1 or powerd:getCapacity()
|
||||||
if state then
|
if state then
|
||||||
self.ui.document:setBatteryState(state)
|
self.ui.document:setBatteryState(state)
|
||||||
|
@ -463,7 +463,7 @@ function TouchMenu:updateItems()
|
|||||||
self.page_info_right_chev:showHide(self.page_num > 1)
|
self.page_info_right_chev:showHide(self.page_num > 1)
|
||||||
self.page_info_left_chev:enableDisable(self.page > 1)
|
self.page_info_left_chev:enableDisable(self.page > 1)
|
||||||
self.page_info_right_chev:enableDisable(self.page < self.page_num)
|
self.page_info_right_chev:enableDisable(self.page < self.page_num)
|
||||||
self.time_info.text = os.date("%H:%M").." @ "..Device:getPowerDevice():getCapacity().."%"
|
self.time_info.text = os.date("%H:%M").." @ "..(Device:getPowerDevice():isCharging() and "+" or "")..Device:getPowerDevice():getCapacity().."%"
|
||||||
|
|
||||||
UIManager:setDirty("all", function()
|
UIManager:setDirty("all", function()
|
||||||
local refresh_dimen =
|
local refresh_dimen =
|
||||||
|
Loading…
Reference in New Issue
Block a user