mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Timer Reader with normal time format (#3244)
This commit is contained in:
@@ -5,7 +5,7 @@ local FrameContainer = require("ui/widget/container/framecontainer")
|
||||
local Geom = require("ui/geometry")
|
||||
local Font = require("ui/font")
|
||||
local InputContainer = require("ui/widget/container/inputcontainer")
|
||||
local TextWidget = require("ui/widget/textboxwidget")
|
||||
local InputDialog = require("ui/widget/inputdialog")
|
||||
local RenderText = require("ui/rendertext")
|
||||
local Size = require("ui/size")
|
||||
local UIManager = require("ui/uimanager")
|
||||
@@ -108,12 +108,50 @@ function NumberPickerWidget:paintWidget()
|
||||
value = string.format(self.precision, value)
|
||||
end
|
||||
|
||||
local text_value = TextWidget:new{
|
||||
local input
|
||||
local callback_input = nil
|
||||
if self.value_table == nil then
|
||||
callback_input = function()
|
||||
input = InputDialog:new{
|
||||
title = _("Enter number"),
|
||||
input_type = "number",
|
||||
buttons = {
|
||||
{
|
||||
{
|
||||
text = _("Cancel"),
|
||||
callback = function()
|
||||
UIManager:close(input)
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("OK"),
|
||||
is_enter_default = true,
|
||||
callback = function()
|
||||
input:closeInputDialog()
|
||||
local input_value = tonumber(input:getInputText())
|
||||
if input_value and input_value >= self.value_min and input_value <= self.value_max then
|
||||
self.value = input_value
|
||||
self:update()
|
||||
end
|
||||
UIManager:close(input)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
input:onShowKeyboard()
|
||||
UIManager:show(input)
|
||||
end
|
||||
end
|
||||
|
||||
local text_value = Button:new{
|
||||
text = value,
|
||||
alignment = "center",
|
||||
face = self.spinner_face,
|
||||
bold = true,
|
||||
bordersize = 0,
|
||||
padding = 0,
|
||||
text_font_face = self.spinner_face_font,
|
||||
text_font_size = self.spinner_face_size,
|
||||
width = self.width,
|
||||
callback = callback_input,
|
||||
}
|
||||
return VerticalGroup:new{
|
||||
align = "center",
|
||||
|
||||
@@ -26,6 +26,7 @@ local TimeWidget = InputContainer:new{
|
||||
width = nil,
|
||||
height = nil,
|
||||
hour = 0,
|
||||
hour_max = 23,
|
||||
min = 0,
|
||||
ok_text = _("OK"),
|
||||
cancel_text = _("Cancel"),
|
||||
@@ -64,7 +65,7 @@ function TimeWidget:update()
|
||||
width = self.screen_width * 0.2,
|
||||
value = self.hour,
|
||||
value_min = 0,
|
||||
value_max = 23,
|
||||
value_max = self.hour_max,
|
||||
value_step = 1,
|
||||
value_hold_step = 4,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user