mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Dict, Trapper: prevent dismissal by past events
Add UIManager:discardEvents(), to allow dropping events for a period of time. Default duration of 600ms on eInk, 300ms otherwise. Used when showing the dict result window, so that a tap happening just when it's being shown won't discard it. Used with Trapper:confirm()/:info(), to avoid taps made in a previous processing to dismiss (and so, select the cancel action) a ConfirmBox not yet painted/visible.
This commit is contained in:
@@ -889,6 +889,12 @@ function ReaderDictionary:showDict(word, results, box, link)
|
||||
self:dismissLookupInfo()
|
||||
if results and results[1] then
|
||||
UIManager:show(self.dict_window)
|
||||
if not results[1].lookup_cancelled then
|
||||
-- Discard queued and coming up events to avoid accidental
|
||||
-- dismissal (but not if lookup interrupted, so 2 quick
|
||||
-- taps can discard everything)
|
||||
UIManager:discardEvents(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user