From 55f1b8c974f5d5c96dafe338fe1ef6e60cd9a886 Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Tue, 28 Feb 2023 09:19:17 +0200 Subject: [PATCH] UX: a set of minor fixes (#10165) - AutoFrontlight plugin: update checkmark on toggling - KeepAlive plugin: update checkmark on toggling - ReaderPageMap: font size menu entry - ReaderStatus, common_settings_menu_table: book status "read" -> "finished" --- frontend/apps/reader/modules/readerpagemap.lua | 2 +- frontend/apps/reader/modules/readerstatus.lua | 4 ++-- frontend/ui/elements/common_settings_menu_table.lua | 2 +- plugins/autofrontlight.koplugin/main.lua | 3 ++- plugins/keepalive.koplugin/main.lua | 8 +++++--- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/frontend/apps/reader/modules/readerpagemap.lua b/frontend/apps/reader/modules/readerpagemap.lua index 53255a5d8..4928c58f6 100644 --- a/frontend/apps/reader/modules/readerpagemap.lua +++ b/frontend/apps/reader/modules/readerpagemap.lua @@ -408,7 +408,7 @@ function ReaderPageMap:addToMainMenu(menu_items) }, { text_func = function() - return T(_("Page labels font size (%1)"), self.label_font_size) + return T(_("Page labels font size: %1"), self.label_font_size) end, enabled_func = function() return self.show_page_labels end, callback = function(touchmenu_instance) diff --git a/frontend/apps/reader/modules/readerstatus.lua b/frontend/apps/reader/modules/readerstatus.lua index 0ee3fe2db..7cfd77d14 100644 --- a/frontend/apps/reader/modules/readerstatus.lua +++ b/frontend/apps/reader/modules/readerstatus.lua @@ -41,7 +41,7 @@ function ReaderStatus:onEndOfBook() return end - -- Should we start by marking the book as read? + -- Should we start by marking the book as finished? if G_reader_settings:isTrue("end_document_auto_mark") then self:onMarkBook(true) end @@ -142,7 +142,7 @@ function ReaderStatus:onEndOfBook() elseif settings == "mark_read" then self:onMarkBook(true) UIManager:show(InfoMessage:new{ - text = _("You've reached the end of the document.\nThe current book is marked as read."), + text = _("You've reached the end of the document.\nThe current book is marked as finished."), timeout = 3 }) elseif settings == "book_status_file_browser" then diff --git a/frontend/ui/elements/common_settings_menu_table.lua b/frontend/ui/elements/common_settings_menu_table.lua index 995988529..a87b2551c 100644 --- a/frontend/ui/elements/common_settings_menu_table.lua +++ b/frontend/ui/elements/common_settings_menu_table.lua @@ -624,7 +624,7 @@ common_settings.document_end_action = { }, genGenericMenuEntry(_("Go to beginning"), "end_document_action", "goto_beginning", nil, true), genGenericMenuEntry(_("Return to file browser"), "end_document_action", "file_browser", nil, true), - genGenericMenuEntry(_("Mark book as read"), "end_document_action", "mark_read", nil, true), + genGenericMenuEntry(_("Mark book as finished"), "end_document_action", "mark_read", nil, true), genGenericMenuEntry(_("Book status and return to file browser"), "end_document_action", "book_status_file_browser", nil, true), } } diff --git a/plugins/autofrontlight.koplugin/main.lua b/plugins/autofrontlight.koplugin/main.lua index 73770d8a2..a0187394c 100644 --- a/plugins/autofrontlight.koplugin/main.lua +++ b/plugins/autofrontlight.koplugin/main.lua @@ -116,13 +116,14 @@ end function AutoFrontlightWidget:addToMainMenu(menu_items) menu_items.auto_frontlight = { text = _("Auto frontlight"), - callback = function() + callback = function(touchmenu_instance) UIManager:show(ConfirmBox:new{ text = T(_("Auto frontlight detects the brightness of the environment and automatically turn on and off the frontlight.\nFrontlight will be turned off to save battery in bright environment, and turned on in dark environment.\nDo you want to %1 it?"), AutoFrontlight.enabled and _("disable") or _("enable")), ok_text = AutoFrontlight.enabled and _("Disable") or _("Enable"), ok_callback = function() self:flipSetting() + touchmenu_instance:updateItems() end }) end, diff --git a/plugins/keepalive.koplugin/main.lua b/plugins/keepalive.koplugin/main.lua index 9eb19819d..3e7657f3f 100644 --- a/plugins/keepalive.koplugin/main.lua +++ b/plugins/keepalive.koplugin/main.lua @@ -13,17 +13,19 @@ local menuItem = { local disable local enable -local function showConfirmBox() +local function showConfirmBox(touchmenu_instance) UIManager:show(ConfirmBox:new{ text = _("The system won't sleep while this message is showing.\n\nPress \"Stay alive\" if you prefer to keep the system on even after closing this notification. *This will drain the battery*.\n\nIf KOReader terminates before \"Close\" is pressed, please start and close the KeepAlive plugin again to ensure settings are reset."), cancel_text = _("Close"), cancel_callback = function() disable() PluginShare.keepalive = false + touchmenu_instance:updateItems() end, ok_text = _("Stay alive"), ok_callback = function() PluginShare.keepalive = true + touchmenu_instance:updateItems() end, }) end @@ -54,9 +56,9 @@ else return { disabled = true, } end -menuItem.callback = function() +menuItem.callback = function(touchmenu_instance) enable() - showConfirmBox() + showConfirmBox(touchmenu_instance) end local KeepAlive = WidgetContainer:extend{