fix(android): detekt LongMethod on NowPlayingScreen (61/60)
Adding the four shuffle/repeat parameters to the BottomActionsRow call pushed the function 1 line over the 60-line cap. Extracted the Column body into a private NowPlayingBody helper composable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -96,44 +96,57 @@ fun NowPlayingScreen(
|
||||
snackbarHost = { SnackbarHost(snackbarHostState) },
|
||||
containerColor = MaterialTheme.colorScheme.background,
|
||||
) { inner ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(inner)
|
||||
.padding(horizontal = 24.dp),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
NowPlayingCover(coverUrl = track.coverUrl, contentDescription = track.title)
|
||||
Spacer(Modifier.height(24.dp))
|
||||
TrackHeader(
|
||||
title = track.title,
|
||||
artist = track.artistName,
|
||||
album = track.albumTitle,
|
||||
)
|
||||
Spacer(Modifier.height(24.dp))
|
||||
ScrubberRow(
|
||||
positionMs = state.positionMs,
|
||||
durationMs = state.durationMs,
|
||||
onSeek = viewModel::seekTo,
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
TransportRow(
|
||||
isPlaying = state.isPlaying,
|
||||
onPrev = viewModel::skipToPrevious,
|
||||
onPlayPause = { if (state.isPlaying) viewModel.pause() else viewModel.play() },
|
||||
onNext = viewModel::skipToNext,
|
||||
)
|
||||
Spacer(Modifier.height(16.dp))
|
||||
BottomActionsRow(
|
||||
navController = navController,
|
||||
track = track,
|
||||
shuffleEnabled = state.shuffleEnabled,
|
||||
repeatMode = state.repeatMode,
|
||||
onToggleShuffle = viewModel::toggleShuffle,
|
||||
onCycleRepeat = viewModel::cycleRepeat,
|
||||
)
|
||||
}
|
||||
NowPlayingBody(
|
||||
inner = inner,
|
||||
state = state,
|
||||
track = track,
|
||||
navController = navController,
|
||||
viewModel = viewModel,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun NowPlayingBody(
|
||||
inner: androidx.compose.foundation.layout.PaddingValues,
|
||||
state: com.fabledsword.minstrel.player.PlayerUiState,
|
||||
track: com.fabledsword.minstrel.models.TrackRef,
|
||||
navController: NavHostController,
|
||||
viewModel: PlayerViewModel,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(inner)
|
||||
.padding(horizontal = 24.dp),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
NowPlayingCover(coverUrl = track.coverUrl, contentDescription = track.title)
|
||||
Spacer(Modifier.height(24.dp))
|
||||
TrackHeader(title = track.title, artist = track.artistName, album = track.albumTitle)
|
||||
Spacer(Modifier.height(24.dp))
|
||||
ScrubberRow(
|
||||
positionMs = state.positionMs,
|
||||
durationMs = state.durationMs,
|
||||
onSeek = viewModel::seekTo,
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
TransportRow(
|
||||
isPlaying = state.isPlaying,
|
||||
onPrev = viewModel::skipToPrevious,
|
||||
onPlayPause = { if (state.isPlaying) viewModel.pause() else viewModel.play() },
|
||||
onNext = viewModel::skipToNext,
|
||||
)
|
||||
Spacer(Modifier.height(16.dp))
|
||||
BottomActionsRow(
|
||||
navController = navController,
|
||||
track = track,
|
||||
shuffleEnabled = state.shuffleEnabled,
|
||||
repeatMode = state.repeatMode,
|
||||
onToggleShuffle = viewModel::toggleShuffle,
|
||||
onCycleRepeat = viewModel::cycleRepeat,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user