Skip to content

Commit 56e5475

Browse files
committed
Add small Edit button in LongPressMenu
1 parent b377cef commit 56e5475

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
@@ -867,6 +867,7 @@
867867
<string name="migration_info_6_7_message">SoundCloud has discontinued the original Top 50 charts. The corresponding tab has been removed from your main page.</string>
868868
<string name="auto_queue_description">Next</string>
869869
<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>
870+
<string name="edit">Edit</string>
870871
<plurals name="comments">
871872
<item quantity="one">%d comment</item>
872873
<item quantity="other">%d comments</item>

0 commit comments

Comments
 (0)