mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
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:
@@ -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)
|
||||
|
||||
@@ -230,7 +230,12 @@ function DictQuickLookup:update()
|
||||
if self.is_fullpage or G_reader_settings:isTrue("dict_largewindow") then
|
||||
-- bigger window if fullpage being shown - this will let
|
||||
-- some room anyway for footer display (time, battery...)
|
||||
self.height = Screen:getHeight()
|
||||
-- In Landscape, we have less room available for the UI bits, so, chop it off some more
|
||||
if Screen:getScreenMode() == "landscape" then
|
||||
self.height = Screen:getHeight() - Screen:scaleBySize(80)
|
||||
else
|
||||
self.height = Screen:getHeight()
|
||||
end
|
||||
self.width = Screen:getWidth() - Screen:scaleBySize(40)
|
||||
else
|
||||
-- smaller window otherwise
|
||||
|
||||
@@ -64,7 +64,8 @@ local InfoMessage = InputContainer:new{
|
||||
lang = nil,
|
||||
para_direction_rtl = nil,
|
||||
auto_para_direction = nil,
|
||||
|
||||
-- Don't call setDirty when closing the widget
|
||||
no_refresh_on_close = nil,
|
||||
}
|
||||
|
||||
function InfoMessage:init()
|
||||
@@ -185,6 +186,10 @@ function InfoMessage:init()
|
||||
end
|
||||
|
||||
function InfoMessage:onCloseWidget()
|
||||
if self.no_refresh_on_close then
|
||||
return true
|
||||
end
|
||||
|
||||
UIManager:setDirty(nil, function()
|
||||
return "ui", self[1][1].dimen
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user