Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick fix #18

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ android {
applicationId = "com.rld.justlisten.android"
minSdk = 21
targetSdk = 34
versionCode = 24
versionName = "1.0.8"
versionCode = 25
versionName = "1.0.9"
vectorDrawables {
useSupportLibrary = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fun PlayerBarSheetContent(
)
}
},
sheetPeekHeight = (-1).dp
sheetPeekHeight = 0.dp
) {
PlayerBottomBar(
onCollapsedClicked = onCollapsedClicked,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.rld.justlisten.android.R
import com.rld.justlisten.android.exoplayer.MusicService
import com.rld.justlisten.android.exoplayer.MusicServiceConnection
import com.rld.justlisten.android.ui.extensions.ModifiedSlider
import com.rld.justlisten.android.ui.utils.offsetX
import com.rld.justlisten.android.ui.utils.widthSize
import kotlinx.coroutines.InternalCoroutinesApi
Expand All @@ -44,28 +42,32 @@ fun PlayBarActionsMaximized(
is PressInteraction.Press -> {
musicServiceConnection.sliderClicked.value = true
}

is PressInteraction.Release -> {
musicServiceConnection.transportControls.seekTo(musicServiceConnection.songDuration.value)
musicServiceConnection.sliderClicked.value = false
musicServiceConnection.updateSong()
}

is PressInteraction.Cancel -> {}
is DragInteraction.Start -> {
musicServiceConnection.sliderClicked.value = true
}

is DragInteraction.Stop -> {
musicServiceConnection.transportControls.seekTo(musicServiceConnection.songDuration.value)
musicServiceConnection.sliderClicked.value = false
musicServiceConnection.updateSong()
}

is DragInteraction.Cancel -> {}
}
}
}


if (currentFraction == 1f) {
var sliderPosition by remember { mutableStateOf(0f) }
var sliderPosition by remember { mutableFloatStateOf(0f) }
sliderPosition =
musicServiceConnection.songDuration.value / MusicService.curSongDuration.toFloat()
Column(
Expand All @@ -79,15 +81,17 @@ fun PlayBarActionsMaximized(
text = title,
textAlign = TextAlign.Center
)
ModifiedSlider(
interactionSource = interactionSource,
modifier = Modifier
.offset(x = offsetX(currentFraction, maxWidth).dp)
.width(widthSize(currentFraction, maxWidth).dp),
value = sliderPosition, onValueChange = {
musicServiceConnection.songDuration.value =
(it * MusicService.curSongDuration).toLong()
})
if (!sliderPosition.isNaN()) {
Slider(
interactionSource = interactionSource,
modifier = Modifier
.offset(x = offsetX(currentFraction, maxWidth).dp)
.width(widthSize(currentFraction, maxWidth).dp),
value = sliderPosition, onValueChange = {
musicServiceConnection.songDuration.value =
(it * MusicService.curSongDuration).toLong()
})
}

Row(
Modifier.height(IntrinsicSize.Max)
Expand Down Expand Up @@ -184,6 +188,7 @@ fun PlayBarActionsMaximized(
painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_off),
contentDescription = null,
)

REPEAT_MODE_ONE -> Icon(
modifier = Modifier
.size(40.dp)
Expand All @@ -196,6 +201,7 @@ fun PlayBarActionsMaximized(
painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_one),
contentDescription = null,
)

REPEAT_MODE_ALL -> Icon(
modifier = Modifier
.size(40.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,20 @@ fun PlayerBottomBar(
},
playBarMinimizedClicked = playBarMinimizedClicked
)
LinearProgressIndicator(
progress = musicServiceConnection.songDuration.value / curSongDuration.toFloat(),
Modifier
.fillMaxWidth()
.height(1.dp)
.graphicsLayer {
alpha = if (currentFraction > 0.001) 0f else 1f
}
)
var progress by remember { mutableFloatStateOf(0f) }
progress = musicServiceConnection.songDuration.value / curSongDuration.toFloat()
if (!progress.isNaN()) {
LinearProgressIndicator(
progress = progress,
Modifier
.fillMaxWidth()
.height(1.dp)
.graphicsLayer {
alpha = if (currentFraction > 0.001) 0f else 1f
}
)
}

PlayBarActionsMaximized(
bottomPadding,
currentFraction,
Expand Down
Loading