mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
24424e505e
- Add IconWidget, use it for icons instead of ImageWidget. Specify icons by name only, look for them (with either .svg or .png suffixes) in multiple directories (including koreader/settings/icons/ to allow customizing them). Don't crash when icon name not found, shown a black background warning icon instead. - Don't trust the icons' native sizes: replace scale_for_dpi=true with width/height=DGENERIC_ICON_SIZE, so all icons get the same (tunable) size - except in a few specific use cases. - Top and bottom menu bars: normalize, and have icons properly centered in them, extend vertical line separators up to the edges. - TOC: adjust expand/collapse icons size to items size
34 lines
960 B
Lua
34 lines
960 B
Lua
local Geom = require("ui/geometry")
|
|
local IconWidget = require("ui/widget/iconwidget")
|
|
local InputContainer = require("ui/widget/container/inputcontainer")
|
|
local LeftContainer = require("ui/widget/container/leftcontainer")
|
|
local Screen = require("device").screen
|
|
|
|
local ReaderFlipping = InputContainer:new{
|
|
orig_reflow_mode = 0,
|
|
}
|
|
|
|
function ReaderFlipping:init()
|
|
local icon_size = Screen:scaleBySize(32)
|
|
local widget = IconWidget:new{
|
|
icon = "book.opened",
|
|
width = icon_size,
|
|
height = icon_size,
|
|
}
|
|
self[1] = LeftContainer:new{
|
|
dimen = Geom:new{w = Screen:getWidth(), h = widget:getSize().h},
|
|
widget,
|
|
}
|
|
self:resetLayout()
|
|
end
|
|
|
|
function ReaderFlipping:resetLayout()
|
|
local new_screen_width = Screen:getWidth()
|
|
if new_screen_width == self._last_screen_width then return end
|
|
self._last_screen_width = new_screen_width
|
|
|
|
self[1].dimen.w = new_screen_width
|
|
end
|
|
|
|
return ReaderFlipping
|