move default theme into styles, for easier lua overrides
This commit is contained in:
+3
-2
@@ -1,11 +1,10 @@
|
||||
local lvgl = require("lvgl")
|
||||
local widgets = require("widgets")
|
||||
local legacy_ui = require("legacy_ui")
|
||||
local database = require("database")
|
||||
local backstack = require("backstack")
|
||||
local font = require("font")
|
||||
local queue = require("queue")
|
||||
local playing = require("playing")
|
||||
local theme = require("theme")
|
||||
|
||||
local browser = {}
|
||||
|
||||
@@ -88,6 +87,7 @@ function browser.create(opts)
|
||||
|
||||
local back = screen.list:add_btn(nil, "< Back")
|
||||
back:onClicked(backstack.pop)
|
||||
back:add_style(theme.list_item)
|
||||
|
||||
screen.focused_item = 0
|
||||
screen.last_item = 0
|
||||
@@ -118,6 +118,7 @@ function browser.create(opts)
|
||||
screen.add_item(opts.iterator())
|
||||
end
|
||||
end)
|
||||
btn:add_style(theme.list_item)
|
||||
end
|
||||
|
||||
for _ = 1, 8 do
|
||||
|
||||
@@ -16,6 +16,8 @@ GLOBAL_BINDINGS = {
|
||||
},
|
||||
bg_opa = lvgl.OPA(100),
|
||||
bg_color = "#fafafa",
|
||||
radius = 8,
|
||||
pad_all = 2,
|
||||
})
|
||||
container:Label {
|
||||
text = string.format("Volume %i%%", pct),
|
||||
|
||||
+9
-3
@@ -5,6 +5,7 @@ local database = require("database")
|
||||
local backstack = require("backstack")
|
||||
local browser = require("browser")
|
||||
local playing = require("playing")
|
||||
local theme = require("theme")
|
||||
|
||||
return function()
|
||||
local menu = {}
|
||||
@@ -21,7 +22,7 @@ return function()
|
||||
})
|
||||
menu.root:center()
|
||||
|
||||
menu.status_bar = widgets.StatusBar(menu.root, {transparent_bg = true})
|
||||
menu.status_bar = widgets.StatusBar(menu.root, { transparent_bg = true })
|
||||
|
||||
menu.list = lvgl.List(menu.root, {
|
||||
w = lvgl.PCT(100),
|
||||
@@ -29,9 +30,11 @@ return function()
|
||||
flex_grow = 1,
|
||||
})
|
||||
|
||||
menu.list:add_btn(nil, "Now Playing"):onClicked(function()
|
||||
local now_playing = menu.list:add_btn(nil, "Now Playing")
|
||||
now_playing:onClicked(function()
|
||||
backstack.push(playing)
|
||||
end)
|
||||
now_playing:add_style(theme.list_item)
|
||||
|
||||
local indexes = database.indexes()
|
||||
for _, idx in ipairs(indexes) do
|
||||
@@ -44,11 +47,14 @@ return function()
|
||||
}
|
||||
end)
|
||||
end)
|
||||
btn:add_style(theme.list_item)
|
||||
end
|
||||
|
||||
menu.list:add_btn(nil, "Settings"):onClicked(function()
|
||||
local settings = menu.list:add_btn(nil, "Settings")
|
||||
settings:onClicked(function()
|
||||
legacy_ui.open_settings();
|
||||
end)
|
||||
settings:add_style(theme.list_item)
|
||||
|
||||
return menu
|
||||
end
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
local lvgl = require("lvgl")
|
||||
|
||||
local theme = {
|
||||
list_item = lvgl.Style {
|
||||
pad_left = 4,
|
||||
pad_right = 4,
|
||||
},
|
||||
}
|
||||
|
||||
return theme
|
||||
Reference in New Issue
Block a user