Music widget: add preference to make progress bar non-interactive

This commit is contained in:
MM20
2025-07-04 17:49:23 +02:00
parent 720d2ab52a
commit ca4979abaf
5 changed files with 53 additions and 20 deletions
@@ -119,7 +119,7 @@ fun ConfigureWidgetSheet(
is AppWidget -> ConfigureAppWidget(widget, onWidgetUpdated)
is CalendarWidget -> ConfigureCalendarWidget(widget, onWidgetUpdated)
is FavoritesWidget -> ConfigureFavoritesWidget(widget, onWidgetUpdated)
is MusicWidget -> ConfigureMusicWidget()
is MusicWidget -> ConfigureMusicWidget(widget, onWidgetUpdated)
is NotesWidget -> ConfigureNotesWidget(widget, onWidgetUpdated)
}
}
@@ -232,10 +232,27 @@ fun ColumnScope.ConfigureFavoritesWidget(
@Composable
fun ColumnScope.ConfigureMusicWidget(
widget: MusicWidget,
onWidgetUpdated: (MusicWidget) -> Unit,
) {
val context = LocalContext.current
OutlinedCard {
Column(
modifier = Modifier.fillMaxWidth()
) {
SwitchPreference(
title = stringResource(R.string.music_widget_interactive_progress_bar),
iconPadding = false,
value = widget.config.interactiveProgressBar,
onValueChanged = {
onWidgetUpdated(widget.copy(config = widget.config.copy(interactiveProgressBar = it)))
}
)
}
}
TextButton(
modifier = Modifier
.align(Alignment.CenterHorizontally),
@@ -168,7 +168,7 @@ fun MusicWidget(widget: MusicWidget) {
var seekPosition by remember { mutableStateOf<Float?>(null) }
if (pos != null && dur != null && dur > 0) {
if (playbackState != PlaybackState.Stopped || supportedActions.seekTo) {
if (playbackState != PlaybackState.Stopped && supportedActions.seekTo && widget.config.interactiveProgressBar) {
Slider(
modifier = Modifier
.fillMaxWidth()