mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
address review: drop the stale duration carry, tint the split pill divider when disabled
This commit is contained in:
@@ -114,7 +114,6 @@ class PlaybackController(
|
||||
private val startLock = Mutex()
|
||||
|
||||
private var snapshot: QueueSnapshot? = null
|
||||
private var lastDurationMs = 0L
|
||||
private var lastError: String? = null
|
||||
private var queueSourceId: Long? = null
|
||||
private var windowStart = 0L
|
||||
@@ -229,7 +228,6 @@ class PlaybackController(
|
||||
windowJob?.cancel()
|
||||
windowStart = 0
|
||||
windowEnd = -1
|
||||
lastDurationMs = 0
|
||||
lastError = null
|
||||
lastEdit = null
|
||||
endedHandled = false
|
||||
@@ -607,7 +605,6 @@ class PlaybackController(
|
||||
windowJob?.cancel()
|
||||
windowStart = 0
|
||||
windowEnd = -1
|
||||
lastDurationMs = 0
|
||||
lastError = null
|
||||
lastEdit = null
|
||||
endedHandled = false
|
||||
@@ -682,7 +679,6 @@ class PlaybackController(
|
||||
bufferingJob = null
|
||||
showBuffering = false
|
||||
snapshot = null
|
||||
lastDurationMs = 0
|
||||
lastError = null
|
||||
queueSourceId = null
|
||||
windowStart = 0
|
||||
@@ -917,10 +913,10 @@ class PlaybackController(
|
||||
private fun refresh(position: Long? = currentPosition()) {
|
||||
val player = player ?: return
|
||||
updateBuffering()
|
||||
lastDurationMs =
|
||||
val durationMs =
|
||||
player.durationMs.takeIf { it > 0 }
|
||||
?: player.currentItem?.durationMs?.takeIf { it > 0 }
|
||||
?: lastDurationMs
|
||||
?: 0L
|
||||
_state.value =
|
||||
PlaybackState(
|
||||
item = player.currentItem,
|
||||
@@ -930,7 +926,7 @@ class PlaybackController(
|
||||
isBuffering = showBuffering,
|
||||
isPlaying = player.playWhenReady && !player.isIdle && !player.isEnded,
|
||||
positionMs = player.currentPositionMs,
|
||||
durationMs = lastDurationMs,
|
||||
durationMs = durationMs,
|
||||
hasNext = true,
|
||||
hasPrevious = true,
|
||||
shuffle = shuffleEnabled,
|
||||
|
||||
@@ -266,6 +266,12 @@ fun HeroHeader(
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
val dividerColor =
|
||||
if (hasSongs) {
|
||||
MaterialTheme.colorScheme.onPrimary.copy(alpha = 0.35f)
|
||||
} else {
|
||||
MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f)
|
||||
}
|
||||
Box(contentAlignment = Alignment.Center) {
|
||||
Row {
|
||||
FilledIconButton(
|
||||
@@ -289,7 +295,7 @@ fun HeroHeader(
|
||||
Modifier
|
||||
.width(1.dp)
|
||||
.height(20.dp)
|
||||
.background(MaterialTheme.colorScheme.onPrimary.copy(alpha = 0.35f)),
|
||||
.background(dividerColor),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user