Skip to content

Commit dafa1a6

Browse files
authored
Update Jetcaster Wear module to Material3 (#1568)
Update Jetcaster Wear module to Material3
2 parents 73b3a51 + 81f4d23 commit dafa1a6

File tree

23 files changed

+1421
-895
lines changed

23 files changed

+1421
-895
lines changed

Jetcaster/gradle/libs.versions.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ androidx-test-ext-junit = "1.2.1"
2424
androidx-test-ext-truth = "1.6.0"
2525
androidx-tv-foundation = "1.0.0-alpha12"
2626
androidx-tv-material = "1.0.0"
27-
androidx-wear-compose = "1.4.1"
27+
androidx-wear-compose-material3 = "1.5.0-beta01"
28+
androidx-wear-compose = "1.5.0-beta01"
2829
androidx-window = "1.3.0"
2930
androidxHiltNavigationCompose = "1.2.0"
3031
androix-test-uiautomator = "2.3.0"
@@ -36,7 +37,7 @@ google-maps = "19.2.0"
3637
gradle-versions = "0.52.0"
3738
hilt = "2.56.2"
3839
hiltExt = "1.2.0"
39-
horologist = "0.6.23"
40+
horologist = "0.7.14-beta"
4041
jdkDesugar = "2.1.5"
4142
junit = "4.13.2"
4243
kotlin = "2.1.20"
@@ -122,7 +123,7 @@ androidx-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator",
122123
androidx-tv-foundation = { module = "androidx.tv:tv-foundation", version.ref = "androidx-tv-foundation" }
123124
androidx-tv-material = { module = "androidx.tv:tv-material", version.ref = "androidx-tv-material" }
124125
androidx-wear-compose-foundation = { module = "androidx.wear.compose:compose-foundation", version.ref = "androidx-wear-compose" }
125-
androidx-wear-compose-material = { module = "androidx.wear.compose:compose-material", version.ref = "androidx-wear-compose" }
126+
androidx-wear-compose-material = { module = "androidx.wear.compose:compose-material3", version.ref = "androidx-wear-compose-material3" }
126127
androidx-wear-compose-navigation = { module = "androidx.wear.compose:compose-navigation", version.ref = "androidx-wear-compose" }
127128
androidx-wear-compose-ui-tooling = { module = "androidx.wear.compose:compose-ui-tooling", version.ref = "androidx-wear-compose" }
128129
androidx-window = { module = "androidx.window:window", version.ref = "androidx-window" }
@@ -137,13 +138,17 @@ hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", vers
137138
hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
138139
hilt-ext-compiler = { module = "androidx.hilt:hilt-compiler", version.ref = "hiltExt" }
139140
horologist-audio-ui = { module = "com.google.android.horologist:horologist-audio-ui", version.ref = "horologist" }
141+
horologist-audio-uimaterial3 = { module = "com.google.android.horologist:horologist-audio-ui-material3", version.ref = "horologist" }
142+
horologist-audio-ui-model = { module = "com.google.android.horologist:horologist-audio-ui-model", version.ref = "horologist" }
140143
horologist-composables = { module = "com.google.android.horologist:horologist-composables", version.ref = "horologist" }
141144
horologist-compose-layout = { module = "com.google.android.horologist:horologist-compose-layout", version.ref = "horologist" }
142145
horologist-compose-material = { module = "com.google.android.horologist:horologist-compose-material", version.ref = "horologist" }
143146
horologist-compose-tools = { module = "com.google.android.horologist:horologist-compose-tools", version.ref = "horologist" }
144147
horologist-images-coil = { module = "com.google.android.horologist:horologist-images-coil", version.ref = "horologist" }
145148
horologist-media-data = { module = "com.google.android.horologist:horologist-media-data", version.ref = "horologist" }
146149
horologist-media-ui = { module = "com.google.android.horologist:horologist-media-ui", version.ref = "horologist" }
150+
horologist-media-uimaterial3 = { module = "com.google.android.horologist:horologist-media-ui-material3", version.ref = "horologist" }
151+
horologist-media-ui-model = { module = "com.google.android.horologist:horologist-media-ui-model", version.ref = "horologist" }
147152
horologist-roboscreenshots = { module = "com.google.android.horologist:horologist-roboscreenshots", version.ref = "horologist" }
148153
junit = { module = "junit:junit", version.ref = "junit" }
149154
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
@@ -162,6 +167,7 @@ rometools-modules = { module = "com.rometools:rome-modules", version.ref = "rome
162167
rometools-rome = { module = "com.rometools:rome", version.ref = "rome" }
163168
androidx-media3-session = {module = "androidx.media3:media3-session",version.ref = "media3"}
164169
androidx-media3-exoplayer = {module = "androidx.media3:media3-exoplayer", version.ref = "media3"}
170+
androidx-media3-common-ktx = { group = "androidx.media3", name = "media3-common-ktx", version.ref = "media3" }
165171

166172
[plugins]
167173
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }

Jetcaster/wear/build.gradle

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ android {
7474

7575
dependencies {
7676

77-
7877
def composeBom = platform(libs.androidx.compose.bom)
7978

8079
// General compose dependencies
@@ -90,21 +89,31 @@ dependencies {
9089
// https://issuetracker.google.com/issues/new?component=1077552&template=1598429&pli=1
9190
implementation libs.androidx.wear.compose.material
9291

92+
// For using the phone Typography
93+
implementation libs.androidx.compose.material3
94+
9395
implementation(libs.kotlinx.collections.immutable)
9496

9597
// Foundation is additive, so you can use the mobile version in your Wear OS app.
9698
implementation libs.androidx.wear.compose.foundation
9799
implementation(libs.androidx.material.icons.core)
98100
implementation(libs.androidx.compose.material.iconsExtended)
99101

102+
implementation(libs.androidx.media3.exoplayer)
103+
implementation(libs.androidx.media3.ui.compose)
104+
implementation(libs.androidx.media3.session)
105+
implementation libs.androidx.media3.common.ktx
106+
100107
// Horologist for correct Compose layout
101-
implementation libs.horologist.composables
102108
implementation libs.horologist.compose.layout
103-
implementation libs.horologist.compose.material
104109

105110
//Horologist Media toolkit
106111
implementation libs.horologist.media.ui
112+
implementation libs.horologist.media.uimaterial3
113+
implementation libs.horologist.media.ui.model
107114
implementation libs.horologist.audio.ui
115+
implementation libs.horologist.audio.uimaterial3
116+
implementation libs.horologist.audio.ui.model
108117
implementation libs.horologist.media.data
109118
implementation libs.horologist.images.coil
110119

@@ -140,9 +149,7 @@ dependencies {
140149
testImplementation libs.roborazzi
141150
testImplementation libs.roborazzi.compose
142151
testImplementation libs.roborazzi.rule
143-
testImplementation(libs.horologist.roboscreenshots) {
144-
exclude(group: "com.github.QuickBirdEng.kotlin-snapshot-testing")
145-
}
152+
testImplementation(libs.horologist.roboscreenshots)
146153

147154
androidTestImplementation libs.androidx.test.ext.junit
148155
androidTestImplementation libs.androidx.test.espresso.core

Jetcaster/wear/src/main/java/com/example/jetcaster/MainActivity.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package com.example.jetcaster
1919
import android.os.Bundle
2020
import androidx.activity.ComponentActivity
2121
import androidx.activity.compose.setContent
22-
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
2322
import androidx.navigation.NavHostController
2423
import androidx.wear.compose.navigation.rememberSwipeDismissableNavController
2524
import dagger.hilt.android.AndroidEntryPoint
@@ -29,7 +28,6 @@ class MainActivity : ComponentActivity() {
2928
lateinit var navController: NavHostController
3029

3130
override fun onCreate(savedInstanceState: Bundle?) {
32-
installSplashScreen()
3331
super.onCreate(savedInstanceState)
3432

3533
setContent {

Jetcaster/wear/src/main/java/com/example/jetcaster/WearApp.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ package com.example.jetcaster
1818

1919
import androidx.compose.foundation.background
2020
import androidx.compose.foundation.layout.fillMaxSize
21-
import androidx.compose.foundation.pager.rememberPagerState
2221
import androidx.compose.runtime.Composable
2322
import androidx.compose.runtime.getValue
2423
import androidx.compose.ui.Modifier
2524
import androidx.compose.ui.graphics.Color
2625
import androidx.lifecycle.compose.collectAsStateWithLifecycle
2726
import androidx.lifecycle.viewmodel.compose.viewModel
2827
import androidx.navigation.NavHostController
28+
import androidx.wear.compose.foundation.pager.rememberPagerState
29+
import androidx.wear.compose.material3.AppScaffold
30+
import androidx.wear.compose.material3.ScreenScaffold
2931
import androidx.wear.compose.navigation.SwipeDismissableNavHost
3032
import androidx.wear.compose.navigation.composable
3133
import androidx.wear.compose.navigation.rememberSwipeDismissableNavHostState
@@ -47,14 +49,12 @@ import com.example.jetcaster.ui.player.PlayerScreen
4749
import com.example.jetcaster.ui.podcast.PodcastDetailsScreen
4850
import com.example.jetcaster.ui.podcasts.PodcastsScreen
4951
import com.example.jetcaster.ui.queue.QueueScreen
50-
import com.google.android.horologist.audio.ui.VolumeScreen
5152
import com.google.android.horologist.audio.ui.VolumeViewModel
52-
import com.google.android.horologist.compose.layout.AppScaffold
53-
import com.google.android.horologist.compose.layout.ScreenScaffold
54-
import com.google.android.horologist.media.ui.navigation.MediaNavController.navigateToPlayer
55-
import com.google.android.horologist.media.ui.navigation.MediaNavController.navigateToVolume
56-
import com.google.android.horologist.media.ui.navigation.NavigationScreens
57-
import com.google.android.horologist.media.ui.screens.playerlibrarypager.PlayerLibraryPagerScreen
53+
import com.google.android.horologist.audio.ui.material3.VolumeScreen
54+
import com.google.android.horologist.media.ui.material3.navigation.MediaNavController.navigateToPlayer
55+
import com.google.android.horologist.media.ui.material3.navigation.MediaNavController.navigateToVolume
56+
import com.google.android.horologist.media.ui.material3.navigation.NavigationScreens
57+
import com.google.android.horologist.media.ui.material3.screens.playerlibrarypager.PlayerLibraryPagerScreen
5858

5959
@Composable
6060
fun WearApp(navController: NavHostController) {
@@ -64,7 +64,7 @@ fun WearApp(navController: NavHostController) {
6464
WearAppTheme {
6565
AppScaffold {
6666
SwipeDismissableNavHost(
67-
startDestination = NavigationScreens.Player.playerDestination(),
67+
startDestination = NavigationScreens.Player.navRoute,
6868
navController = navController,
6969
modifier = Modifier.background(Color.Transparent),
7070
state = navHostState,

Jetcaster/wear/src/main/java/com/example/jetcaster/theme/Color.kt

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright 2021 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.example.jetcaster.theme
18+
19+
import androidx.compose.ui.graphics.Color
20+
import androidx.wear.compose.material3.ColorScheme
21+
import com.example.jetcaster.designsystem.theme.backgroundDark
22+
import com.example.jetcaster.designsystem.theme.errorContainerDark
23+
import com.example.jetcaster.designsystem.theme.errorDark
24+
import com.example.jetcaster.designsystem.theme.onBackgroundDarkMediumContrast
25+
import com.example.jetcaster.designsystem.theme.onErrorContainerDarkMediumContrast
26+
import com.example.jetcaster.designsystem.theme.onErrorDark
27+
import com.example.jetcaster.designsystem.theme.onPrimaryContainerDark
28+
import com.example.jetcaster.designsystem.theme.onSecondaryContainerDark
29+
import com.example.jetcaster.designsystem.theme.onSecondaryDark
30+
import com.example.jetcaster.designsystem.theme.onSurfaceVariantDark
31+
import com.example.jetcaster.designsystem.theme.onSurfaceVariantDarkMediumContrast
32+
import com.example.jetcaster.designsystem.theme.onTertiaryDark
33+
import com.example.jetcaster.designsystem.theme.outlineDark
34+
import com.example.jetcaster.designsystem.theme.outlineVariantDark
35+
import com.example.jetcaster.designsystem.theme.primaryContainerDark
36+
import com.example.jetcaster.designsystem.theme.primaryDark
37+
import com.example.jetcaster.designsystem.theme.secondaryContainerDark
38+
import com.example.jetcaster.designsystem.theme.secondaryDark
39+
import com.example.jetcaster.designsystem.theme.surfaceContainerDarkMediumContrast
40+
import com.example.jetcaster.designsystem.theme.surfaceContainerHighDarkMediumContrast
41+
import com.example.jetcaster.designsystem.theme.surfaceContainerLowDarkMediumContrast
42+
import com.example.jetcaster.designsystem.theme.tertiaryContainerDarkMediumContrast
43+
import com.example.jetcaster.designsystem.theme.tertiaryDark
44+
45+
internal val wearColorPalette: ColorScheme = ColorScheme(
46+
primary = primaryDark,
47+
primaryDim = primaryDark,
48+
onPrimary = Color(0xFF542104),
49+
primaryContainer = primaryContainerDark,
50+
onPrimaryContainer = onPrimaryContainerDark,
51+
secondary = secondaryDark,
52+
secondaryDim = secondaryDark,
53+
onSecondary = onSecondaryDark,
54+
secondaryContainer = secondaryContainerDark,
55+
onSecondaryContainer = onSecondaryContainerDark,
56+
tertiary = tertiaryDark,
57+
onTertiary = onTertiaryDark,
58+
tertiaryContainer = tertiaryContainerDarkMediumContrast,
59+
error = errorDark,
60+
onError = onErrorDark,
61+
errorContainer = errorContainerDark,
62+
onErrorContainer = onErrorContainerDarkMediumContrast,
63+
background = backgroundDark,
64+
onBackground = onBackgroundDarkMediumContrast,
65+
onSurface = onSurfaceVariantDarkMediumContrast,
66+
onSurfaceVariant = onSurfaceVariantDark,
67+
surfaceContainer = surfaceContainerDarkMediumContrast,
68+
surfaceContainerLow = surfaceContainerLowDarkMediumContrast,
69+
surfaceContainerHigh = surfaceContainerHighDarkMediumContrast,
70+
outline = outlineDark,
71+
outlineVariant = outlineVariantDark,
72+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.example.jetcaster.theme
18+
19+
import androidx.compose.foundation.shape.RoundedCornerShape
20+
import androidx.compose.ui.unit.dp
21+
import androidx.wear.compose.material3.Shapes
22+
23+
val Shapes = Shapes(
24+
medium = RoundedCornerShape(16.dp),
25+
)

Jetcaster/wear/src/main/java/com/example/jetcaster/theme/Type.kt

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,21 @@
1616

1717
package com.example.jetcaster.theme
1818

19-
import androidx.compose.ui.text.TextStyle
20-
import androidx.compose.ui.text.font.FontWeight
21-
import androidx.compose.ui.unit.sp
22-
import androidx.wear.compose.material.Typography
23-
import com.example.jetcaster.designsystem.theme.Montserrat
19+
import androidx.wear.compose.material3.Typography
20+
import com.example.jetcaster.designsystem.theme.JetcasterTypography
2421

2522
// Set of Material typography styles to start with
2623
val Typography = Typography(
27-
body1 = TextStyle(
28-
fontFamily = Montserrat,
29-
fontWeight = FontWeight.Normal,
30-
fontSize = 16.sp,
31-
),
32-
/* Other default text styles to override
33-
button = TextStyle(
34-
fontFamily = FontFamily.Default,
35-
fontWeight = FontWeight.W500,
36-
fontSize = 14.sp
37-
),
38-
caption = TextStyle(
39-
fontFamily = FontFamily.Default,
40-
fontWeight = FontWeight.Normal,
41-
fontSize = 12.sp
42-
)
43-
*/
24+
displayLarge = JetcasterTypography.displayLarge,
25+
displayMedium = JetcasterTypography.displayMedium,
26+
displaySmall = JetcasterTypography.displaySmall,
27+
titleLarge = JetcasterTypography.titleLarge,
28+
titleMedium = JetcasterTypography.titleMedium,
29+
titleSmall = JetcasterTypography.titleSmall,
30+
labelLarge = JetcasterTypography.labelLarge,
31+
labelMedium = JetcasterTypography.labelMedium,
32+
labelSmall = JetcasterTypography.labelSmall,
33+
bodyLarge = JetcasterTypography.bodyLarge,
34+
bodyMedium = JetcasterTypography.bodyMedium,
35+
bodySmall = JetcasterTypography.bodySmall,
4436
)

Jetcaster/wear/src/main/java/com/example/jetcaster/theme/WearAppTheme.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717
package com.example.jetcaster.theme
1818

1919
import androidx.compose.runtime.Composable
20-
import androidx.wear.compose.material.MaterialTheme
20+
import androidx.wear.compose.material3.MaterialTheme
2121

2222
@Composable
2323
fun WearAppTheme(content: @Composable () -> Unit) {
2424
MaterialTheme(
25-
colors = wearColorPalette,
25+
colorScheme = wearColorPalette,
2626
typography = Typography,
27-
// For shapes, we generally recommend using the default Material Wear shapes which are
28-
// optimized for round and non-round devices.
27+
shapes = Shapes,
2928
content = content,
3029
)
3130
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import androidx.navigation.NamedNavArgument
2121
import androidx.navigation.NavController
2222
import androidx.navigation.NavType
2323
import androidx.navigation.navArgument
24-
import com.google.android.horologist.media.ui.navigation.NavigationScreens
24+
import com.google.android.horologist.media.ui.material3.navigation.NavigationScreens
2525

2626
/**
2727
* NavController extensions that links to the screens of the Jetcaster app.

0 commit comments

Comments
 (0)