Skip to content

Commit

Permalink
Add a blank screen to test out other Player screen options. (#2429)
Browse files Browse the repository at this point in the history
  • Loading branch information
yschimke authored Oct 17, 2024
1 parent ee585ab commit b84e513
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -240,6 +242,10 @@ fun UampWearApp(
viewModel = hiltViewModel(),
)
}

composable<NewHotness> {
NewHotnessPlayerScreen()
}
},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ object UampNavigationScreen {

@Serializable
public object DeveloperOptions : NavigationScreen

@Serializable
public data object NewHotness : NavigationScreen
}
Original file line number Diff line number Diff line change
@@ -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))
}
}
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -60,6 +61,13 @@ fun DeveloperOptionsScreen(
style = MaterialTheme.typography.title3,
)
}
item {
ActionSetting(
"New Hotness Player",
) {
navController.navigate(NewHotness)
}
}
item {
CheckedSetting(
uiState.networkRequest != null,
Expand Down

0 comments on commit b84e513

Please sign in to comment.