diff --git a/community/amdroid-nextalarm-app-widget.lua b/community/amdroid-nextalarm-app-widget.lua new file mode 100644 index 0000000..2f067ce --- /dev/null +++ b/community/amdroid-nextalarm-app-widget.lua @@ -0,0 +1,48 @@ +-- name = "Amdroid Next Alarm" +-- description = "AIO wrapper for the Amdroid next alarm app widget" +-- type = "widget" +-- author = "Theodor Galanis" +-- version = "1.0" +-- foldable = "false" +-- uses_app = "com.amdroidalarmclock.amdroid" + +local prefs = require "prefs" + +local next_alarm = "" +local w_bridge = nil + +function on_resume() + if not widgets:bound(prefs.wid) then + setup_app_widget() + end + + widgets:request_updates(prefs.wid) +end + +function on_app_widget_updated(bridge) + local tab = bridge:dump_table() + + next_alarm = tab.v_layout_1.text_1 + w_bridge = bridge + + if next_alarm ~= nil + then + ui:show_table({{" ", "%%fa:alarm-clock%% "..next_alarm, " "}}, 0, true) + else + ui:show_text("Empty") + end +end + +function on_click(idx) + w_bridge:click(next_alarm) +end + +function setup_app_widget() + local id = widgets:setup("com.amdroidalarmclock.amdroid/com.amdroidalarmclock.amdroid.widgets.NextAlarmWidgetProvider") + + if (id ~= nil) then + prefs.wid = id + else + ui:show_text("Can't add widget") + end +end diff --git a/community/google-search-app-widget.lua b/community/google-search-app-widget.lua new file mode 100644 index 0000000..9190cdd --- /dev/null +++ b/community/google-search-app-widget.lua @@ -0,0 +1,41 @@ +-- name = "Google search" +-- description = "AIO wrapper for the Google search app widget" +-- type = "widget" +-- author = "Theodor Galanis" +-- version = "1.0" +-- foldable = "false" +-- uses_app: "com.google.android.googlequicksearchbox"" + +local prefs = require "prefs" + +local buttons_labels = {"GOOGLE", "fa:magnifying-glass", "fa:microphone", "fa:camera"} +local buttons_targets = {"image_3", "image_2", "image_5", "image_6"} +local w_bridge = nil + +function on_resume() + if not widgets:bound(prefs.wid) then + setup_app_widget() + end + + widgets:request_updates(prefs.wid) +end + +function on_app_widget_updated(bridge) + w_bridge = bridge + ui:show_buttons(buttons_labels) +end + +function on_click(idx) + w_bridge:click(buttons_targets[idx]) +end + +function setup_app_widget() + local id = widgets:setup("com.google.android.googlequicksearchbox/com.google.android.googlequicksearchbox.SearchWidgetProvider") + + if (id ~= nil) then + prefs.wid = id + else + ui:show_text("Can't add widget") + return + end +end