add apps module

This commit is contained in:
Evgeny
2021-08-19 15:41:40 +03:00
parent 5b8d6b57ff
commit f2e670b9a8
9 changed files with 77 additions and 8 deletions

View File

@@ -9,5 +9,5 @@ function on_resume()
end
function on_click(idx)
system:open_app(apps_pkgs[idx])
apps:launch(apps_pkgs[idx])
end

28
samples/apps-sample.lua Normal file
View File

@@ -0,0 +1,28 @@
-- global vars
all_apps = {}
function on_resume()
all_apps = apps:get_list("launch_count")
if (next(all_apps) == nil) then
ui:show_text("The list of apps is not ready yet")
return
end
local apps_names = {}
for k,v in ipairs(all_apps) do
apps_names[k] = get_formatted_name(v)
end
ui:show_table(slice(apps_names, 1, 9), 3)
end
function on_click(idx)
apps:launch(all_apps[idx])
end
-- utils
function get_formatted_name(pkg)
return "<font color=\""..apps:get_color(pkg).."\">"..apps:get_name(pkg).."</color>"
end

View File

@@ -1,11 +1,12 @@
function on_resume()
local table = {
"1", "20", "30",
"40", "5", "66",
"07", "28", "9",
"12345678", "", "",
"1", "2", "3",
"4", "5", "6",
"7", "8", "9",
}
ui:show_table(table, 3, true, "Nothing there")
ui:show_table(table, 3, true, false, "Nothing there")
end
function on_click(idx)