Add small Edit button in LongPressMenu

This commit is contained in:
Stypox 2025-01-31 13:18:30 +01:00
parent 155fa05e9d
commit d4eb403e1d
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 30 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import androidx.compose.material.icons.filled.AddToQueue
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Done
import androidx.compose.material.icons.filled.Download
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.Headset
import androidx.compose.material.icons.filled.OpenInBrowser
import androidx.compose.material.icons.filled.Person
@ -33,8 +34,11 @@ import androidx.compose.material.icons.filled.PictureInPicture
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material.icons.filled.QueuePlayNext
import androidx.compose.material.icons.filled.Share
import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.OutlinedButton
@ -53,6 +57,8 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
@ -79,6 +85,29 @@ fun LongPressMenu(
ModalBottomSheet(
onDismissRequest,
sheetState = sheetState,
dragHandle = {
Box(
modifier = Modifier.fillMaxWidth()
) {
BottomSheetDefaults.DragHandle(
modifier = Modifier.align(Alignment.Center)
)
IconButton(
onClick = {},
modifier = Modifier.align(Alignment.CenterEnd)
) {
// show a small button here, it's not an important button and it shouldn't
// capture the user attention
Icon(
imageVector = Icons.Default.Edit,
contentDescription = stringResource(R.string.edit),
// same color and height as the DragHandle
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(2.dp).size(16.dp),
)
}
}
},
) {
BoxWithConstraints(
modifier = Modifier

View File

@ -871,6 +871,7 @@
<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>
<string name="auto_queue_description">Next</string>
<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>
<string name="edit">Edit</string>
<plurals name="comments">
<item quantity="one">%d comment</item>
<item quantity="other">%d comments</item>