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) },
|
snackbarHost = { SnackbarHost(snackbarHostState) },
|
||||||
containerColor = MaterialTheme.colorScheme.background,
|
containerColor = MaterialTheme.colorScheme.background,
|
||||||
) { inner ->
|
) { inner ->
|
||||||
Column(
|
NowPlayingBody(
|
||||||
modifier = Modifier
|
inner = inner,
|
||||||
.fillMaxSize()
|
state = state,
|
||||||
.padding(inner)
|
track = track,
|
||||||
.padding(horizontal = 24.dp),
|
navController = navController,
|
||||||
verticalArrangement = Arrangement.Center,
|
viewModel = viewModel,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
)
|
||||||
) {
|
}
|
||||||
NowPlayingCover(coverUrl = track.coverUrl, contentDescription = track.title)
|
}
|
||||||
Spacer(Modifier.height(24.dp))
|
|
||||||
TrackHeader(
|
@Composable
|
||||||
title = track.title,
|
private fun NowPlayingBody(
|
||||||
artist = track.artistName,
|
inner: androidx.compose.foundation.layout.PaddingValues,
|
||||||
album = track.albumTitle,
|
state: com.fabledsword.minstrel.player.PlayerUiState,
|
||||||
)
|
track: com.fabledsword.minstrel.models.TrackRef,
|
||||||
Spacer(Modifier.height(24.dp))
|
navController: NavHostController,
|
||||||
ScrubberRow(
|
viewModel: PlayerViewModel,
|
||||||
positionMs = state.positionMs,
|
) {
|
||||||
durationMs = state.durationMs,
|
Column(
|
||||||
onSeek = viewModel::seekTo,
|
modifier = Modifier
|
||||||
)
|
.fillMaxSize()
|
||||||
Spacer(Modifier.height(8.dp))
|
.padding(inner)
|
||||||
TransportRow(
|
.padding(horizontal = 24.dp),
|
||||||
isPlaying = state.isPlaying,
|
verticalArrangement = Arrangement.Center,
|
||||||
onPrev = viewModel::skipToPrevious,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
onPlayPause = { if (state.isPlaying) viewModel.pause() else viewModel.play() },
|
) {
|
||||||
onNext = viewModel::skipToNext,
|
NowPlayingCover(coverUrl = track.coverUrl, contentDescription = track.title)
|
||||||
)
|
Spacer(Modifier.height(24.dp))
|
||||||
Spacer(Modifier.height(16.dp))
|
TrackHeader(title = track.title, artist = track.artistName, album = track.albumTitle)
|
||||||
BottomActionsRow(
|
Spacer(Modifier.height(24.dp))
|
||||||
navController = navController,
|
ScrubberRow(
|
||||||
track = track,
|
positionMs = state.positionMs,
|
||||||
shuffleEnabled = state.shuffleEnabled,
|
durationMs = state.durationMs,
|
||||||
repeatMode = state.repeatMode,
|
onSeek = viewModel::seekTo,
|
||||||
onToggleShuffle = viewModel::toggleShuffle,
|
)
|
||||||
onCycleRepeat = viewModel::cycleRepeat,
|
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