remove show_grid function #2

This commit is contained in:
Evgeny
2021-08-25 10:51:14 +03:00
parent 4a68d00e65
commit eec83ff345
3 changed files with 258 additions and 171 deletions

View File

@@ -14,7 +14,7 @@ function on_resume()
apps_names[k] = get_formatted_name(v)
end
ui:show_grid(slice(apps_names, 1, 9), 3)
ui:show_table(table_to_tables(slice(apps_names, 1, 9), 3))
end
function on_click(idx)
@@ -26,3 +26,18 @@ end
function get_formatted_name(pkg)
return "<font color=\""..apps:get_color(pkg).."\">"..apps:get_name(pkg).."</color>"
end
function table_to_tables(tab, num)
local out_tab = {}
local row = {}
for k,v in ipairs(tab) do
table.insert(row, v)
if k % num == 0 then
table.insert(out_tab, row)
row = {}
end
end
return out_tab
end