Add a button to shuffle+play the current view

custom
jacqueline 10 months ago
parent bfee3742d3
commit 0bbf279e5e
  1. 10
      lua/browser.lua
  2. BIN
      lua/img/shuffleplay.png
  3. 3
      lua/playing.lua

@ -58,7 +58,7 @@ return screen:new{
flex = { flex = {
flex_direction = "row", flex_direction = "row",
flex_wrap = "wrap", flex_wrap = "wrap",
justify_content = "flex-end", justify_content = "center",
align_items = "center", align_items = "center",
align_content = "center" align_content = "center"
}, },
@ -72,6 +72,14 @@ return screen:new{
queue.add(original_iterator) queue.add(original_iterator)
playback.playing:set(true) playback.playing:set(true)
end) 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) -- enqueue:add_flag(lvgl.FLAG.HIDDEN)
local play = widgets.IconBtn(buttons, "//lua/img/play_small.png", "Play") local play = widgets.IconBtn(buttons, "//lua/img/play_small.png", "Play")
play:onClicked(function() play:onClicked(function()

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

@ -243,8 +243,9 @@ return screen:new {
if not pos then return end if not pos then return end
playlist_pos:set { text = tostring(pos) } playlist_pos:set { text = tostring(pos) }
local can_next = pos < queue.size:get() or queue.random:get()
theme.set_style( 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), end),
queue.random:bind(function(shuffling) queue.random:bind(function(shuffling)

Loading…
Cancel
Save