Skip to content

Commit

Permalink
Update Horologist lib and bump sdk (#1467)
Browse files Browse the repository at this point in the history
- Update target SDK to 34
- Update Horologist to 0.6.19
  • Loading branch information
kul3r4 authored Sep 16, 2024
2 parents 34b11a0 + f88ee8b commit 895731a
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 51 deletions.
4 changes: 2 additions & 2 deletions Jetcaster/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ androidx-test-espresso = "3.6.1"
androidx-test-ext-junit = "1.2.1"
androidx-test-ext-truth = "1.5.0"
androidx-tv-material = "1.0.0"
androidx-wear-compose = "1.3.1"
androidx-wear-compose = "1.4.0"
androidx-window = "1.3.0"
androidxHiltNavigationCompose = "1.2.0"
androix-test-uiautomator = "2.3.0"
Expand All @@ -36,7 +36,7 @@ google-maps = "18.2.0"
gradle-versions = "0.51.0"
hilt = "2.51.1"
hiltExt = "1.2.0"
horologist = "0.6.9"
horologist = "0.6.19"
# @pin When updating to AGP 7.4.0-alpha10 and up we can update this https://developer.android.com/studio/write/java8-support#library-desugaring-versions
jdkDesugar = "1.2.2"
junit = "4.13.2"
Expand Down
2 changes: 1 addition & 1 deletion Jetcaster/wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {
defaultConfig {
applicationId "com.example.jetcaster"
minSdk 26
targetSdk 33
targetSdk 34
versionCode 1
versionName "1.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.wear.compose.foundation.lazy.ScalingLazyListScope
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.ExperimentalWearMaterialApi
import androidx.wear.compose.material.LocalContentColor
import androidx.wear.compose.material.MaterialTheme
import androidx.wear.compose.material.Text
Expand All @@ -49,7 +50,6 @@ import com.google.android.horologist.composables.PlaceholderChip
import com.google.android.horologist.compose.layout.ScalingLazyColumnDefaults
import com.google.android.horologist.compose.layout.ScalingLazyColumnDefaults.listTextPadding
import com.google.android.horologist.compose.layout.ScalingLazyColumnDefaults.padding
import com.google.android.horologist.compose.layout.ScalingLazyColumnState
import com.google.android.horologist.compose.layout.ScreenScaffold
import com.google.android.horologist.compose.layout.rememberResponsiveColumnState
import com.google.android.horologist.compose.material.AlertDialog
Expand Down Expand Up @@ -101,7 +101,6 @@ fun EpisodeScreen(
val title = uiState.episode.episode.title

EntityScreen(
columnState = columnState,
headerContent = {
ResponsiveListHeader(
contentPadding = ListHeaderDefaults.firstItemPadding()
Expand Down Expand Up @@ -136,7 +135,7 @@ fun EpisodeScreen(
)
}
EpisodeScreenState.Loading -> {
LoadingScreen(columnState)
LoadingScreen()
}
}
}
Expand Down Expand Up @@ -182,10 +181,10 @@ fun LoadedButtonsContent(
)
}
}
@OptIn(ExperimentalWearMaterialApi::class)
@Composable
fun LoadingScreen(columnState: ScalingLazyColumnState) {
fun LoadingScreen() {
EntityScreen(
columnState = columnState,
headerContent = {
ResponsiveListHeader(
contentPadding = ListHeaderDefaults.firstItemPadding()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.ExperimentalWearMaterialApi
import androidx.wear.compose.material.Text
import androidx.wear.compose.ui.tooling.preview.WearPreviewDevices
import androidx.wear.compose.ui.tooling.preview.WearPreviewFontScales
Expand All @@ -41,7 +42,6 @@ import com.google.android.horologist.annotations.ExperimentalHorologistApi
import com.google.android.horologist.composables.PlaceholderChip
import com.google.android.horologist.compose.layout.ScalingLazyColumnDefaults
import com.google.android.horologist.compose.layout.ScalingLazyColumnDefaults.padding
import com.google.android.horologist.compose.layout.ScalingLazyColumnState
import com.google.android.horologist.compose.layout.ScreenScaffold
import com.google.android.horologist.compose.layout.rememberResponsiveColumnState
import com.google.android.horologist.compose.material.AlertDialog
Expand Down Expand Up @@ -91,7 +91,6 @@ fun LatestEpisodeScreen(
when (uiState) {
is LatestEpisodeScreenState.Loaded -> {
LatestEpisodesScreen(
columnState = columnState,
episodeList = uiState.episodeList,
onPlayButtonClick = onPlayButtonClick,
onPlayEpisode = onPlayEpisode,
Expand All @@ -110,7 +109,6 @@ fun LatestEpisodeScreen(

is LatestEpisodeScreenState.Loading -> {
LatestEpisodesScreenLoading(
columnState = columnState,
modifier = modifier
)
}
Expand Down Expand Up @@ -139,7 +137,6 @@ fun ButtonsContent(

@Composable
fun LatestEpisodesScreen(
columnState: ScalingLazyColumnState,
episodeList: List<PlayerEpisode>,
onPlayButtonClick: () -> Unit,
onPlayEpisode: (PlayerEpisode) -> Unit,
Expand All @@ -148,7 +145,6 @@ fun LatestEpisodesScreen(
) {
EntityScreen(
modifier = modifier,
columnState = columnState,
headerContent = {
ResponsiveListHeader(
contentPadding = ListHeaderDefaults.firstItemPadding()
Expand Down Expand Up @@ -181,14 +177,13 @@ fun LatestEpisodesScreen(
)
}

@OptIn(ExperimentalWearMaterialApi::class)
@Composable
fun LatestEpisodesScreenLoading(
columnState: ScalingLazyColumnState,
modifier: Modifier = Modifier
) {
EntityScreen(
modifier = modifier,
columnState = columnState,
headerContent = {
ResponsiveListHeader(
contentPadding = ListHeaderDefaults.firstItemPadding()
Expand Down Expand Up @@ -225,7 +220,6 @@ fun LatestEpisodeScreenLoadedPreview(
)
)
LatestEpisodesScreen(
columnState = columnState,
episodeList = listOf(episode),
onPlayButtonClick = { },
onPlayEpisode = { },
Expand All @@ -243,7 +237,5 @@ fun LatestEpisodeScreenLoadingPreview() {
last = ScalingLazyColumnDefaults.ItemType.Chip
)
)
LatestEpisodesScreenLoading(
columnState = columnState,
)
LatestEpisodesScreenLoading()
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.ExperimentalWearMaterialApi
import androidx.wear.compose.material.MaterialTheme
import androidx.wear.compose.material.Text
import com.example.jetcaster.R
Expand Down Expand Up @@ -71,7 +72,6 @@ fun LibraryScreen(
when (val s = uiState) {
is LibraryScreenUiState.Loading ->
LoadingScreen(
columnState = columnState,
modifier = modifier
)
is LibraryScreenUiState.NoSubscribedPodcast ->
Expand All @@ -94,13 +94,12 @@ fun LibraryScreen(
}
}

@OptIn(ExperimentalWearMaterialApi::class)
@Composable
fun LoadingScreen(
columnState: ScalingLazyColumnState,
modifier: Modifier,
) {
EntityScreen(
columnState = columnState,
headerContent = {
ResponsiveListHeader(
contentPadding = ListHeaderDefaults.firstItemPadding()
Expand All @@ -117,6 +116,7 @@ fun LoadingScreen(
)
}

@OptIn(ExperimentalWearMaterialApi::class)
@Composable
fun NoSubscribedPodcastScreen(
columnState: ScalingLazyColumnState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.wear.compose.foundation.ExperimentalWearFoundationApi
import androidx.wear.compose.foundation.rememberActiveFocusRequester
import androidx.wear.compose.foundation.rotary.rotary
import androidx.wear.compose.foundation.rotary.rotaryScrollable
import androidx.wear.compose.material.ExperimentalWearMaterialApi
import androidx.wear.compose.material.MaterialTheme
import com.example.jetcaster.R
import com.example.jetcaster.ui.components.SettingsButtons
Expand Down Expand Up @@ -74,7 +75,7 @@ fun PlayerScreen(
)
}

@OptIn(ExperimentalWearFoundationApi::class)
@OptIn(ExperimentalWearFoundationApi::class, ExperimentalWearMaterialApi::class)
@Composable
private fun PlayerScreen(
playerScreenViewModel: PlayerViewModel,
Expand Down Expand Up @@ -164,7 +165,7 @@ private fun PlayerScreen(
)
},
modifier = modifier
.rotary(
.rotaryScrollable(
volumeRotaryBehavior(
volumeUiStateProvider = { volumeUiState },
onRotaryVolumeInput = { onUpdateVolume },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.ExperimentalWearMaterialApi
import androidx.wear.compose.material.Text
import androidx.wear.compose.ui.tooling.preview.WearPreviewDevices
import androidx.wear.compose.ui.tooling.preview.WearPreviewFontScales
Expand Down Expand Up @@ -73,6 +74,7 @@ import com.google.android.horologist.media.ui.screens.entity.EntityScreen
)
}

@OptIn(ExperimentalWearMaterialApi::class)
@Composable
fun PodcastDetailsScreen(
uiState: PodcastDetailsScreenState,
Expand All @@ -95,7 +97,6 @@ fun PodcastDetailsScreen(
when (uiState) {
is PodcastDetailsScreenState.Loaded -> {
EntityScreen(
columnState = columnState,
headerContent = {
ResponsiveListHeader(
contentPadding = ListHeaderDefaults.firstItemPadding()
Expand Down Expand Up @@ -134,7 +135,6 @@ fun PodcastDetailsScreen(
}
PodcastDetailsScreenState.Loading -> {
EntityScreen(
columnState = columnState,
headerContent = {
ResponsiveListHeader(
contentPadding = ListHeaderDefaults.firstItemPadding()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.ExperimentalWearMaterialApi
import androidx.wear.compose.material.Text
import androidx.wear.compose.ui.tooling.preview.WearPreviewDevices
import androidx.wear.compose.ui.tooling.preview.WearPreviewFontScales
Expand All @@ -37,7 +38,6 @@ import com.example.jetcaster.ui.preview.WearPreviewPodcasts
import com.google.android.horologist.annotations.ExperimentalHorologistApi
import com.google.android.horologist.composables.PlaceholderChip
import com.google.android.horologist.compose.layout.ScalingLazyColumnDefaults
import com.google.android.horologist.compose.layout.ScalingLazyColumnState
import com.google.android.horologist.compose.layout.ScreenScaffold
import com.google.android.horologist.compose.layout.rememberResponsiveColumnState
import com.google.android.horologist.compose.material.AlertDialog
Expand Down Expand Up @@ -95,27 +95,24 @@ fun PodcastsScreen(
) {
when (podcastsScreenState) {
is PodcastsScreenState.Loaded -> PodcastScreenLoaded(
columnState = columnState,
podcastList = podcastsScreenState.podcastList,
onPodcastsItemClick = onPodcastsItemClick
)
PodcastsScreenState.Empty ->
PodcastScreenEmpty(onDismiss)
PodcastsScreenState.Loading ->
PodcastScreenLoading(columnState)
PodcastScreenLoading()
}
}
}

@Composable
fun PodcastScreenLoaded(
columnState: ScalingLazyColumnState,
podcastList: List<PodcastInfo>,
onPodcastsItemClick: (PodcastInfo) -> Unit,
modifier: Modifier = Modifier
) {
EntityScreen(
columnState = columnState,
modifier = modifier,
headerContent = {
ResponsiveListHeader(
Expand Down Expand Up @@ -154,13 +151,12 @@ fun PodcastScreenEmpty(
)
}

@OptIn(ExperimentalWearMaterialApi::class)
@Composable
fun PodcastScreenLoading(
columnState: ScalingLazyColumnState,
modifier: Modifier = Modifier
) {
EntityScreen(
columnState = columnState,
modifier = modifier,
headerContent = {
DefaultEntityScreenHeader(
Expand Down Expand Up @@ -188,7 +184,6 @@ fun PodcastScreenLoadedPreview(
)
)
PodcastScreenLoaded(
columnState = columnState,
podcastList = listOf(podcasts),
onPodcastsItemClick = {}
)
Expand All @@ -204,7 +199,7 @@ fun PodcastScreenLoadingPreview() {
last = ScalingLazyColumnDefaults.ItemType.Chip
)
)
PodcastScreenLoading(columnState)
PodcastScreenLoading()
}

@WearPreviewDevices
Expand Down
Loading

0 comments on commit 895731a

Please sign in to comment.