Skip to content

Commit

Permalink
Improved sort song in playlist #852
Browse files Browse the repository at this point in the history
  • Loading branch information
fast4x committed Apr 26, 2024
1 parent f03e2bb commit a734144
Showing 1 changed file with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -724,26 +724,27 @@ fun LocalPlaylistSongs(
)
)

HeaderIconButton(
icon = if (isReorderDisabled) R.drawable.locked else R.drawable.unlocked,
enabled = playlistSongs.isNotEmpty() == true,
color = if (playlistSongs.isNotEmpty() == true) colorPalette.text else colorPalette.textDisabled,
onClick = {},
modifier = Modifier
.combinedClickable(
onClick = {
if (sortBy == PlaylistSongSortBy.Position && sortOrder == SortOrder.Ascending) {
isReorderDisabled = !isReorderDisabled
} else {
SmartToast("Reorder is possible only in ascending sort",
type = PopupType.Warning)
if (sortBy == PlaylistSongSortBy.Position && sortOrder == SortOrder.Ascending)
HeaderIconButton(
icon = if (isReorderDisabled) R.drawable.locked else R.drawable.unlocked,
enabled = playlistSongs.isNotEmpty() == true,
color = if (playlistSongs.isNotEmpty() == true) colorPalette.text else colorPalette.textDisabled,
onClick = {},
modifier = Modifier
.combinedClickable(
onClick = {
if (sortBy == PlaylistSongSortBy.Position && sortOrder == SortOrder.Ascending) {
isReorderDisabled = !isReorderDisabled
} else {
SmartToast("Reorder is possible only in ascending sort",
type = PopupType.Warning)
}
},
onLongClick = {
SmartToast(context.getString(R.string.info_lock_unlock_reorder_songs))
}
},
onLongClick = {
SmartToast(context.getString(R.string.info_lock_unlock_reorder_songs))
}
)
)
)
)

HeaderIconButton(
icon = R.drawable.downloaded,
Expand Down Expand Up @@ -1325,7 +1326,7 @@ fun LocalPlaylistSongs(
)
else checkedState.value = false

if (!isReorderDisabled) {
if (!isReorderDisabled && sortBy == PlaylistSongSortBy.Position && sortOrder == SortOrder.Ascending) {
IconButton(
icon = R.drawable.reorder,
color = colorPalette.textDisabled,
Expand Down

0 comments on commit a734144

Please sign in to comment.