|
|
|
local BD = require("ui/bidi")
|
|
|
|
local Blitbuffer = require("ffi/blitbuffer")
|
|
|
|
local ConfirmBox = require("ui/widget/confirmbox")
|
|
|
|
local FrameContainer = require("ui/widget/container/framecontainer")
|
|
|
|
local InputContainer = require("ui/widget/container/inputcontainer")
|
|
|
|
local OPDSBrowser = require("ui/widget/opdsbrowser")
|
|
|
|
local ReaderUI = require("apps/reader/readerui")
|
|
|
|
local UIManager = require("ui/uimanager")
|
|
|
|
local logger = require("logger")
|
|
|
|
local _ = require("gettext")
|
|
|
|
local Screen = require("device").screen
|
|
|
|
local T = require("ffi/util").template
|
|
|
|
|
|
|
|
local OPDSCatalog = InputContainer:extend{
|
|
|
|
title = _("OPDS Catalog"),
|
|
|
|
onExit = function() end,
|
|
|
|
}
|
|
|
|
|
|
|
|
function OPDSCatalog:init()
|
|
|
|
local opds_browser = OPDSBrowser:new{
|
|
|
|
title = self.title,
|
|
|
|
show_parent = self,
|
|
|
|
is_popout = false,
|
|
|
|
is_borderless = true,
|
|
|
|
has_close_button = true,
|
|
|
|
close_callback = function() return self:onClose() end,
|
|
|
|
file_downloaded_callback = function(downloaded_file)
|
|
|
|
UIManager:show(ConfirmBox:new{
|
|
|
|
text = T(_("File saved to:\n%1\nWould you like to read the downloaded book now?"),
|
|
|
|
BD.filepath(downloaded_file)),
|
|
|
|
ok_text = _("Read now"),
|
|
|
|
cancel_text = _("Read later"),
|
|
|
|
ok_callback = function()
|
|
|
|
self:onClose()
|
|
|
|
ReaderUI:showReader(downloaded_file)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
|
|
|
self[1] = FrameContainer:new{
|
|
|
|
padding = 0,
|
|
|
|
bordersize = 0,
|
|
|
|
background = Blitbuffer.COLOR_WHITE,
|
|
|
|
opds_browser,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
function OPDSCatalog:onShow()
|
|
|
|
UIManager:setDirty(self, function()
|
|
|
|
return "ui", self[1].dimen
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function OPDSCatalog:onCloseWidget()
|
|
|
|
UIManager:setDirty(nil, function()
|
Tame some ButtonTable users into re-using Buttontable instances if possible (#7166)
* QuickDictLookup, ImageViewer, NumberPicker: Smarter `update` that will re-use most of the widget's layout instead of re-instantiating all the things.
* SpinWidget/DoubleSpinWidget: The NumberPicker change above renders a hack to preserve alpha on these widgets almost unnecessary. Also fixed said hack to also apply to the center, value button.
* Button: Don't re-instantiate the frame in setText/setIcon when unnecessary (e.g., no change at all, or no layout change).
* Button: Add a refresh method that repaints and refreshes a *specific* Button (provided it's been painted once) all on its lonesome.
* ConfigDialog: Free everything that's going to be re-instatiated on update
* A few more post #7118 fixes:
* SkimTo: Always flag the chapter nav buttons as vsync
* Button: Fix the highlight on rounded buttons when vsync is enabled (e.g., it's now entirely visible, instead of showing a weird inverted corner glitch).
* Some more heuristic tweaks in Menu/TouchMenu/Button/IconButton
* ButtonTable: fix the annoying rounding issue I'd noticed in #7054 ;).
* Enable dithering in TextBoxWidget (e.g., in the Wikipedia full view). This involved moving the HW dithering align fixup to base, where it always ought to have been ;).
* Switch a few widgets that were using "partial" on close to "ui", or, more rarely, "flashui". The intent being to limit "partial" purely to the Reader, because it has a latency cost when mixed with other refreshes, which happens often enough in UI ;).
* Minor documentation tweaks around UIManager's `setDirty` to reflect that change.
* ReaderFooter: Force a footer repaint on resume if it is visible (otherwise, just update it).
* ReaderBookmark: In the same vein, don't repaint an invisible footer on bookmark count changes.
3 years ago
|
|
|
return "ui", self[1].dimen
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function OPDSCatalog:showCatalog()
|
|
|
|
logger.dbg("show OPDS catalog")
|
|
|
|
UIManager:show(OPDSCatalog:new{
|
|
|
|
dimen = Screen:getSize(),
|
|
|
|
covers_fullscreen = true, -- hint for UIManager:_repaint()
|
|
|
|
onExit = function()
|
|
|
|
--UIManager:quit()
|
|
|
|
end
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
function OPDSCatalog:onClose()
|
|
|
|
logger.dbg("close OPDS catalog")
|
|
|
|
UIManager:close(self)
|
|
|
|
if self.onExit then
|
|
|
|
self:onExit()
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
return OPDSCatalog
|