|
|
@ -10,68 +10,69 @@ local theme = require("theme") |
|
|
|
local screen = require("screen") |
|
|
|
local screen = require("screen") |
|
|
|
local filesystem = require("filesystem") |
|
|
|
local filesystem = require("filesystem") |
|
|
|
|
|
|
|
|
|
|
|
return screen:new{ |
|
|
|
return screen:new { |
|
|
|
createUi = function(self) |
|
|
|
createUi = function(self) |
|
|
|
self.root = lvgl.Object(nil, { |
|
|
|
self.root = lvgl.Object(nil, { |
|
|
|
flex = { |
|
|
|
flex = { |
|
|
|
flex_direction = "column", |
|
|
|
flex_direction = "column", |
|
|
|
flex_wrap = "wrap", |
|
|
|
flex_wrap = "wrap", |
|
|
|
justify_content = "flex-start", |
|
|
|
justify_content = "flex-start", |
|
|
|
align_items = "flex-start", |
|
|
|
align_items = "flex-start", |
|
|
|
align_content = "flex-start" |
|
|
|
align_content = "flex-start" |
|
|
|
}, |
|
|
|
}, |
|
|
|
w = lvgl.HOR_RES(), |
|
|
|
w = lvgl.HOR_RES(), |
|
|
|
h = lvgl.VER_RES() |
|
|
|
h = lvgl.VER_RES() |
|
|
|
}) |
|
|
|
}) |
|
|
|
self.root:center() |
|
|
|
self.root:center() |
|
|
|
|
|
|
|
|
|
|
|
self.status_bar = widgets.StatusBar(self, { |
|
|
|
self.status_bar = widgets.StatusBar(self, { |
|
|
|
back_cb = backstack.pop, |
|
|
|
back_cb = backstack.pop, |
|
|
|
title = self.title |
|
|
|
title = self.title |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
local header = self.root:Object{ |
|
|
|
local header = self.root:Object { |
|
|
|
flex = { |
|
|
|
flex = { |
|
|
|
flex_direction = "column", |
|
|
|
flex_direction = "column", |
|
|
|
flex_wrap = "wrap", |
|
|
|
flex_wrap = "wrap", |
|
|
|
justify_content = "flex-start", |
|
|
|
justify_content = "flex-start", |
|
|
|
align_items = "flex-start", |
|
|
|
align_items = "flex-start", |
|
|
|
align_content = "flex-start" |
|
|
|
align_content = "flex-start" |
|
|
|
}, |
|
|
|
}, |
|
|
|
w = lvgl.HOR_RES(), |
|
|
|
w = lvgl.HOR_RES(), |
|
|
|
h = lvgl.SIZE_CONTENT, |
|
|
|
h = lvgl.SIZE_CONTENT, |
|
|
|
pad_left = 4, |
|
|
|
pad_left = 4, |
|
|
|
pad_right = 4, |
|
|
|
pad_right = 4, |
|
|
|
pad_bottom = 2, |
|
|
|
pad_bottom = 2, |
|
|
|
bg_opa = lvgl.OPA(100), |
|
|
|
bg_opa = lvgl.OPA(100), |
|
|
|
scrollbar_mode = lvgl.SCROLLBAR_MODE.OFF |
|
|
|
scrollbar_mode = lvgl.SCROLLBAR_MODE.OFF |
|
|
|
} |
|
|
|
} |
|
|
|
theme.set_style(header, "header") |
|
|
|
theme.set_style(header, "header") |
|
|
|
|
|
|
|
|
|
|
|
if self.breadcrumb then |
|
|
|
if self.breadcrumb then |
|
|
|
header:Label{ |
|
|
|
header:Label { |
|
|
|
text = self.breadcrumb, |
|
|
|
text = self.breadcrumb, |
|
|
|
text_font = font.fusion_10 |
|
|
|
text_font = font.fusion_10 |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets.InfiniteList(self.root, self.iterator, { |
|
|
|
|
|
|
|
callback = function(item) |
|
|
|
|
|
|
|
return function() |
|
|
|
|
|
|
|
local is_dir = item:is_directory() |
|
|
|
|
|
|
|
if is_dir then |
|
|
|
|
|
|
|
backstack.push(require("file_browser"):new{ |
|
|
|
|
|
|
|
title = self.title, |
|
|
|
|
|
|
|
iterator = filesystem.iterator(item:filepath()), |
|
|
|
|
|
|
|
breadcrumb = item:filepath() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
if item:filepath():match("%.playlist$") then |
|
|
|
|
|
|
|
queue.open_playlist(item:filepath()) |
|
|
|
|
|
|
|
backstack.push(playing:new()) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets.InfiniteList(self.root, self.iterator, { |
|
|
|
|
|
|
|
callback = function(item) |
|
|
|
|
|
|
|
return function() |
|
|
|
|
|
|
|
local is_dir = item:is_directory() |
|
|
|
|
|
|
|
if is_dir then |
|
|
|
|
|
|
|
backstack.push(require("file_browser"):new { |
|
|
|
|
|
|
|
title = self.title, |
|
|
|
|
|
|
|
iterator = filesystem.iterator(item:filepath()), |
|
|
|
|
|
|
|
breadcrumb = item:filepath() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
if item:filepath():match("%.playlist$") then |
|
|
|
|
|
|
|
queue.open_playlist(item:filepath()) |
|
|
|
|
|
|
|
playback.playing:set(true) |
|
|
|
|
|
|
|
backstack.push(playing:new()) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
end |
|
|
|
} |
|
|
|
} |
|
|
|