Skip to content

Commit

Permalink
Add protected examples on TV
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Jan 22, 2024
1 parent 3fb7aa8 commit 5108b25
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) SRG SSR. All rights reserved.
* License information is available from the LICENSE file.
*/
package ch.srgssr.pillarbox.demo.ui.examples
package ch.srgssr.pillarbox.demo.shared.ui.examples

import android.app.Application
import androidx.lifecycle.AndroidViewModel
Expand Down Expand Up @@ -40,6 +40,7 @@ class ExamplesViewModel(application: Application) : AndroidViewModel(application
item.title
},
description = "DRM-protected video",
imageUrl = item.imageUrl.rawUrl,
uri = item.urn
)
}
Expand All @@ -48,6 +49,7 @@ class ExamplesViewModel(application: Application) : AndroidViewModel(application
DemoItem(
title = item.title,
description = "Token-protected video",
imageUrl = item.imageUrl.rawUrl,
uri = item.urn
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
Expand All @@ -37,6 +38,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
Expand All @@ -52,8 +54,8 @@ import androidx.tv.material3.ExperimentalTvMaterial3Api
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import ch.srgssr.pillarbox.demo.shared.data.DemoItem
import ch.srgssr.pillarbox.demo.shared.data.Playlist
import ch.srgssr.pillarbox.demo.shared.ui.NavigationRoutes
import ch.srgssr.pillarbox.demo.shared.ui.examples.ExamplesViewModel
import ch.srgssr.pillarbox.demo.tv.extension.onDpadEvent
import ch.srgssr.pillarbox.demo.tv.ui.theme.PillarboxTheme
import ch.srgssr.pillarbox.demo.tv.ui.theme.paddings
Expand All @@ -73,8 +75,9 @@ fun ExamplesHome(
modifier: Modifier = Modifier,
onItemSelected: (DemoItem) -> Unit = {},
) {
val examplesViewModel: ExamplesViewModel = viewModel()
val navController = rememberNavController()
val playlists = Playlist.examplesPlaylists
val playlists by examplesViewModel.contents.collectAsState()

NavHost(
navController = navController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel
import ch.srgssr.pillarbox.demo.BuildConfig
import ch.srgssr.pillarbox.demo.shared.data.DemoItem
import ch.srgssr.pillarbox.demo.shared.data.Playlist
import ch.srgssr.pillarbox.demo.shared.ui.examples.ExamplesViewModel
import ch.srgssr.pillarbox.demo.ui.components.DemoListHeaderView
import ch.srgssr.pillarbox.demo.ui.components.DemoListItemView
import ch.srgssr.pillarbox.demo.ui.components.DemoListSectionView
Expand Down

0 comments on commit 5108b25

Please sign in to comment.