SortWidget, DictQuickLookup: rename some functions (#11949)

addressing concerns found #11933
This commit is contained in:
SomeGuy
2024-06-01 13:25:28 +01:00
committed by GitHub
parent 99447414dc
commit c5600ffe19
2 changed files with 8 additions and 16 deletions

View File

@@ -101,12 +101,10 @@ function DictQuickLookup:init()
end
self.image_alt_face = Font:getFace("cfont", font_size_alt)
if Device:hasKeys() then
self.key_events = {
ReadPrevResult = { { Input.group.PgBack } },
ReadNextResult = { { Input.group.PgFwd } },
Close = { { Input.group.Back } },
ShowResultsMenu = { { "Menu" } },
}
self.key_events.ReadPrevResult = { { Input.group.PgBack } }
self.key_events.ReadNextResult = { { Input.group.PgFwd } }
self.key_events.Close = { { Input.group.Back } }
self.key_events.ShowResultsMenu = { { "Menu" } }
end
if Device:isTouchDevice() then
local range = Geom:new{
@@ -228,7 +226,7 @@ function DictQuickLookup:init()
if self.is_wiki then
self:showWikiResultsMenu()
else
self:showResultsMenu()
self:onShowResultsMenu()
end
end,
left_icon_hold_callback = not self.is_wiki and function() self:showResultsAltMenu() end or nil,
@@ -1330,10 +1328,6 @@ function DictQuickLookup:lookupWikipedia(get_fullpage, word, is_sane, lang)
end
function DictQuickLookup:onShowResultsMenu()
return self:showResultsMenu()
end
function DictQuickLookup:showResultsMenu()
-- Show one row: "| word | dict |" for each result
local width = math.floor(self.width * 0.75)
local right_width = math.floor(width * 0.5)
@@ -1392,6 +1386,7 @@ function DictQuickLookup:showResultsMenu()
button_dialog:setScrolledOffset(self.menu_scrolled_offsets["main"])
self.menu_opened[button_dialog] = true
UIManager:show(button_dialog)
return true
end
function DictQuickLookup:showResultsAltMenu()

View File

@@ -302,7 +302,7 @@ function SortWidget:init()
bottom_line_h_padding = padding,
title = self.title,
left_icon = not self.sort_disabled and "appbar.menu",
left_icon_tap_callback = function() self:showMenu() end,
left_icon_tap_callback = function() self:onShowWidgetMenu() end,
close_callback = function() self:onClose() end,
show_parent = self,
}
@@ -482,10 +482,6 @@ function SortWidget:onSwipe(arg, ges_ev)
end
function SortWidget:onShowWidgetMenu()
self:showMenu()
end
function SortWidget:showMenu()
local dialog
local buttons = {
{{
@@ -529,6 +525,7 @@ function SortWidget:showMenu()
end,
}
UIManager:show(dialog)
return true
end
function SortWidget:sortItems(collate, reverse_collate)