Skip to content

Commit

Permalink
Fix compact landscape player display
Browse files Browse the repository at this point in the history
  • Loading branch information
toasterofbread committed Apr 20, 2024
1 parent 05a55fb commit bf6a9b6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ fun NowPlayingContainer(
-getBottomBarHeight().roundToPx()
)
}
}
},
getAlpha = { expansion.getAbsolute() }
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ private const val MAX_WAVE_SPEED_PORTRAIT: Float = 0.3f
private const val MAX_WAVE_SPEED_LANDSCAPE: Float = 1f

@Composable
internal fun WaveBackground(page_height: Dp, modifier: Modifier = Modifier) {
internal fun WaveBackground(
page_height: Dp,
modifier: Modifier = Modifier,
getAlpha: () -> Float = { 1f }
) {
val player: PlayerState = LocalPlayerState.current
val expansion: NowPlayingExpansionState = LocalNowPlayingExpansion.current

Expand Down Expand Up @@ -68,7 +72,7 @@ internal fun WaveBackground(page_height: Dp, modifier: Modifier = Modifier) {
}

OverlappingWaves(
{ player.theme.accent.copy(alpha = wave_alpha) },
{ player.theme.accent.copy(alpha = wave_alpha * getAlpha()) },
BlendMode.Screen,
modifier
.fillMaxWidth(1f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private fun MainTabControls(
},
modifier.padding(top = 30.dp),
enabled = enabled,
vertical_arrangement = Arrangement.spacedBy(10.dp),
vertical_arrangement = Arrangement.spacedBy(10.dp, Alignment.CenterVertically),
title_text_max_lines = 2,
title_font_size = 25.sp,
artist_font_size = 18.sp,
Expand Down Expand Up @@ -257,9 +257,7 @@ internal fun NowPlayingMainTabPage.NowPlayingMainTabLarge(page_height: Dp, top_b
button_size = 50.dp,
seek_bar_next_to_buttons = !compact_mode,
modifier = Modifier
.thenIf(!compact_mode) {
requiredHeight(controls_target_height * ((absolute_expansion - 0.5f) * 2f))
}
.requiredHeight((if (compact_mode) controls_target_height + 200.dp else controls_target_height) * ((absolute_expansion - 0.5f) * 2f))
.scale(1f, absolute_expansion)
.padding(bottom = CONTROLS_IMAGE_SEPARATION_DP.dp),
textRowStartContent = {
Expand All @@ -283,10 +281,12 @@ internal fun NowPlayingMainTabPage.NowPlayingMainTabLarge(page_height: Dp, top_b
}
)

val thumbnail_row_height: Dp =
val max_thumbnail_row_height: Dp =
if (compact_mode) (1f - absolute_expansion) * thumb_size
else thumb_size

val thumbnail_row_height: Dp = (min_height + ((max_thumbnail_row_height - min_height) * absolute_expansion)).coerceAtLeast(min_height)

if (!compact_mode || absolute_expansion < 1f) {
LargeThumbnailRow(
Modifier
Expand Down Expand Up @@ -338,7 +338,12 @@ internal fun NowPlayingMainTabPage.NowPlayingMainTabLarge(page_height: Dp, top_b
inner_bottom_padding = inner_bottom_padding,
stroke_colour = stroke_colour,
page_height = page_height,
modifier = Modifier.padding(start = INNER_PADDING_DP.dp)
modifier =
Modifier
.padding(start = INNER_PADDING_DP.dp)
.graphicsLayer {
alpha = absolute_expansion
}
)
}
}
Expand Down

0 comments on commit bf6a9b6

Please sign in to comment.