ReaderDictionary: Avoid an irritating refresh when dismissing the InfoMessage (#6934)

* ReaderDictionary: Don't refresh when dimissing the lookup info
InfoMessage

Re #6932

* Fix dict_largewindow in Landscape

Have to leave some room for the UI chrome
This commit is contained in:
NiLuJe
2020-12-03 17:37:46 +01:00
committed by GitHub
parent 493eab92c9
commit 6162c287e8
3 changed files with 26 additions and 5 deletions

View File

@@ -647,9 +647,9 @@ end
function ReaderDictionary:showLookupInfo(word)
local text = T(self.lookup_msg, word)
self.lookup_progress_msg = InfoMessage:new{text=text}
self.lookup_progress_msg = InfoMessage:new{text=text, no_refresh_on_close=true}
UIManager:show(self.lookup_progress_msg)
UIManager:forceRePaint()
-- UIManager:forceRePaint()
end
function ReaderDictionary:dismissLookupInfo()
@@ -827,7 +827,6 @@ function ReaderDictionary:stardictLookup(word, dict_names, fuzzy_search, box, li
end
function ReaderDictionary:showDict(word, results, box, link)
self:dismissLookupInfo()
if results and results[1] then
logger.dbg("showing quick lookup window", word, results)
self.dict_window = DictQuickLookup:new{
@@ -856,9 +855,21 @@ function ReaderDictionary:showDict(word, results, box, link)
self:onHtmlDictionaryLinkTapped(dictionary, html_link)
end,
}
if self.lookup_progress_msg then
-- If we have a lookup InfoMessage, and it's taller than us, make it refresh on close
if self.lookup_progress_msg[1][1] and self.lookup_progress_msg[1][1].dimen and self.lookup_progress_msg[1][1].dimen.h >= self.dict_window.height then
self.lookup_progress_msg.no_refresh_on_close = nil
end
end
table.insert(self.dict_window_list, self.dict_window)
UIManager:show(self.dict_window)
end
-- Delay the dismiss, so we can flip the no_refresh_on_close flag if the InfoMessage is taller than the DictQuickLookup...
self:dismissLookupInfo()
if results and results[1] then
UIManager:show(self.dict_window)
end
end
function ReaderDictionary:showDownload(downloadable_dicts)