2019-04-07 19:00:15 +02:00
|
|
|
local Geom = require("ui/geometry")
|
|
|
|
|
local ImageWidget = require("ui/widget/imagewidget")
|
2013-12-17 19:53:43 +08:00
|
|
|
local InputContainer = require("ui/widget/container/inputcontainer")
|
2013-10-18 22:38:07 +02:00
|
|
|
local LeftContainer = require("ui/widget/container/leftcontainer")
|
2014-10-30 19:42:18 +01:00
|
|
|
local Screen = require("device").screen
|
2013-03-03 22:23:28 +08:00
|
|
|
|
2013-12-17 19:53:43 +08:00
|
|
|
local ReaderFlipping = InputContainer:new{
|
2014-03-13 21:52:43 +08:00
|
|
|
orig_reflow_mode = 0,
|
2013-03-31 21:37:57 +08:00
|
|
|
}
|
2013-03-03 22:23:28 +08:00
|
|
|
|
|
|
|
|
function ReaderFlipping:init()
|
2014-03-13 21:52:43 +08:00
|
|
|
local widget = ImageWidget:new{
|
|
|
|
|
file = "resources/icons/appbar.book.open.png",
|
|
|
|
|
}
|
|
|
|
|
self[1] = LeftContainer:new{
|
|
|
|
|
dimen = Geom:new{w = Screen:getWidth(), h = widget:getSize().h},
|
|
|
|
|
widget,
|
|
|
|
|
}
|
2016-03-07 22:42:46 -08:00
|
|
|
self:resetLayout()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ReaderFlipping:resetLayout()
|
2016-03-12 00:59:15 -08: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 22:23:28 +08:00
|
|
|
end
|
|
|
|
|
|
2013-10-18 22:38:07 +02:00
|
|
|
return ReaderFlipping
|