mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
TouchMenu: use radio buttons for single choice menu items (#8757)
This commit is contained in:
@@ -299,7 +299,7 @@ function ReaderHighlight:addToMainMenu(menu_items)
|
||||
text = _("Highlight style"),
|
||||
sub_item_table = {},
|
||||
}
|
||||
for _, v in ipairs(highlight_style) do
|
||||
for i, v in ipairs(highlight_style) do
|
||||
table.insert(menu_items.highlight_options.sub_item_table, {
|
||||
text_func = function()
|
||||
local text = v[1]
|
||||
@@ -311,6 +311,7 @@ function ReaderHighlight:addToMainMenu(menu_items)
|
||||
checked_func = function()
|
||||
return self.view.highlight.saved_drawer == v[2]
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
self.view.highlight.saved_drawer = v[2]
|
||||
end,
|
||||
@@ -318,6 +319,7 @@ function ReaderHighlight:addToMainMenu(menu_items)
|
||||
G_reader_settings:saveSetting("highlight_drawing_style", v[2])
|
||||
if touchmenu_instance then touchmenu_instance:updateItems() end
|
||||
end,
|
||||
separator = i == #highlight_style,
|
||||
})
|
||||
end
|
||||
table.insert(menu_items.highlight_options.sub_item_table, {
|
||||
@@ -388,6 +390,7 @@ function ReaderHighlight:addToMainMenu(menu_items)
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("default_highlight_action", "ask") == v[2]
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("default_highlight_action", v[2])
|
||||
self.view.highlight.disabled = v[2] == "nothing"
|
||||
|
||||
Reference in New Issue
Block a user