blob: 5fd6417fa57413da8bc1cf0e6d016fec362f587a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
local lvgl = require("lvgl")
local widgets = require("widgets")
local database = require("database")
local backstack = require("backstack")
local browser = require("browser")
local playing = require("playing")
local styles = require("styles")
local screen = require("screen")
return widgets.MenuScreen:new {
createUi = function(self)
widgets.MenuScreen.createUi(self)
local list = lvgl.List(self.root, {
w = lvgl.PCT(100),
h = lvgl.PCT(100),
flex_grow = 1,
})
local now_playing = list:add_btn(nil, "Now Playing")
now_playing:onClicked(function()
backstack.push(playing:new())
end)
now_playing:add_style(styles.list_item)
local indexes = database.indexes()
for _, idx in ipairs(indexes) do
local btn = list:add_btn(nil, tostring(idx))
btn:onClicked(function()
backstack.push(browser:new {
title = tostring(idx),
iterator = idx:iter(),
})
end)
btn:add_style(styles.list_item)
end
local settings = list:add_btn(nil, "Settings")
settings:onClicked(function()
backstack.push(require("settings"):new())
end)
settings:add_style(styles.list_item)
end,
}
|