Unify battery meters look'n feel (#5537)

* Unify battery meters look'n feel

Switch to proper (vertical) battery icons (one per 10% steps).

Fix #5535

* Bump fonts (https://github.com/koreader/koreader-fonts/pull/7)

Because we need the new symbols from nerdfonts ;).
This commit is contained in:
NiLuJe
2019-10-27 05:22:17 +01:00
committed by GitHub
parent 9f7bc356ba
commit 8d281647ae
6 changed files with 83 additions and 23 deletions

View File

@@ -52,13 +52,13 @@ local symbol_prefix = {
icons = {
time = "",
pages_left = "",
battery = "",
battery = "",
percentage = "",
book_time_to_read = "",
chapter_time_to_read = "",
frontlight = "",
mem_usage = "",
wifi_status = "",
mem_usage = "",
wifi_status = "",
}
}
local PROGRESS_BAR_STYLE_THICK_DEFAULT_HEIGHT = 7
@@ -85,7 +85,38 @@ local footerTextGeneratorMap = {
local symbol_type = footer.settings.item_prefix or "icons"
local prefix = symbol_prefix[symbol_type].battery
local powerd = Device:getPowerDevice()
return prefix .. " " .. (powerd:isCharging() and "+" or "") .. powerd:getCapacity() .. "%"
local batt_lvl = powerd:getCapacity()
-- If we're using icons, use fancy variable icons
if symbol_type == "icons" then
if powerd:isCharging() then
prefix = ""
else
if batt_lvl >= 100 then
prefix = ""
elseif batt_lvl >= 90 then
prefix = ""
elseif batt_lvl >= 80 then
prefix = ""
elseif batt_lvl >= 70 then
prefix = ""
elseif batt_lvl >= 60 then
prefix = ""
elseif batt_lvl >= 50 then
prefix = ""
elseif batt_lvl >= 40 then
prefix = ""
elseif batt_lvl >= 30 then
prefix = ""
elseif batt_lvl >= 20 then
prefix = ""
elseif batt_lvl >= 10 then
prefix = ""
else
prefix = ""
end
end
end
return prefix .. (symbol_type == "icons" and "" or " ") .. batt_lvl .. "%"
end,
time = function(footer)
local symbol_type = footer.settings.item_prefix or "icons"