Skip to content

Commit f67e90d

Browse files
committed
Added Horologist annotations
1 parent 6892544 commit f67e90d

8 files changed

Lines changed: 26 additions & 5 deletions

File tree

Jetcaster/wear/src/main/java/com/example/jetcaster/ui/episode/EpisodeViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import kotlinx.coroutines.flow.stateIn
5353
/**
5454
* ViewModel that handles the business logic and screen state of the Episode screen.
5555
*/
56+
@OptIn(ExperimentalHorologistApi::class)
5657
@HiltViewModel
5758
class EpisodeViewModel @Inject constructor(
5859
savedStateHandle: SavedStateHandle,

Jetcaster/wear/src/main/java/com/example/jetcaster/ui/player/PlayerScreen.kt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ package com.example.jetcaster.ui.player
3333
*/
3434

3535
import android.content.Context
36+
import kotlin.OptIn
3637
import androidx.compose.foundation.layout.Box
3738
import androidx.compose.foundation.layout.fillMaxSize
3839
import androidx.compose.runtime.Composable
@@ -63,6 +64,7 @@ import androidx.wear.compose.material.ExperimentalWearMaterialApi
6364
import androidx.wear.compose.material3.MaterialTheme
6465
import com.example.jetcaster.R
6566
import com.example.jetcaster.ui.components.SettingsButtons
67+
import com.google.android.horologist.annotations.ExperimentalHorologistApi
6668
import com.google.android.horologist.audio.ui.VolumeUiState
6769
import com.google.android.horologist.audio.ui.VolumeViewModel
6870
import com.google.android.horologist.audio.ui.volumeRotaryBehavior
@@ -77,6 +79,7 @@ import com.google.android.horologist.media.ui.material3.components.display.TextM
7779
import com.google.android.horologist.media.ui.material3.screens.player.PlayerScreen
7880
import java.time.Duration
7981

82+
@OptIn(ExperimentalHorologistApi::class)
8083
@Composable
8184
fun PlayerScreen(
8285
volumeViewModel: VolumeViewModel,
@@ -96,7 +99,11 @@ fun PlayerScreen(
9699
}
97100

98101
@androidx.annotation.OptIn(UnstableApi::class)
99-
@OptIn(ExperimentalWearFoundationApi::class, ExperimentalWearMaterialApi::class)
102+
@OptIn(
103+
ExperimentalHorologistApi::class,
104+
ExperimentalWearFoundationApi::class,
105+
ExperimentalWearMaterialApi::class,
106+
)
100107
@Composable
101108
private fun PlayerScreen(
102109
playerScreenViewModel: PlayerViewModel,
@@ -154,7 +161,9 @@ private fun PlayerScreen(
154161
val exoPlayer = rememberPlayer(context)
155162

156163
DisposableEffect(exoPlayer, episode) {
157-
episode?.mediaUrls?.let { exoPlayer.setMediaItems(it.map { MediaItem.fromUri(it) }) }
164+
episode?.mediaUrls?.let { urls ->
165+
exoPlayer.setMediaItems(urls.map { MediaItem.fromUri(it) })
166+
}
158167
val mediaSession = MediaSession.Builder(context, exoPlayer).build()
159168

160169
exoPlayer.prepare()
@@ -257,7 +266,7 @@ private fun PlayerScreen(
257266
.rotaryScrollable(
258267
volumeRotaryBehavior(
259268
volumeUiStateProvider = { volumeUiState },
260-
onRotaryVolumeInput = { onUpdateVolume },
269+
onRotaryVolumeInput = onUpdateVolume,
261270
),
262271
focusRequester = focusRequester,
263272
),

Jetcaster/wear/src/main/java/com/example/jetcaster/ui/podcast/PodcastDetailsScreen.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ import com.example.jetcaster.core.domain.testing.PreviewPodcastEpisodes
4848
import com.example.jetcaster.core.player.model.PlayerEpisode
4949
import com.example.jetcaster.ui.components.MediaContent
5050
import com.example.jetcaster.ui.preview.WearPreviewEpisodes
51+
import com.google.android.horologist.annotations.ExperimentalHorologistApi
5152
import com.google.android.horologist.compose.layout.ColumnItemType
5253
import com.google.android.horologist.compose.layout.rememberResponsiveColumnPadding
5354

55+
@OptIn(ExperimentalHorologistApi::class)
5456
@Composable fun PodcastDetailsScreen(
5557
onPlayButtonClick: () -> Unit,
5658
onEpisodeItemClick: (PlayerEpisode) -> Unit,
@@ -72,6 +74,7 @@ import com.google.android.horologist.compose.layout.rememberResponsiveColumnPadd
7274
)
7375
}
7476

77+
@OptIn(ExperimentalHorologistApi::class)
7578
@Composable
7679
fun PodcastDetailsScreen(
7780
uiState: PodcastDetailsScreenState,
@@ -206,6 +209,7 @@ fun ButtonsContent(
206209
}
207210
}
208211

212+
@OptIn(ExperimentalHorologistApi::class)
209213
@WearPreviewDevices
210214
@WearPreviewFontScales
211215
@Composable

Jetcaster/wear/src/main/java/com/example/jetcaster/ui/podcast/PodcastDetailsViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import kotlinx.coroutines.flow.stateIn
5858
/**
5959
* ViewModel that handles the business logic and screen state of the Podcast details screen.
6060
*/
61+
@OptIn(ExperimentalHorologistApi::class)
6162
@HiltViewModel
6263
class PodcastDetailsViewModel @Inject constructor(
6364
savedStateHandle: SavedStateHandle,

Jetcaster/wear/src/main/java/com/example/jetcaster/ui/podcasts/PodcastsScreen.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ import coil.compose.AsyncImage
5252
import com.example.jetcaster.R
5353
import com.example.jetcaster.core.model.PodcastInfo
5454
import com.example.jetcaster.ui.preview.WearPreviewPodcasts
55+
import com.google.android.horologist.annotations.ExperimentalHorologistApi
5556
import com.google.android.horologist.compose.layout.ColumnItemType
5657
import com.google.android.horologist.compose.layout.rememberResponsiveColumnPadding
57-
58+
@OptIn(ExperimentalHorologistApi::class)
5859
@Composable
5960
fun PodcastsScreen(
6061
podcastsViewModel: PodcastsViewModel = hiltViewModel(),
@@ -89,6 +90,7 @@ fun PodcastsScreen(
8990
)
9091
}
9192

93+
@OptIn(ExperimentalHorologistApi::class)
9294
@Composable
9395
fun PodcastsScreen(
9496
podcastsScreenState: PodcastsScreenState,

Jetcaster/wear/src/main/java/com/example/jetcaster/ui/podcasts/PodcastsViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import kotlinx.coroutines.flow.catch
3131
import kotlinx.coroutines.flow.map
3232
import kotlinx.coroutines.flow.stateIn
3333

34+
@OptIn(ExperimentalHorologistApi::class)
3435
@HiltViewModel
3536
class PodcastsViewModel @Inject constructor(podcastStore: PodcastStore) : ViewModel() {
3637

Jetcaster/wear/src/main/java/com/example/jetcaster/ui/queue/QueueScreen.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ import com.example.jetcaster.R
5656
import com.example.jetcaster.core.player.model.PlayerEpisode
5757
import com.example.jetcaster.ui.components.MediaContent
5858
import com.example.jetcaster.ui.preview.WearPreviewEpisodes
59+
import com.google.android.horologist.annotations.ExperimentalHorologistApi
5960
import com.google.android.horologist.compose.layout.ColumnItemType
6061
import com.google.android.horologist.compose.layout.rememberResponsiveColumnPadding
6162

63+
@OptIn(ExperimentalHorologistApi::class)
6264
@Composable fun QueueScreen(
6365
onPlayButtonClick: () -> Unit,
6466
onEpisodeItemClick: (PlayerEpisode) -> Unit,
@@ -80,7 +82,7 @@ import com.google.android.horologist.compose.layout.rememberResponsiveColumnPadd
8082
onDismiss = onDismiss,
8183
)
8284
}
83-
85+
@OptIn(ExperimentalHorologistApi::class)
8486
@Composable
8587
fun QueueScreen(
8688
uiState: QueueScreenState,

Jetcaster/wear/src/main/java/com/example/jetcaster/ui/queue/QueueViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import kotlinx.coroutines.flow.stateIn
3131
/**
3232
* ViewModel that handles the business logic and screen state of the Queue screen.
3333
*/
34+
@OptIn(ExperimentalHorologistApi::class)
3435
@HiltViewModel
3536
class QueueViewModel @Inject constructor(private val episodePlayer: EpisodePlayer) : ViewModel() {
3637

0 commit comments

Comments
 (0)