From e16d36d5da658c18871789bbb300f95d835c7bb1 Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Fri, 10 Sep 2021 02:07:31 +0300 Subject: [PATCH] Readersearch: add button to recall search input dialog (#8190) --- frontend/apps/reader/modules/readersearch.lua | 8 ++++++++ frontend/ui/widget/button.lua | 8 +++++--- frontend/ui/widget/buttontable.lua | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/frontend/apps/reader/modules/readersearch.lua b/frontend/apps/reader/modules/readersearch.lua index 33061ee61..156bc76fe 100644 --- a/frontend/apps/reader/modules/readersearch.lua +++ b/frontend/apps/reader/modules/readersearch.lua @@ -303,6 +303,14 @@ function ReaderSearch:onShowSearchDialog(text, direction, regex, case_insensitiv vsync = true, callback = search(self.searchNext, text, 1), }, + { + icon = "appbar.search", + callback = function() + self.search_dialog:onClose() + self.last_search_text = text + self:onShowFulltextSearchInput() + end, + }, { text = forward_text, vsync = true, diff --git a/frontend/ui/widget/button.lua b/frontend/ui/widget/button.lua index e565a2f3d..e0dda9422 100644 --- a/frontend/ui/widget/button.lua +++ b/frontend/ui/widget/button.lua @@ -33,11 +33,13 @@ local Screen = Device.screen local logger = require("logger") local Button = InputContainer:new{ - text = nil, -- mandatory + text = nil, -- mandatory (unless icon is provided) text_func = nil, icon = nil, - icon_width = Screen:scaleBySize(DGENERIC_ICON_SIZE), -- our icons are square - icon_height = Screen:scaleBySize(DGENERIC_ICON_SIZE), + icon_width = Screen:scaleBySize(DGENERIC_ICON_SIZE * 0.8), -- our icons are square + icon_height = Screen:scaleBySize(DGENERIC_ICON_SIZE * 0.8), + -- Reduced size of the icons (0.8) nicely match the size of the default font + -- of text buttons ("cfont", 20), when mixing both text and icon buttons. icon_rotation_angle = 0, preselect = false, callback = nil, diff --git a/frontend/ui/widget/buttontable.lua b/frontend/ui/widget/buttontable.lua index c30977165..bffdcca92 100644 --- a/frontend/ui/widget/buttontable.lua +++ b/frontend/ui/widget/buttontable.lua @@ -52,6 +52,7 @@ function ButtonTable:init() local button = Button:new{ text = btn_entry.text, text_func = btn_entry.text_func, + icon = btn_entry.icon, enabled = btn_entry.enabled, callback = btn_entry.callback, hold_callback = btn_entry.hold_callback,