Skip to content

Commit

Permalink
Fix some Lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Dec 8, 2023
1 parent 6b08ad2 commit 8aa6001
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
4 changes: 2 additions & 2 deletions pillarbox-core-business/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
~ Copyright (c) SRG SSR. All rights reserved.
~ License information is available from the LICENSE file.
-->
<resources>
<string name="blockReason_geoBlock">Dieser Inhalt ist ausserhalb der Schweiz nicht verfügbar.</string>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="blockReason_geoBlock" tools:ignore="Typos">Dieser Inhalt ist ausserhalb der Schweiz nicht verfügbar.</string>
<string name="blockReason_legal">Dieser Inhalt ist aus rechtlichen Gründen nicht verfügbar.</string>
<string name="blockReason_commercial">Dieser Werbe-Inhalt ist nicht verfügbar.</string>
<string name="blockReason_ageRating18">Dieser Inhalt ist aus Gründen des Jugendschutzes nur zwischen 22:00 und 5:00 Uhr verfügbar.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.viewinterop.AndroidView
import androidx.media3.common.C
import androidx.media3.common.Player
Expand Down Expand Up @@ -53,33 +51,29 @@ fun SimpleStory() {
*/
@Composable
private fun SimpleStoryPlayer(demoItem: DemoItem, isPlaying: Boolean = false) {
val context = LocalContext.current
val player = remember {
PillarboxPlayer(
context = context,
mediaItemSource = PlayerModule.provideMixedItemSource(context),
loadControl = StoryLoadControl.build()
).apply {
setMediaItem(demoItem.toMediaItem())
prepare()
videoScalingMode = C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
repeatMode = Player.REPEAT_MODE_ONE
}
}
player.playWhenReady = isPlaying
AndroidView(
factory = { context ->
val player = PillarboxPlayer(
context = context,
mediaItemSource = PlayerModule.provideMixedItemSource(context),
loadControl = StoryLoadControl.build()
).apply {
setMediaItem(demoItem.toMediaItem())
prepare()
videoScalingMode = C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
repeatMode = Player.REPEAT_MODE_ONE
playWhenReady = isPlaying
}

DisposableEffect(
AndroidView(factory = {
PlayerView(context).apply {
hideController()
useController = false
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
this.player = player
}
})
) {
onDispose {
player.release()
},
onRelease = {
it.player?.release()
}
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package ch.srgssr.pillarbox.ui.widget

import android.annotation.SuppressLint
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.platform.LocalView
Expand All @@ -14,6 +15,7 @@ import ch.srgssr.pillarbox.ui.extension.isPlayingAsState
* Keep screen on when [Player.isPlaying]
*/
@Composable
@SuppressLint("ComposableNaming")
fun Player.keepScreenOn() {
val isPlaying by isPlayingAsState()
LocalView.current.keepScreenOn = isPlaying
Expand Down

0 comments on commit 8aa6001

Please sign in to comment.