mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +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 val startLock = Mutex()
|
||||||
|
|
||||||
private var snapshot: QueueSnapshot? = null
|
private var snapshot: QueueSnapshot? = null
|
||||||
private var lastDurationMs = 0L
|
|
||||||
private var lastError: String? = null
|
private var lastError: String? = null
|
||||||
private var queueSourceId: Long? = null
|
private var queueSourceId: Long? = null
|
||||||
private var windowStart = 0L
|
private var windowStart = 0L
|
||||||
@@ -229,7 +228,6 @@ class PlaybackController(
|
|||||||
windowJob?.cancel()
|
windowJob?.cancel()
|
||||||
windowStart = 0
|
windowStart = 0
|
||||||
windowEnd = -1
|
windowEnd = -1
|
||||||
lastDurationMs = 0
|
|
||||||
lastError = null
|
lastError = null
|
||||||
lastEdit = null
|
lastEdit = null
|
||||||
endedHandled = false
|
endedHandled = false
|
||||||
@@ -607,7 +605,6 @@ class PlaybackController(
|
|||||||
windowJob?.cancel()
|
windowJob?.cancel()
|
||||||
windowStart = 0
|
windowStart = 0
|
||||||
windowEnd = -1
|
windowEnd = -1
|
||||||
lastDurationMs = 0
|
|
||||||
lastError = null
|
lastError = null
|
||||||
lastEdit = null
|
lastEdit = null
|
||||||
endedHandled = false
|
endedHandled = false
|
||||||
@@ -682,7 +679,6 @@ class PlaybackController(
|
|||||||
bufferingJob = null
|
bufferingJob = null
|
||||||
showBuffering = false
|
showBuffering = false
|
||||||
snapshot = null
|
snapshot = null
|
||||||
lastDurationMs = 0
|
|
||||||
lastError = null
|
lastError = null
|
||||||
queueSourceId = null
|
queueSourceId = null
|
||||||
windowStart = 0
|
windowStart = 0
|
||||||
@@ -917,10 +913,10 @@ class PlaybackController(
|
|||||||
private fun refresh(position: Long? = currentPosition()) {
|
private fun refresh(position: Long? = currentPosition()) {
|
||||||
val player = player ?: return
|
val player = player ?: return
|
||||||
updateBuffering()
|
updateBuffering()
|
||||||
lastDurationMs =
|
val durationMs =
|
||||||
player.durationMs.takeIf { it > 0 }
|
player.durationMs.takeIf { it > 0 }
|
||||||
?: player.currentItem?.durationMs?.takeIf { it > 0 }
|
?: player.currentItem?.durationMs?.takeIf { it > 0 }
|
||||||
?: lastDurationMs
|
?: 0L
|
||||||
_state.value =
|
_state.value =
|
||||||
PlaybackState(
|
PlaybackState(
|
||||||
item = player.currentItem,
|
item = player.currentItem,
|
||||||
@@ -930,7 +926,7 @@ class PlaybackController(
|
|||||||
isBuffering = showBuffering,
|
isBuffering = showBuffering,
|
||||||
isPlaying = player.playWhenReady && !player.isIdle && !player.isEnded,
|
isPlaying = player.playWhenReady && !player.isIdle && !player.isEnded,
|
||||||
positionMs = player.currentPositionMs,
|
positionMs = player.currentPositionMs,
|
||||||
durationMs = lastDurationMs,
|
durationMs = durationMs,
|
||||||
hasNext = true,
|
hasNext = true,
|
||||||
hasPrevious = true,
|
hasPrevious = true,
|
||||||
shuffle = shuffleEnabled,
|
shuffle = shuffleEnabled,
|
||||||
|
|||||||
@@ -266,6 +266,12 @@ fun HeroHeader(
|
|||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
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) {
|
Box(contentAlignment = Alignment.Center) {
|
||||||
Row {
|
Row {
|
||||||
FilledIconButton(
|
FilledIconButton(
|
||||||
@@ -289,7 +295,7 @@ fun HeroHeader(
|
|||||||
Modifier
|
Modifier
|
||||||
.width(1.dp)
|
.width(1.dp)
|
||||||
.height(20.dp)
|
.height(20.dp)
|
||||||
.background(MaterialTheme.colorScheme.onPrimary.copy(alpha = 0.35f)),
|
.background(dividerColor),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user