2019-04-07 17:00:15 +00:00
|
|
|
local Geom = require("ui/geometry")
|
2020-12-19 11:18:30 +00:00
|
|
|
local IconWidget = require("ui/widget/iconwidget")
|
2013-12-17 11:53:43 +00:00
|
|
|
local InputContainer = require("ui/widget/container/inputcontainer")
|
2013-10-18 20:38:07 +00:00
|
|
|
local LeftContainer = require("ui/widget/container/leftcontainer")
|
2014-10-30 18:42:18 +00:00
|
|
|
local Screen = require("device").screen
|
2013-03-03 14:23:28 +00:00
|
|
|
|
2013-12-17 11:53:43 +00:00
|
|
|
local ReaderFlipping = InputContainer:new{
|
2014-03-13 13:52:43 +00:00
|
|
|
orig_reflow_mode = 0,
|
2013-03-31 13:37:57 +00:00
|
|
|
}
|
2013-03-03 14:23:28 +00:00
|
|
|
|
|
|
|
function ReaderFlipping:init()
|
2020-12-19 11:18:30 +00:00
|
|
|
local icon_size = Screen:scaleBySize(32)
|
|
|
|
local widget = IconWidget:new{
|
|
|
|
icon = "book.opened",
|
|
|
|
width = icon_size,
|
|
|
|
height = icon_size,
|
2014-03-13 13:52:43 +00:00
|
|
|
}
|
|
|
|
self[1] = LeftContainer:new{
|
|
|
|
dimen = Geom:new{w = Screen:getWidth(), h = widget:getSize().h},
|
|
|
|
widget,
|
|
|
|
}
|
2016-03-08 06:42:46 +00:00
|
|
|
self:resetLayout()
|
|
|
|
end
|
|
|
|
|
|
|
|
function ReaderFlipping:resetLayout()
|
2016-03-12 08:59:15 +00:00
|
|
|
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
|
2013-03-03 14:23:28 +00:00
|
|
|
end
|
|
|
|
|
2013-10-18 20:38:07 +00:00
|
|
|
return ReaderFlipping
|