Move dev widgets to the dedicated folder
This commit is contained in:
23
dev/aioactionslist-widget.lua
Normal file
23
dev/aioactionslist-widget.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
-- name = "AΙΟ actions list"
|
||||
-- type = "widget"
|
||||
-- description = "Shows actions returned by aio:actions() function"
|
||||
--foldable = "true"
|
||||
-- author = "Theodor Galanis"
|
||||
-- version = "1"
|
||||
|
||||
function on_resume()
|
||||
actions = aio:actions()
|
||||
local labels = ""
|
||||
|
||||
labels = map(actions, function(it) return it.label end)
|
||||
names = map(actions, function(it) return it.name end)
|
||||
ui:show_lines(names, labels)
|
||||
end
|
||||
|
||||
function map(tbl, f)
|
||||
local ret = {}
|
||||
for k,v in pairs(tbl) do
|
||||
ret[k] = f(v)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
23
dev/aiocolors-widget.lua
Normal file
23
dev/aiocolors-widget.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
-- name = "AΙΟ colors"
|
||||
-- type = "widget"
|
||||
-- description = "Shows colors returned by aio:colors() function"
|
||||
--foldable = "true"
|
||||
-- author = "Theodor Galanis"
|
||||
-- version = "1"
|
||||
|
||||
function on_resume()
|
||||
local colors = aio:colors()
|
||||
local colors_strings = stringify_table(colors)
|
||||
|
||||
ui:show_lines(colors_strings)
|
||||
end
|
||||
|
||||
function stringify_table(tab)
|
||||
local new_tab = {}
|
||||
|
||||
for k,v in pairs(tab) do
|
||||
table.insert(new_tab, k..": "..tostring(v))
|
||||
end
|
||||
|
||||
return new_tab
|
||||
end
|
||||
23
dev/aiowidgetslist-widget.lua
Normal file
23
dev/aiowidgetslist-widget.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
-- name = "AΙΟ widgets list"
|
||||
-- type = "widget"
|
||||
-- description = "Shows widgets returned by aio:available_widgets() function"
|
||||
--foldable = "true"
|
||||
-- author = "Theodor Galanis"
|
||||
-- version = "1"
|
||||
|
||||
function on_resume()
|
||||
actions = aio:available_widgets()
|
||||
local labels = ""
|
||||
|
||||
labels = map(actions, function(it) return it.label end)
|
||||
names = map(actions, function(it) return it.name end)
|
||||
ui:show_lines(names, labels)
|
||||
end
|
||||
|
||||
function map(tbl, f)
|
||||
local ret = {}
|
||||
for k,v in pairs(tbl) do
|
||||
ret[k] = f(v)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
53
dev/android-widget-dumper.lua
Normal file
53
dev/android-widget-dumper.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
-- name = "Android widgets dumper"
|
||||
|
||||
-- Place app package name with widget here
|
||||
app_pkg = "com.weather.Weather"
|
||||
--app_pkg = "com.google.android.apps.tasks"
|
||||
--app_pkg = "com.android.chrome"
|
||||
--app_pkg = "com.whatsapp"
|
||||
|
||||
-- Globals
|
||||
labels = {}
|
||||
providers = {}
|
||||
dump = ""
|
||||
wid = -1
|
||||
|
||||
function on_resume()
|
||||
local list = widgets:list(app_pkg)
|
||||
|
||||
if list == nil then
|
||||
ui:show_text("Error: No widgets")
|
||||
return
|
||||
end
|
||||
|
||||
labels = map(function(it) return it.label end, list)
|
||||
providers = map(function(it) return it.provider end, list)
|
||||
|
||||
w_content = ""
|
||||
|
||||
if wid < 0 then
|
||||
ui:show_lines(labels)
|
||||
else
|
||||
widgets:request_updates(wid)
|
||||
end
|
||||
end
|
||||
|
||||
function on_click(idx)
|
||||
if w_content == "" then
|
||||
wid = widgets:setup(providers[idx])
|
||||
widgets:request_updates(wid)
|
||||
else
|
||||
system:copy_to_clipboard(w_content)
|
||||
end
|
||||
end
|
||||
|
||||
function on_app_widget_updated(bridge)
|
||||
local provider = bridge:provider()
|
||||
local dump = bridge:dump_tree()
|
||||
local colors = bridge:dump_colors()
|
||||
w_content = provider.."\n\n"..dump.."\n\n"..serialize(colors)
|
||||
|
||||
ui:show_text("%%txt%%"..w_content)
|
||||
debug:log("dump:\n\n"..w_content)
|
||||
end
|
||||
|
||||
22
dev/fmt-test.lua
Normal file
22
dev/fmt-test.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local fmt = require "fmt"
|
||||
|
||||
function on_resume()
|
||||
ui:show_lines{
|
||||
fmt.bold("bold"),
|
||||
fmt.italic("italic"),
|
||||
fmt.underline("underline"),
|
||||
fmt.primary("primary"),
|
||||
fmt.secondary("secondary"),
|
||||
fmt.red("red"),
|
||||
fmt.green("green"),
|
||||
fmt.blue("blue"),
|
||||
fmt.colored("lime", "#00FF00"),
|
||||
fmt.bg_colored(fmt.colored("lime background", "#000000"), "#00FF00"),
|
||||
fmt.small("small font"),
|
||||
fmt.big("big font"),
|
||||
fmt.strike("The crossed out text"),
|
||||
fmt.space().."start with space",
|
||||
fmt.space(4).."start with tab",
|
||||
fmt.escape("<b>not parsed</b>"),
|
||||
}
|
||||
end
|
||||
3
dev/mkd-test.lua
Normal file
3
dev/mkd-test.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
function on_resume()
|
||||
ui:show_text("%%mkd%%".."**Bold**, `Code`, *Italic*")
|
||||
end
|
||||
Reference in New Issue
Block a user