Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Jul 25, 2024
1 parent 01c91ed commit 27138bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ fun PillarboxSlider(
onSeekForward: () -> Unit = {},
) {
PillarboxSliderInternal(
activeTrackWeight = value / range.endInclusive.toFloat(),
activeTrackWeight = value / range.last.toFloat(),
compactMode = compactMode,
modifier = modifier,
secondaryValueWeight = secondaryValue?.let { it / range.endInclusive.toFloat() },
secondaryValueWeight = secondaryValue?.let { it / range.last.toFloat() },
enabled = enabled,
thumbColorEnabled = thumbColorEnabled,
thumbColorDisabled = thumbColorDisabled,
Expand All @@ -109,7 +109,7 @@ fun PillarboxSlider(
secondaryTrackColorDisabled = secondaryTrackColorDisabled,
interactionSource = interactionSource,
onSliderValueChange = { ratio ->
onValueChange((ratio * (range.endInclusive - range.start)).toLong())
onValueChange((ratio * (range.last - range.start)).toLong())
},
onSliderValueChangeFinished = onValueChangeFinished,
onSeekBack = onSeekBack,
Expand Down Expand Up @@ -211,13 +211,13 @@ private fun PillarboxSliderInternal(
val seekBarHeight by animateDpAsState(targetValue = if (compactMode) 8.dp else 16.dp, label = "seek_bar_height")
val thumbColor by animateColorAsState(targetValue = if (enabled) thumbColorEnabled else thumbColorDisabled, label = "thumb_color")

val activeTrackWeight by animateFloatAsState(targetValue = activeTrackWeight, label = "active_track_weight")
val animatedActiveTrackWeight by animateFloatAsState(targetValue = activeTrackWeight, label = "active_track_weight")
val activeTrackColor by animateColorAsState(
targetValue = if (enabled) activeTrackColorEnabled else activeTrackColorDisabled,
label = "active_track_color",
)

val inactiveTrackWeight by animateFloatAsState(targetValue = 1f - activeTrackWeight, label = "inactive_track_weight")
val inactiveTrackWeight by animateFloatAsState(targetValue = 1f - animatedActiveTrackWeight, label = "inactive_track_weight")
val inactiveTrackColor by animateColorAsState(
targetValue = if (enabled) inactiveTrackColorEnabled else inactiveTrackColorDisabled,
label = "inactive_track_color",
Expand All @@ -244,7 +244,7 @@ private fun PillarboxSliderInternal(
horizontalArrangement = Arrangement.spacedBy(6.dp),
) {
Track(
weight = activeTrackWeight,
weight = animatedActiveTrackWeight,
color = activeTrackColor,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ private fun AdaptivePlayer(player: Player, modifier: Modifier = Modifier) {
val (widthPercent, setWidthPercent) = remember { mutableFloatStateOf(1f) }
val (heightPercent, setHeightPercent) = remember { mutableFloatStateOf(1f) }

BoxWithConstraints(
modifier = modifier.background(Color.Black),
) {
BoxWithConstraints(modifier = modifier) {
val playerWidth by animateDpAsState(targetValue = maxWidth * widthPercent, label = "player_width")
val playerHeight by animateDpAsState(targetValue = maxHeight * heightPercent, label = "player_height")

Expand All @@ -90,7 +88,9 @@ private fun AdaptivePlayer(player: Player, modifier: Modifier = Modifier) {
contentAlignment = Alignment.Center,
) {
PlayerSurface(
modifier = Modifier.matchParentSize(),
modifier = Modifier
.matchParentSize()
.background(Color.Black),
player = player,
displayDebugView = true,
contentAlignment = Alignment.Center,
Expand Down

0 comments on commit 27138bb

Please sign in to comment.