Frontlight progress bar (#2385)

This commit is contained in:
Robert
2016-12-01 18:58:06 +01:00
committed by Qingping Hou
parent e9b6fa746f
commit 64a79f6892
2 changed files with 321 additions and 43 deletions

View File

@@ -1,5 +1,4 @@
local InputContainer = require("ui/widget/container/inputcontainer")
local InputDialog = require("ui/widget/inputdialog")
local Notification = require("ui/widget/notification")
local GestureRange = require("ui/gesturerange")
local UIManager = require("ui/uimanager")
@@ -83,42 +82,10 @@ function ReaderFrontLight:onPanRelease(arg, ges)
end
function ReaderFrontLight:onShowFlDialog()
local powerd = Device:getPowerDevice()
self.fl_dialog = InputDialog:new{
title = _("Frontlight level"),
input_hint = ("(%d - %d)"):format(powerd.fl_min, powerd.fl_max),
buttons = {
{
{
text = _("Toggle"),
enabled = true,
callback = function()
self.fl_dialog:setInputText("")
powerd:toggleFrontlight()
end,
},
{
text = _("Apply"),
enabled = true,
callback = function()
self:fldialIntensity()
end,
},
{
text = _("OK"),
enabled = true,
callback = function()
self:fldialIntensity()
self:close()
end,
},
},
},
input_type = "number",
local FrontLightWidget = require("ui/widget/frontlightwidget")
local fl = FrontLightWidget:new{
}
self.fl_dialog:onShowKeyboard()
UIManager:show(self.fl_dialog)
UIManager:show(fl)
end
function ReaderFrontLight:close()
@@ -126,11 +93,4 @@ function ReaderFrontLight:close()
UIManager:close(self.fl_dialog)
end
function ReaderFrontLight:fldialIntensity()
local number = tonumber(self.fl_dialog:getInputText())
if number ~= nil then
Device:getPowerDevice():setIntensity(number)
end
end
return ReaderFrontLight