update amdroid widget

This commit is contained in:
Evgeny
2024-04-14 15:47:42 +04:00
parent 076af78f83
commit a94a44c43d
2 changed files with 31 additions and 6 deletions

View File

@@ -2,20 +2,20 @@
-- description = "AIO wrapper for the Amdroid next alarm app widget" -- description = "AIO wrapper for the Amdroid next alarm app widget"
-- type = "widget" -- type = "widget"
-- author = "Theodor Galanis" -- author = "Theodor Galanis"
-- version = "1.0" -- version = "1.0.2"
-- foldable = "false" -- foldable = "false"
-- uses_app = "com.amdroidalarmclock.amdroid" -- uses_app = "com.amdroidalarmclock.amdroid"
local prefs = require "prefs" local prefs = require "prefs"
local next_alarm = "" local next_alarm = ""
local w_bridge = nil local accent="#FFFFFF"
function on_resume() function on_resume()
if not widgets:bound(prefs.wid) then if not widgets:bound(prefs.wid) then
setup_app_widget() setup_app_widget()
end end
accent = aio:colors().accent
widgets:request_updates(prefs.wid) widgets:request_updates(prefs.wid)
end end
@@ -26,11 +26,16 @@ function on_app_widget_updated(bridge)
w_bridge = bridge w_bridge = bridge
if next_alarm ~= nil if next_alarm ~= nil
then then
ui:show_table({{" ", "%%fa:alarm-clock%% "..next_alarm, " "}}, 0, true) my_gui=gui{
{"text", " %%fa:alarm-clock%% <span style=\"color:#FFFFFF\">"..next_alarm.."</span>", {gravity="center_h", color=accent}}
}
else else
ui:show_text("Empty") my_gui=gui{
{"text", "Empty", {gravity="center_h" }}
}
end end
my_gui.render()
end end
function on_click(idx) function on_click(idx)

View File

@@ -0,0 +1,20 @@
function on_resume()
ui:show_lines{
"Set progress 25%",
"Set progress 50%",
"Set progress 75%",
"Set progress 100%",
}
end
function on_click(idx)
if idx == 1 then
ui:set_progress(0.25)
elseif idx == 2 then
ui:set_progress(0.5)
elseif idx == 3 then
ui:set_progress(0.75)
elseif idx == 4 then
ui:set_progress(1)
end
end