summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-06-27 12:22:53 +1000
committerjacqueline <me@jacqueline.id.au>2024-06-27 12:22:53 +1000
commit0bbf279e5ece83756f1463081a1ab6754721085e (patch)
tree3de60e8fe927b4bdfc334050ca01324c5bc7cb25
parentbfee3742d30c06e8b499a8b1353e892609ae2eb1 (diff)
downloadtangara-fw-0bbf279e5ece83756f1463081a1ab6754721085e.tar.gz
Add a button to shuffle+play the current view
-rw-r--r--lua/browser.lua10
-rw-r--r--lua/img/shuffleplay.pngbin0 -> 7894 bytes
-rw-r--r--lua/playing.lua3
3 files changed, 11 insertions, 2 deletions
diff --git a/lua/browser.lua b/lua/browser.lua
index 7ea8e240..ce0f7978 100644
--- a/lua/browser.lua
+++ b/lua/browser.lua
@@ -58,7 +58,7 @@ return screen:new{
flex = {
flex_direction = "row",
flex_wrap = "wrap",
- justify_content = "flex-end",
+ justify_content = "center",
align_items = "center",
align_content = "center"
},
@@ -72,6 +72,14 @@ return screen:new{
queue.add(original_iterator)
playback.playing:set(true)
end)
+ local shuffle_play = widgets.IconBtn(buttons, "//lua/img/shuffleplay.png", "Shuffle")
+ shuffle_play:onClicked(function()
+ queue.clear()
+ queue.random:set(true)
+ queue.add(original_iterator)
+ playback.playing:set(true)
+ backstack.push(playing:new())
+ end)
-- enqueue:add_flag(lvgl.FLAG.HIDDEN)
local play = widgets.IconBtn(buttons, "//lua/img/play_small.png", "Play")
play:onClicked(function()
diff --git a/lua/img/shuffleplay.png b/lua/img/shuffleplay.png
new file mode 100644
index 00000000..f22d2ffd
--- /dev/null
+++ b/lua/img/shuffleplay.png
Binary files differ
diff --git a/lua/playing.lua b/lua/playing.lua
index 71d95892..6a9488e2 100644
--- a/lua/playing.lua
+++ b/lua/playing.lua
@@ -243,8 +243,9 @@ return screen:new {
if not pos then return end
playlist_pos:set { text = tostring(pos) }
+ local can_next = pos < queue.size:get() or queue.random:get()
theme.set_style(
- next_img, pos < queue.size:get() and icon_enabled_class or icon_disabled_class
+ next_img, can_next and icon_enabled_class or icon_disabled_class
)
end),
queue.random:bind(function(shuffling)