Skip to content

Commit

Permalink
fix: fix select also showing menu
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcarter11 committed Jan 3, 2025
1 parent 5626fbe commit 267e1eb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
24 changes: 13 additions & 11 deletions app/src/main/java/com/dd3boh/outertune/ui/component/Items.kt
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ fun SongListItem(
song: Song,
onPlay: () -> Unit,
onSelectedChange: (Boolean) -> Unit,
inSelectMode: Boolean,
inSelectMode: Boolean?,
isSelected: Boolean,
navController: NavController,
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -420,7 +420,7 @@ fun SongListItem(
},
trailingContent = {
if (available) {
if (inSelectMode) {
if (inSelectMode == true) {
Checkbox(
checked = isSelected,
onCheckedChange = onSelectedChange
Expand Down Expand Up @@ -462,13 +462,13 @@ fun SongListItem(
}
}
},
isSelected = inSelectMode && isSelected,
isSelected = inSelectMode == true && isSelected,
isActive = isActive,
available = available,
modifier = modifier.combinedClickable(
onClick = {
if (available) {
if (inSelectMode) {
if (inSelectMode == true) {
onSelectedChange(!isSelected)
} else if (song.id == mediaMetadata?.id) {
playerConnection.player.togglePlayPause()
Expand All @@ -479,14 +479,16 @@ fun SongListItem(
},
onLongClick = {
if (available) {
menuState.show {
SongMenu(
originalSong = song,
navController = navController,
onDismiss = menuState::dismiss
)
if (inSelectMode == null){
menuState.show {
SongMenu(
originalSong = song,
navController = navController,
onDismiss = menuState::dismiss
)
}
}
if (!inSelectMode) {
else if (!inSelectMode) {
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
onSelectedChange(true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ fun HomeScreen(
playerConnection.playQueue(YouTubeQueue.radio(song!!.toMediaMetadata()))
},
onSelectedChange = {},
inSelectMode = false,
inSelectMode = null,
isSelected = false,
navController = navController,
modifier = Modifier.width(horizontalLazyGridItemWidth)
Expand Down Expand Up @@ -509,7 +509,7 @@ fun HomeScreen(
playerConnection.playQueue(YouTubeQueue.radio(song!!.toMediaMetadata()))
},
onSelectedChange = {},
inSelectMode = false,
inSelectMode = null,
isSelected = false,
navController = navController,
modifier = Modifier.width(horizontalLazyGridItemWidth)
Expand Down Expand Up @@ -642,7 +642,7 @@ fun HomeScreen(
playerConnection.playQueue(YouTubeQueue.radio(song!!.toMediaMetadata()))
},
onSelectedChange = {},
inSelectMode = false,
inSelectMode = null,
isSelected = false,
navController = navController,
modifier = Modifier.width(horizontalLazyGridItemWidth)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ fun SetupWizard(
song = song,
onPlay = {},
onSelectedChange = {},
inSelectMode = false,
inSelectMode = null,
isSelected = false,
navController = navController,
enableSwipeToQueue = false,
Expand Down

0 comments on commit 267e1eb

Please sign in to comment.