Skip to content

Commit 2a28e7a

Browse files
committed
Make LongPressMenu scrollable if it does not fit on screen
1 parent a92c8b2 commit 2a28e7a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ import androidx.compose.foundation.layout.heightIn
2828
import androidx.compose.foundation.layout.padding
2929
import androidx.compose.foundation.layout.size
3030
import androidx.compose.foundation.layout.widthIn
31+
import androidx.compose.foundation.rememberScrollState
3132
import androidx.compose.foundation.text.InlineTextContent
3233
import androidx.compose.foundation.text.appendInlineContent
34+
import androidx.compose.foundation.verticalScroll
3335
import androidx.compose.material.icons.Icons
3436
import androidx.compose.material.icons.automirrored.filled.OpenInNew
3537
import androidx.compose.material.icons.automirrored.filled.PlaylistPlay
@@ -242,8 +244,12 @@ private fun LongPressMenuContent(
242244
// width for the landscape/reduced header, measured in button widths
243245
val headerWidthInButtonsReducedSpan = 4
244246
val buttonsPerRow = (this.maxWidth / MinButtonWidth).toInt()
247+
val scrollState = rememberScrollState()
245248

246-
Column {
249+
Column(
250+
modifier = Modifier
251+
.verticalScroll(scrollState)
252+
) {
247253
var actionIndex = if (header != null) -1 else 0 // -1 indicates the header
248254
while (actionIndex < actions.size) {
249255
Row(

0 commit comments

Comments
 (0)