mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
This change also adds a tap_input_func in both TouchMenu and Button.
This commit is contained in:
@@ -185,6 +185,8 @@ function Button:onTapSelectButton()
|
||||
end)
|
||||
elseif self.tap_input then
|
||||
self:onInput(self.tap_input)
|
||||
elseif type(self.tap_input_func) == "function" then
|
||||
self:onInput(self.tap_input_func())
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -194,6 +196,8 @@ function Button:onHoldSelectButton()
|
||||
self.hold_callback()
|
||||
elseif self.hold_input then
|
||||
self:onInput(self.hold_input)
|
||||
elseif type(self.hold_input_func) == "function" then
|
||||
self:onInput(self.hold_input_func())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -52,7 +52,7 @@ local RenderText = require("ui/rendertext")
|
||||
local TextBoxWidget = require("ui/widget/textboxwidget")
|
||||
local TextWidget = require("ui/widget/textwidget")
|
||||
local VerticalGroup = require("ui/widget/verticalgroup")
|
||||
local Widget = require("ui/widget/widget")
|
||||
local WidgetContainer = require("ui/widget/container/widgetcontainer")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Screen = require("device").screen
|
||||
|
||||
@@ -115,7 +115,7 @@ function InputDialog:init()
|
||||
}
|
||||
}
|
||||
else
|
||||
self.description = Widget:new()
|
||||
self.description = WidgetContainer:new()
|
||||
end
|
||||
|
||||
self._input_widget = InputText:new{
|
||||
|
||||
@@ -551,9 +551,13 @@ function TouchMenu:onMenuSelect(item)
|
||||
if self.touch_menu_callback then
|
||||
self.touch_menu_callback()
|
||||
end
|
||||
if item.tap_input then
|
||||
if item.tap_input or type(item.tap_input_func) == "function" then
|
||||
self:closeMenu()
|
||||
self:onInput(item.tap_input)
|
||||
if item.tap_input then
|
||||
self:onInput(item.tap_input)
|
||||
else
|
||||
self:onInput(item.tap_input_func())
|
||||
end
|
||||
else
|
||||
local sub_item_table = item.sub_item_table
|
||||
if item.sub_item_table_func then
|
||||
@@ -591,9 +595,13 @@ function TouchMenu:onMenuHold(item)
|
||||
if self.touch_menu_callback then
|
||||
self.touch_menu_callback()
|
||||
end
|
||||
if item.hold_input then
|
||||
if item.hold_input or type(item.hold_input_func) == "function" then
|
||||
self:closeMenu()
|
||||
self:onInput(item.hold_input)
|
||||
if item.hold_input then
|
||||
self:onInput(item.hold_input)
|
||||
else
|
||||
self:onInput(item.hold_input_func())
|
||||
end
|
||||
else
|
||||
local callback = item.hold_callback
|
||||
if item.hold_callback_func then
|
||||
|
||||
@@ -205,14 +205,16 @@ function KOSync:addToMainMenu(menu_items)
|
||||
},
|
||||
{
|
||||
text = _("Custom sync server"),
|
||||
tap_input = {
|
||||
title = _("Custom progress sync server address"),
|
||||
input = self.kosync_custom_server or "https://",
|
||||
type = "text",
|
||||
callback = function(input)
|
||||
self:setCustomServer(input)
|
||||
end,
|
||||
},
|
||||
tap_input_func = function()
|
||||
return {
|
||||
title = _("Custom progress sync server address"),
|
||||
input = self.kosync_custom_server or "https://",
|
||||
type = "text",
|
||||
callback = function(input)
|
||||
self:setCustomServer(input)
|
||||
end,
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user