@@ -26,16 +26,23 @@ import androidx.compose.ui.tooling.preview.Preview
2626import androidx.compose.ui.tooling.preview.PreviewParameter
2727import androidx.compose.ui.unit.dp
2828import org.schabi.newpipe.extractor.stream.StreamInfoItem
29+ import org.schabi.newpipe.player.playqueue.PlayQueue
2930import org.schabi.newpipe.ui.components.menu.LongPressAction
3031import org.schabi.newpipe.ui.components.menu.LongPressMenu
3132import org.schabi.newpipe.ui.components.menu.LongPressable
3233import org.schabi.newpipe.ui.theme.AppTheme
3334
35+ /* *
36+ * @param getPlayQueueStartingAt a builder for a queue containing all of the items in this list,
37+ * with the queue index set to the item passed as parameter; return `null` if no "start playing from
38+ * here" options should be shown in the long press menu
39+ */
3440@OptIn(ExperimentalFoundationApi ::class , ExperimentalMaterial3Api ::class )
3541@Composable
3642fun StreamListItem (
3743 stream : StreamInfoItem ,
3844 showProgress : Boolean ,
45+ getPlayQueueStartingAt : ((item: StreamInfoItem ) -> PlayQueue )? = null,
3946 onClick : (StreamInfoItem ) -> Unit = {}
4047) {
4148 var showLongPressMenu by rememberSaveable { mutableStateOf(false ) }
@@ -79,8 +86,10 @@ fun StreamListItem(
7986 if (showLongPressMenu) {
8087 LongPressMenu (
8188 longPressable = LongPressable .fromStreamInfoItem(stream),
82- // TODO queueFromHere: allow playing the whole list starting from one stream
83- longPressActions = LongPressAction .fromStreamInfoItem(stream, null ),
89+ longPressActions = LongPressAction .fromStreamInfoItem(
90+ stream,
91+ getPlayQueueStartingAt?.let { { it(stream) } }
92+ ),
8493 onDismissRequest = { showLongPressMenu = false }
8594 )
8695 }
0 commit comments