Skip to content

Commit

Permalink
Merge pull request #18 from RLD-JL/version-1.0.9
Browse files Browse the repository at this point in the history
Quick fix
  • Loading branch information
RLD-JL authored Oct 9, 2024
2 parents f1d4281 + 76937ea commit 4dc8c2a
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 474 deletions.
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

0 comments on commit 4dc8c2a

Please sign in to comment.