2013-12-17 11:53:43 +00:00
|
|
|
local InputContainer = require("ui/widget/container/inputcontainer")
|
2013-10-18 20:38:07 +00:00
|
|
|
local RightContainer = require("ui/widget/container/rightcontainer")
|
|
|
|
local ImageWidget = require("ui/widget/imagewidget")
|
2013-12-17 11:53:43 +00:00
|
|
|
local GestureRange = require("ui/gesturerange")
|
2014-10-30 18:42:18 +00:00
|
|
|
local Device = require("device")
|
2013-10-18 20:38:07 +00:00
|
|
|
local Geom = require("ui/geometry")
|
2014-10-30 18:42:18 +00:00
|
|
|
local Screen = require("device").screen
|
2013-12-17 11:53:43 +00:00
|
|
|
local Event = require("ui/event")
|
2013-02-24 11:49:23 +00:00
|
|
|
|
2013-12-17 11:53:43 +00:00
|
|
|
local ReaderDogear = InputContainer:new{}
|
2013-02-24 11:49:23 +00:00
|
|
|
|
|
|
|
function ReaderDogear:init()
|
2014-03-13 13:52:43 +00:00
|
|
|
local widget = ImageWidget:new{
|
|
|
|
file = "resources/icons/dogear.png",
|
2014-11-28 15:34:09 +00:00
|
|
|
alpha = true,
|
2014-03-13 13:52:43 +00:00
|
|
|
}
|
|
|
|
self[1] = RightContainer:new{
|
|
|
|
dimen = Geom:new{w = Screen:getWidth(), h = widget:getSize().h},
|
|
|
|
widget,
|
|
|
|
}
|
2016-03-08 06:42:46 +00:00
|
|
|
self:resetLayout()
|
|
|
|
end
|
|
|
|
|
|
|
|
function ReaderDogear:resetLayout()
|
|
|
|
self[1].dimen.w = Screen:getWidth()
|
2014-03-13 13:52:43 +00:00
|
|
|
if Device:isTouchDevice() then
|
|
|
|
self.ges_events = {
|
|
|
|
Tap = {
|
|
|
|
GestureRange:new{
|
|
|
|
ges = "tap",
|
|
|
|
range = Geom:new{
|
|
|
|
x = Screen:getWidth()*DTAP_ZONE_BOOKMARK.x,
|
|
|
|
y = Screen:getHeight()*DTAP_ZONE_BOOKMARK.y,
|
|
|
|
w = Screen:getWidth()*DTAP_ZONE_BOOKMARK.w,
|
|
|
|
h = Screen:getHeight()*DTAP_ZONE_BOOKMARK.h
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Hold = {
|
|
|
|
GestureRange:new{
|
|
|
|
ges = "hold",
|
|
|
|
range = Geom:new{
|
|
|
|
x = Screen:getWidth()*DTAP_ZONE_BOOKMARK.x,
|
|
|
|
y = Screen:getHeight()*DTAP_ZONE_BOOKMARK.y,
|
|
|
|
w = Screen:getWidth()*DTAP_ZONE_BOOKMARK.w,
|
|
|
|
h = Screen:getHeight()*DTAP_ZONE_BOOKMARK.h
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2013-12-17 11:53:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function ReaderDogear:onTap()
|
2014-03-13 13:52:43 +00:00
|
|
|
self.ui:handleEvent(Event:new("ToggleBookmark"))
|
|
|
|
return true
|
2013-02-24 11:49:23 +00:00
|
|
|
end
|
|
|
|
|
2014-01-03 19:14:24 +00:00
|
|
|
function ReaderDogear:onHold()
|
2014-03-13 13:52:43 +00:00
|
|
|
self.ui:handleEvent(Event:new("ToggleBookmarkFlipping"))
|
|
|
|
return true
|
2014-01-03 19:14:24 +00:00
|
|
|
end
|
|
|
|
|
2013-02-24 11:49:23 +00:00
|
|
|
function ReaderDogear:onSetDogearVisibility(visible)
|
2014-03-13 13:52:43 +00:00
|
|
|
self.view.dogear_visible = visible
|
|
|
|
return true
|
2013-03-12 17:18:53 +00:00
|
|
|
end
|
2013-10-18 20:38:07 +00:00
|
|
|
|
|
|
|
return ReaderDogear
|