update scripts
This commit is contained in:
@@ -8,5 +8,9 @@ function on_click()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function on_dialog_action(idx)
|
function on_dialog_action(idx)
|
||||||
|
if idx == -1 then
|
||||||
|
ui:show_toast("Dialog cancelled")
|
||||||
|
else
|
||||||
ui:show_toast("Checked: "..dialog_items[idx])
|
ui:show_toast("Checked: "..dialog_items[idx])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
13
utils.lua
Normal file
13
utils.lua
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
function get_args_kv()
|
||||||
|
local keys = {}
|
||||||
|
local values = {}
|
||||||
|
local args = aio:get_args()
|
||||||
|
|
||||||
|
for idx = 1, #args, 1 do
|
||||||
|
local arg = sx.split(args[idx], ":")
|
||||||
|
keys[idx] = arg[1]
|
||||||
|
values[idx] = arg[2]
|
||||||
|
end
|
||||||
|
|
||||||
|
return { keys, values }
|
||||||
|
end
|
||||||
55
widgets-on-off.lua
Normal file
55
widgets-on-off.lua
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
-- name = "Включение виджетов"
|
||||||
|
-- description = "Включает и отключает виджеты на экране при нажатии на кнопки"
|
||||||
|
-- type = "widget"
|
||||||
|
-- author = "Andrey Gavrilov"
|
||||||
|
-- version = "1.0"
|
||||||
|
-- arguments_help = "Введите список виджетов и кнопок в формате bitcoin:Биткойн timer:Таймер"
|
||||||
|
-- arguments_default = "bitcoin:Битк. timer:Тайм. stopwatch:Секунд. recorder:Дикт. calculator:Кальк."
|
||||||
|
|
||||||
|
sx = require 'pl.stringx'
|
||||||
|
|
||||||
|
function on_resume()
|
||||||
|
local args = get_args_kv()
|
||||||
|
|
||||||
|
widgets = args[1]
|
||||||
|
buttons = args[2]
|
||||||
|
colors = {}
|
||||||
|
|
||||||
|
for idx,widget in ipairs(widgets) do
|
||||||
|
if aio:is_widget_added(widget) then
|
||||||
|
colors[idx] = "#f44336"
|
||||||
|
else
|
||||||
|
colors[idx] = "#388e3c"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ui:show_buttons(buttons, colors)
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_click(idx)
|
||||||
|
local widget = widgets[idx]
|
||||||
|
|
||||||
|
if aio:is_widget_added(widget) then
|
||||||
|
aio:remove_widget(widget)
|
||||||
|
colors[idx] = "#388e3c"
|
||||||
|
else
|
||||||
|
aio:add_widget(widget)
|
||||||
|
colors[idx] = "#f44336"
|
||||||
|
end
|
||||||
|
|
||||||
|
ui:show_buttons(buttons, colors)
|
||||||
|
end
|
||||||
|
|
||||||
|
function get_args_kv()
|
||||||
|
local keys = {}
|
||||||
|
local values = {}
|
||||||
|
local args = aio:get_args()
|
||||||
|
|
||||||
|
for idx = 1, #args, 1 do
|
||||||
|
local arg = sx.split(args[idx], ":")
|
||||||
|
keys[idx] = arg[1]
|
||||||
|
values[idx] = arg[2]
|
||||||
|
end
|
||||||
|
|
||||||
|
return { keys, values }
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user