vocabbuilder.koplugin: Add "got it" button in "Vocabulary exists" popup window (#15534)

Added got it functionality per follow-up request in https://github.com/koreader/koreader/issues/15291#issuecomment-4682605447
This commit is contained in:
weijiuqiao authored and GitHub committed 2026-06-13 13:01:37 +02:00
1 parent 3f479943a7
commit 6b567a2bfc
1 file changed
+20 -9
+20 -9
View File
@@ -499,7 +499,13 @@ function WordInfoDialog:init()
self.layout = {}
if self.dismissable then
if Device:hasKeys() then
self.key_events.Close = { { Device.input.group.Back } }
local back_group = util.tableDeepCopy(Device.input.group.Back)
if Device:hasFewKeys() then
table.insert(back_group, "Left")
else
table.insert(back_group, "Menu")
end
self.key_events.Close = { { back_group } }
end
if Device:isTouchDevice() then
self.ges_events.Tap = {
@@ -543,13 +549,6 @@ function WordInfoDialog:init()
end
}
local cancel_button = {
text = _("Cancel"),
callback = function()
UIManager:close(self)
end
}
local forgot_button = {
text = _("Forgot"),
callback = function()
@@ -558,6 +557,14 @@ function WordInfoDialog:init()
end
}
local got_it_button = {
text = _("Got it"),
callback = function()
self.got_it_callback()
UIManager:close(self)
end
}
local update_button = {
text = _("Overwrite"),
callback = function()
@@ -566,7 +573,7 @@ function WordInfoDialog:init()
end
}
local buttons = self.update_callback and {{cancel_button, forgot_button, update_button}} or {{reset_button, remove_button}}
local buttons = self.update_callback and {{got_it_button, forgot_button, update_button}} or {{reset_button, remove_button}}
if self.vocabbuilder and self.vocabbuilder.item.last_due_time then
table.insert(buttons, {{
text = _("Undo study status"),
@@ -2130,6 +2137,10 @@ function VocabBuilder:onWordLookedUp(word, title, is_manual)
DB:gotOrForgot(item, false)
DB:batchUpdateItems({ item })
end,
got_it_callback = function()
DB:gotOrForgot(item, true)
DB:batchUpdateItems({ item })
end,
}
UIManager:show(dialog)
else