Skip to content
Open
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
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not make any changes to the old UI. I don't want to vet any new functionality in it.

Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,23 @@ abstract class PlaybackFragment(
val fragment = this@PlaybackFragment as PlaylistFragment<*, *, *>
fragment.showPlaylist()
}

val repeatLabel =
if (player?.repeatMode == Player.REPEAT_MODE_ONE) {
"Stop Repeating Video"
} else {
"Repeat Current Video"
}
add(repeatLabel)
callbacks[size - 1] = {
player?.let { p ->
if (p.repeatMode == Player.REPEAT_MODE_ONE) {
p.repeatMode = Player.REPEAT_MODE_OFF
} else {
p.repeatMode = Player.REPEAT_MODE_ONE
}
}
}
}

if (optionsButtonOptions.dataType == DataType.SCENE &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ sealed interface PlaybackAction {
data class Scale(
val scale: ContentScale,
) : PlaybackAction

data object ToggleRepeatOne : PlaybackAction
}

@OptIn(UnstableApi::class)
Expand All @@ -132,6 +134,8 @@ fun PlaybackControls(
scale: ContentScale,
seekBarIntervals: Int,
modifier: Modifier = Modifier,
isPlaylist: Boolean = false,
repeatOneEnabled: Boolean = false,
initialFocusRequester: FocusRequester = remember { FocusRequester() },
seekBarInteractionSource: MutableInteractionSource = remember { MutableInteractionSource() },
) {
Expand Down Expand Up @@ -197,6 +201,9 @@ fun PlaybackControls(
previousEnabled = previousEnabled,
nextEnabled = nextEnabled,
modifier = Modifier,
isPlaylist = isPlaylist,
repeatOneEnabled = repeatOneEnabled,
onToggleRepeatOne = { onPlaybackActionClick(PlaybackAction.ToggleRepeatOne) },
)
RightPlaybackButtons(
modifier = Modifier,
Expand Down Expand Up @@ -504,6 +511,9 @@ fun PlaybackButtons(
previousEnabled: Boolean,
nextEnabled: Boolean,
modifier: Modifier = Modifier,
isPlaylist: Boolean = false,
repeatOneEnabled: Boolean = false,
onToggleRepeatOne: () -> Unit = {},
) {
Row(
modifier = modifier.focusGroup(),
Expand Down Expand Up @@ -552,6 +562,16 @@ fun PlaybackButtons(
enabled = nextEnabled,
onControllerInteraction = onControllerInteraction,
)
if (isPlaylist) {
PlaybackButton(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want another button on the main playback controls. But this could be moved to the More menu on the left.

Copy link
Copy Markdown
Contributor Author

@HankFreeman1 HankFreeman1 Mar 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. Unfortunately I find that placement super convenient. I probably wouldn't even use this feature if it were tucked in a menu. Maybe it could be optional to display it with the main controls?

iconRes = if (repeatOneEnabled) R.drawable.baseline_repeat_one_24 else R.drawable.baseline_repeat_24,
onClick = {
onControllerInteraction.invoke()
onToggleRepeatOne()
},
onControllerInteraction = onControllerInteraction,
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ fun PlaybackOverlay(
audioDecoder: String?,
spriteData: List<SpriteData>,
modifier: Modifier = Modifier,
repeatOneEnabled: Boolean = false,
seekPreviewPlaceholder: Painter? = null,
seekBarInteractionSource: MutableInteractionSource = remember { MutableInteractionSource() },
) {
Expand Down Expand Up @@ -331,6 +332,8 @@ fun PlaybackOverlay(
scale = scale,
seekBarIntervals = uiConfig.preferences.playbackPreferences.seekBarSteps,
sfwMode = uiConfig.sfwMode,
isPlaylist = playlistInfo != null,
repeatOneEnabled = repeatOneEnabled,
)
}
if (markers.isNotEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ fun PlaybackPageContent(
var showPlaylist by remember { mutableStateOf(false) }
var contentScale by remember { mutableStateOf(ContentScale.Fit) }
var playbackSpeed by remember { mutableFloatStateOf(1.0f) }
var repeatOneEnabled by remember { mutableStateOf(false) }
LaunchedEffect(playbackSpeed) { player.setPlaybackSpeed(playbackSpeed) }

val presentationState = rememberPresentationState(player)
Expand Down Expand Up @@ -930,6 +931,12 @@ fun PlaybackPageContent(
PlaybackAction.ShowSceneDetails -> {
showSceneDetails = true
}

PlaybackAction.ToggleRepeatOne -> {
repeatOneEnabled = !repeatOneEnabled
player.repeatMode =
if (repeatOneEnabled) Player.REPEAT_MODE_ONE else Player.REPEAT_MODE_OFF
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be reset back to the global setting. Which is either OFF or REPEAT I believe

}
}
},
onSeekBarChange = seekBarState::onValueChange,
Expand Down Expand Up @@ -971,6 +978,7 @@ fun PlaybackPageContent(
videoDecoder = videoDecoder,
audioDecoder = audioDecoder,
spriteData = spriteImageLoaded,
repeatOneEnabled = repeatOneEnabled,
)
}
}
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/baseline_repeat_24.xml
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did these vectors come from?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were AI-generated based on the existing vectors you had. Apologies, I probably should've called that out.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M7,7h10v3l4,-4 -4,-4v3L5,5v6h2L7,7zM17,17L7,17v-3l-4,4 4,4v-3h12v-6h-2v4z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/baseline_repeat_one_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M7,7h10v3l4,-4 -4,-4v3L5,5v6h2L7,7zM17,17L7,17v-3l-4,4 4,4v-3h12v-6h-2v4zM13,15L13,9h-1l-2,1v1h1.5v4z"/>
</vector>
Loading