Skip to content

Commit

Permalink
Fix detekt lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobkukla committed Jan 29, 2025
1 parent ff1917f commit 1204c83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/org/jellyfin/mobile/bridge/MediaSegments.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MediaSegments(private val context: Context) : KoinComponent {

@JavascriptInterface
fun setSegmentTypeAction(typeString: String, actionString: String) {
val type: MediaSegmentType = when(typeString) {
val type: MediaSegmentType = when (typeString) {
"Intro" -> MediaSegmentType.INTRO
"Outro" -> MediaSegmentType.OUTRO
"Preview" -> MediaSegmentType.PREVIEW
Expand All @@ -23,7 +23,7 @@ class MediaSegments(private val context: Context) : KoinComponent {
else -> return
}

val action: MediaSegmentAction = when(actionString) {
val action: MediaSegmentAction = when (actionString) {
"None" -> MediaSegmentAction.NOTHING
"Skip" -> MediaSegmentAction.SKIP
"AskToSkip" -> MediaSegmentAction.ASK_TO_SKIP
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/java/org/jellyfin/mobile/player/PlayerViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ class PlayerViewModel(application: Application) : AndroidViewModel(application),
for (mediaSegment in mediaSegments) {
val action = mediaSegmentRepository.getMediaSegmentAction(mediaSegment)

when(action) {
when (action) {
MediaSegmentAction.SKIP -> addSkipAction(mediaSegment)
MediaSegmentAction.NOTHING -> Unit
// Unimplemented
Expand All @@ -437,15 +437,15 @@ class PlayerViewModel(application: Application) : AndroidViewModel(application),
val player = playerOrNull ?: return

player.createMessage { _, _ ->
// We can't seek directly on the ExoPlayer instance as not all media is seekable
// the seek function in the PlaybackController checks this and optionally starts a transcode
// at the requested position
// TODO: The above is probably true for jellyfin-android as well.
// But I believe there is no such logic here.
viewModelScope.launch(Dispatchers.Main) {
player.seekTo(mediaSegment.end.inWholeMilliseconds)
}
// We can't seek directly on the ExoPlayer instance as not all media is seekable
// the seek function in the PlaybackController checks this and optionally starts a transcode
// at the requested position
// TODO: The above is probably true for jellyfin-android as well.
// But I believe there is no such logic here.
viewModelScope.launch(Dispatchers.Main) {
player.seekTo(mediaSegment.end.inWholeMilliseconds)
}
}
// Segments at position 0 will never be hit by ExoPlayer so we need to add a minimum value
.setPosition(mediaSegment.start.inWholeMilliseconds.coerceAtLeast(1))
.setDeleteAfterDelivery(false)
Expand Down

0 comments on commit 1204c83

Please sign in to comment.