Skip to content

Commit 18abe2c

Browse files
committed
Add small Edit button in LongPressMenu
1 parent 68e8899 commit 18abe2c

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

app/src/main/java/org/schabi/newpipe/ui/components/menu/LongPressMenu.kt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,19 @@ import androidx.compose.material.icons.filled.AddToQueue
2626
import androidx.compose.material.icons.filled.Delete
2727
import androidx.compose.material.icons.filled.Done
2828
import androidx.compose.material.icons.filled.Download
29+
import androidx.compose.material.icons.filled.Edit
2930
import androidx.compose.material.icons.filled.Headset
3031
import androidx.compose.material.icons.filled.OpenInBrowser
3132
import androidx.compose.material.icons.filled.Person
3233
import androidx.compose.material.icons.filled.PictureInPicture
3334
import androidx.compose.material.icons.filled.PlayArrow
3435
import androidx.compose.material.icons.filled.QueuePlayNext
3536
import androidx.compose.material.icons.filled.Share
37+
import androidx.compose.material3.BottomSheetDefaults
3638
import androidx.compose.material3.ExperimentalMaterial3Api
3739
import androidx.compose.material3.Icon
40+
import androidx.compose.material3.IconButton
41+
import androidx.compose.material3.LocalContentColor
3842
import androidx.compose.material3.MaterialTheme
3943
import androidx.compose.material3.ModalBottomSheet
4044
import androidx.compose.material3.OutlinedButton
@@ -53,6 +57,8 @@ import androidx.compose.ui.graphics.vector.ImageVector
5357
import androidx.compose.ui.platform.LocalContext
5458
import androidx.compose.ui.res.painterResource
5559
import androidx.compose.ui.res.stringResource
60+
import androidx.compose.ui.semantics.contentDescription
61+
import androidx.compose.ui.semantics.semantics
5662
import androidx.compose.ui.text.style.TextAlign
5763
import androidx.compose.ui.tooling.preview.Preview
5864
import androidx.compose.ui.tooling.preview.PreviewParameter
@@ -79,6 +85,29 @@ fun LongPressMenu(
7985
ModalBottomSheet(
8086
onDismissRequest,
8187
sheetState = sheetState,
88+
dragHandle = {
89+
Box(
90+
modifier = Modifier.fillMaxWidth()
91+
) {
92+
BottomSheetDefaults.DragHandle(
93+
modifier = Modifier.align(Alignment.Center)
94+
)
95+
IconButton(
96+
onClick = {},
97+
modifier = Modifier.align(Alignment.CenterEnd)
98+
) {
99+
// show a small button here, it's not an important button and it shouldn't
100+
// capture the user attention
101+
Icon(
102+
imageVector = Icons.Default.Edit,
103+
contentDescription = stringResource(R.string.edit),
104+
// same color and height as the DragHandle
105+
tint = MaterialTheme.colorScheme.onSurfaceVariant,
106+
modifier = Modifier.padding(2.dp).size(16.dp),
107+
)
108+
}
109+
}
110+
},
82111
) {
83112
BoxWithConstraints(
84113
modifier = Modifier

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@
863863
<string name="import_settings_vulnerable_format">The settings in the export being imported use a vulnerable format that was deprecated since NewPipe 0.27.0. Make sure the export being imported is from a trusted source, and prefer using only exports obtained from NewPipe 0.27.0 or newer in the future. Support for importing settings in this vulnerable format will soon be removed completely, and then old versions of NewPipe will not be able to import settings of exports from new versions anymore.</string>
864864
<string name="auto_queue_description">Next</string>
865865
<string name="newpipe_extractor_description">NewPipeExtractor is a library for extracting things from streaming sites. It is a core component of NewPipe, but could be used independently.</string>
866+
<string name="edit">Edit</string>
866867
<plurals name="comments">
867868
<item quantity="one">%d comment</item>
868869
<item quantity="other">%d comments</item>

0 commit comments

Comments
 (0)