fix(android): detekt LongMethod on MiniRow (62/60)
a606267 inlined three IconButton blocks (Prev/Play-Pause/Next)
that pushed MiniRow 2 lines over. Extracted to a private
TransportButton helper — same surface, half the lines.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -203,27 +203,13 @@ private fun MiniRow(
|
||||
}
|
||||
}
|
||||
LikeButton(liked = isLiked, onToggle = onToggleLike)
|
||||
IconButton(onClick = onPrev) {
|
||||
Icon(
|
||||
imageVector = Lucide.SkipBack,
|
||||
contentDescription = "Previous",
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
}
|
||||
IconButton(onClick = onPlayPause) {
|
||||
Icon(
|
||||
imageVector = if (isPlaying) Lucide.Pause else Lucide.Play,
|
||||
contentDescription = if (isPlaying) "Pause" else "Play",
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
}
|
||||
IconButton(onClick = onNext) {
|
||||
Icon(
|
||||
imageVector = Lucide.SkipForward,
|
||||
contentDescription = "Next",
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
}
|
||||
TransportButton(icon = Lucide.SkipBack, description = "Previous", onClick = onPrev)
|
||||
TransportButton(
|
||||
icon = if (isPlaying) Lucide.Pause else Lucide.Play,
|
||||
description = if (isPlaying) "Pause" else "Play",
|
||||
onClick = onPlayPause,
|
||||
)
|
||||
TransportButton(icon = Lucide.SkipForward, description = "Next", onClick = onNext)
|
||||
// hideQueueActions=true: the playing track is itself the
|
||||
// queue entry, so Play next / Add to queue would be silly.
|
||||
TrackActionsButton(
|
||||
@@ -234,3 +220,18 @@ private fun MiniRow(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TransportButton(
|
||||
icon: androidx.compose.ui.graphics.vector.ImageVector,
|
||||
description: String,
|
||||
onClick: () -> Unit,
|
||||
) {
|
||||
IconButton(onClick = onClick) {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = description,
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user