diff --git a/app/src/main/java/com/rada/ui/library/LibraryScreen.kt b/app/src/main/java/com/rada/ui/library/LibraryScreen.kt index 04a7341..7b128c3 100644 --- a/app/src/main/java/com/rada/ui/library/LibraryScreen.kt +++ b/app/src/main/java/com/rada/ui/library/LibraryScreen.kt @@ -2,10 +2,9 @@ package com.rada.ui.library import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background import androidx.compose.foundation.clickable -import androidx.compose.foundation.combinedClickable +import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -64,6 +63,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp @@ -79,7 +79,7 @@ import com.rada.ui.theme.PremiumSurfaceVariant import com.rada.ui.theme.PremiumText import com.rada.ui.theme.PremiumTextSecondary -@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class) +@OptIn(ExperimentalMaterial3Api::class) @Composable fun LibraryScreen( onBack: () -> Unit, @@ -210,21 +210,24 @@ fun LibraryScreen( ) { tabLabels.forEachIndexed { index, label -> Tab( - modifier = Modifier.combinedClickable( - onClick = { - if (index == 0) { - viewModel.selectPlaylist(null) - } else { - viewModel.selectPlaylist(filteredPlaylists[index - 1].id) - } - }, - onLongClick = { - // Long-press a folder tab to delete the group. - if (index > 0) playlistToDelete = filteredPlaylists[index - 1] - }, - ), + // Long-press detected at the pointer level: putting + // combinedClickable here would be masked by Tab's own + // selectable semantics and break selection entirely. + modifier = Modifier.pointerInput(index) { + detectTapGestures( + onLongPress = { + if (index > 0) playlistToDelete = filteredPlaylists[index - 1] + }, + ) + }, selected = selectedTabIndex == index, - onClick = { }, + onClick = { + if (index == 0) { + viewModel.selectPlaylist(null) + } else { + viewModel.selectPlaylist(filteredPlaylists[index - 1].id) + } + }, text = { Text( text = label,