11package org.schabi.newpipe.ui.components.items.stream
22
3- import androidx.annotation.StringRes
43import androidx.compose.material3.DropdownMenu
54import androidx.compose.material3.DropdownMenuItem
6- import androidx.compose.material3.MaterialTheme
75import androidx.compose.material3.Text
86import androidx.compose.runtime.Composable
97import androidx.compose.ui.platform.LocalContext
@@ -34,8 +32,8 @@ fun StreamMenu(
3432
3533 DropdownMenu (expanded = expanded, onDismissRequest = onDismissRequest) {
3634 if (playerHolder.isPlayQueueReady) {
37- StreamMenuItem (
38- text = R .string.enqueue_stream,
35+ DropdownMenuItem (
36+ text = { Text (text = stringResource( R .string.enqueue_stream)) } ,
3937 onClick = {
4038 onDismissRequest()
4139 SparseItemUtil .fetchItemInfoIfSparse(context, stream) {
@@ -45,8 +43,8 @@ fun StreamMenu(
4543 )
4644
4745 if (playerHolder.queuePosition < playerHolder.queueSize - 1 ) {
48- StreamMenuItem (
49- text = R .string.enqueue_next_stream,
46+ DropdownMenuItem (
47+ text = { Text (text = stringResource( R .string.enqueue_next_stream)) } ,
5048 onClick = {
5149 onDismissRequest()
5250 SparseItemUtil .fetchItemInfoIfSparse(context, stream) {
@@ -57,26 +55,26 @@ fun StreamMenu(
5755 }
5856 }
5957
60- StreamMenuItem (
61- text = R .string.start_here_on_background,
58+ DropdownMenuItem (
59+ text = { Text (text = stringResource( R .string.start_here_on_background)) } ,
6260 onClick = {
6361 onDismissRequest()
6462 SparseItemUtil .fetchItemInfoIfSparse(context, stream) {
6563 NavigationHelper .playOnBackgroundPlayer(context, it, true )
6664 }
6765 }
6866 )
69- StreamMenuItem (
70- text = R .string.start_here_on_popup,
67+ DropdownMenuItem (
68+ text = { Text (text = stringResource( R .string.start_here_on_popup)) } ,
7169 onClick = {
7270 onDismissRequest()
7371 SparseItemUtil .fetchItemInfoIfSparse(context, stream) {
7472 NavigationHelper .playOnPopupPlayer(context, it, true )
7573 }
7674 }
7775 )
78- StreamMenuItem (
79- text = R .string.download,
76+ DropdownMenuItem (
77+ text = { Text (text = stringResource( R .string.download)) } ,
8078 onClick = {
8179 onDismissRequest()
8280 SparseItemUtil .fetchStreamInfoAndSaveToDatabase(
@@ -89,8 +87,8 @@ fun StreamMenu(
8987 }
9088 }
9189 )
92- StreamMenuItem (
93- text = R .string.add_to_playlist,
90+ DropdownMenuItem (
91+ text = { Text (text = stringResource( R .string.add_to_playlist)) } ,
9492 onClick = {
9593 onDismissRequest()
9694 val list = listOf (StreamEntity (stream))
@@ -103,29 +101,29 @@ fun StreamMenu(
103101 }
104102 }
105103 )
106- StreamMenuItem (
107- text = R .string.share,
104+ DropdownMenuItem (
105+ text = { Text (text = stringResource( R .string.share)) } ,
108106 onClick = {
109107 onDismissRequest()
110108 ShareUtils .shareText(context, stream.name, stream.url, stream.thumbnails)
111109 }
112110 )
113- StreamMenuItem (
114- text = R .string.open_in_browser,
111+ DropdownMenuItem (
112+ text = { Text (text = stringResource( R .string.open_in_browser)) } ,
115113 onClick = {
116114 onDismissRequest()
117115 ShareUtils .openUrlInBrowser(context, stream.url)
118116 }
119117 )
120- StreamMenuItem (
121- text = R .string.mark_as_watched,
118+ DropdownMenuItem (
119+ text = { Text (text = stringResource( R .string.mark_as_watched)) } ,
122120 onClick = {
123121 onDismissRequest()
124122 streamViewModel.markAsWatched(stream)
125123 }
126124 )
127- StreamMenuItem (
128- text = R .string.show_channel_details,
125+ DropdownMenuItem (
126+ text = { Text (text = stringResource( R .string.show_channel_details)) } ,
129127 onClick = {
130128 onDismissRequest()
131129 SparseItemUtil .fetchUploaderUrlIfSparse(
@@ -138,16 +136,3 @@ fun StreamMenu(
138136 )
139137 }
140138}
141-
142- @Composable
143- private fun StreamMenuItem (
144- @StringRes text : Int ,
145- onClick : () -> Unit
146- ) {
147- DropdownMenuItem (
148- text = {
149- Text (text = stringResource(text), color = MaterialTheme .colorScheme.onBackground)
150- },
151- onClick = onClick
152- )
153- }
0 commit comments