diff --git a/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/app/UampWearApp.kt b/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/app/UampWearApp.kt index 01e74fe474..087560fd46 100644 --- a/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/app/UampWearApp.kt +++ b/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/app/UampWearApp.kt @@ -57,7 +57,9 @@ import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScr import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.GoogleSignInPromptScreen import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.GoogleSignInScreen import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.GoogleSignOutScreen +import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.NewHotness import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.Samples +import com.google.android.horologist.mediasample.ui.newhotness.NewHotnessPlayerScreen import com.google.android.horologist.mediasample.ui.player.UampMediaPlayerScreen import com.google.android.horologist.mediasample.ui.playlists.UampPlaylistsScreen import com.google.android.horologist.mediasample.ui.playlists.UampPlaylistsScreenViewModel @@ -240,6 +242,10 @@ fun UampWearApp( viewModel = hiltViewModel(), ) } + + composable { + NewHotnessPlayerScreen() + } }, ) } diff --git a/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/navigation/UampNavigationScreen.kt b/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/navigation/UampNavigationScreen.kt index 13a90cd519..f082a70cea 100644 --- a/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/navigation/UampNavigationScreen.kt +++ b/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/navigation/UampNavigationScreen.kt @@ -37,4 +37,7 @@ object UampNavigationScreen { @Serializable public object DeveloperOptions : NavigationScreen + + @Serializable + public data object NewHotness : NavigationScreen } diff --git a/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/newhotness/NewHotnessPlayerScreen.kt b/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/newhotness/NewHotnessPlayerScreen.kt new file mode 100644 index 0000000000..e0e92bbf9e --- /dev/null +++ b/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/newhotness/NewHotnessPlayerScreen.kt @@ -0,0 +1,39 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.horologist.mediasample.ui.newhotness + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.media3.common.Player +import androidx.wear.compose.material.Text + +@Composable +fun NewHotnessPlayerScreen( + newHotnessPlayerScreenViewModel: NewHotnessPlayerScreenViewModel = hiltViewModel(), +) { + val player: Player? by newHotnessPlayerScreenViewModel.player.collectAsStateWithLifecycle() + + Box(modifier = Modifier.fillMaxSize()) { + Text(player.toString(), modifier = Modifier.align(Alignment.Center)) + } +} diff --git a/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/newhotness/NewHotnessPlayerScreenViewModel.kt b/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/newhotness/NewHotnessPlayerScreenViewModel.kt new file mode 100644 index 0000000000..c591ddfd37 --- /dev/null +++ b/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/newhotness/NewHotnessPlayerScreenViewModel.kt @@ -0,0 +1,32 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.horologist.mediasample.ui.newhotness + +import androidx.lifecycle.ViewModel +import com.google.android.horologist.media.data.repository.PlayerRepositoryImpl +import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject + +@HiltViewModel +class NewHotnessPlayerScreenViewModel + @Inject + constructor( + playerRepository: PlayerRepositoryImpl, + ) : ViewModel() { + + val player = playerRepository.player + } diff --git a/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/settings/DeveloperOptionsScreen.kt b/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/settings/DeveloperOptionsScreen.kt index 5f4f7a6ac2..547e394be8 100644 --- a/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/settings/DeveloperOptionsScreen.kt +++ b/media/sample/src/main/java/com/google/android/horologist/mediasample/ui/settings/DeveloperOptionsScreen.kt @@ -32,6 +32,7 @@ import com.google.android.horologist.compose.layout.ScalingLazyColumnDefaults.pa import com.google.android.horologist.compose.layout.rememberResponsiveColumnState import com.google.android.horologist.mediasample.R import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.AudioDebug +import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.NewHotness import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.Samples @Composable @@ -60,6 +61,13 @@ fun DeveloperOptionsScreen( style = MaterialTheme.typography.title3, ) } + item { + ActionSetting( + "New Hotness Player", + ) { + navController.navigate(NewHotness) + } + } item { CheckedSetting( uiState.networkRequest != null,