mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
fix bug in showInfoMsgWithDelay()
The release key event will cause the dialog disappear immediately after show up. Also the timeout error is handled with pcall.
This commit is contained in:
12
dialog.lua
12
dialog.lua
@@ -41,7 +41,17 @@ function showInfoMsgWithDelay(text, msec, refresh_mode)
|
||||
InfoMessage:show(text)
|
||||
fb:refresh(refresh_mode)
|
||||
-- util.usleep(msec*1000)
|
||||
input.waitForEvent(msec*1000)
|
||||
|
||||
-- eat the first key release event
|
||||
local ev = input.waitForEvent()
|
||||
adjustKeyEvents(ev)
|
||||
repeat
|
||||
ok = pcall( function()
|
||||
ev = input.waitForEvent(msec*1000)
|
||||
adjustKeyEvents(ev)
|
||||
end)
|
||||
print(is_not_timeout)
|
||||
until not ok or ev.value == EVENT_VALUE_KEY_PRESS
|
||||
|
||||
Screen:restoreFromSavedBB()
|
||||
fb:refresh(refresh_mode)
|
||||
|
||||
Reference in New Issue
Block a user