Skip to content

Commit 3ef67f1

Browse files
committed
Migrate all screens except Player to Material3
Change-Id: I71ffe54e4537015201fd3411144d5f00ac5f1537
1 parent ebef59e commit 3ef67f1

24 files changed

+1331
-757
lines changed

Jetcaster/gradle/libs.versions.toml

Lines changed: 8 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.0.0-alpha35"
28+
androidx-wear-compose = "1.5.0-alpha12"
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.11-alpha"
4041
jdkDesugar = "2.1.5"
4142
junit = "4.13.2"
4243
kotlin = "2.1.20"
@@ -58,6 +59,7 @@ spotless = "7.0.3"
5859
# @keep
5960
targetSdk = "33"
6061
version-catalog-update = "1.0.0"
62+
material3Android = "1.3.1"
6163

6264
[libraries]
6365
accompanist-adaptive = { module = "com.google.accompanist:accompanist-adaptive", version.ref = "accompanist" }
@@ -122,7 +124,7 @@ androidx-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator",
122124
androidx-tv-foundation = { module = "androidx.tv:tv-foundation", version.ref = "androidx-tv-foundation" }
123125
androidx-tv-material = { module = "androidx.tv:tv-material", version.ref = "androidx-tv-material" }
124126
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" }
127+
androidx-wear-compose-material = { module = "androidx.wear.compose:compose-material3", version.ref = "androidx-wear-compose-material3" }
126128
androidx-wear-compose-navigation = { module = "androidx.wear.compose:compose-navigation", version.ref = "androidx-wear-compose" }
127129
androidx-wear-compose-ui-tooling = { module = "androidx.wear.compose:compose-ui-tooling", version.ref = "androidx-wear-compose" }
128130
androidx-window = { module = "androidx.window:window", version.ref = "androidx-window" }
@@ -137,13 +139,15 @@ hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", vers
137139
hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
138140
hilt-ext-compiler = { module = "androidx.hilt:hilt-compiler", version.ref = "hiltExt" }
139141
horologist-audio-ui = { module = "com.google.android.horologist:horologist-audio-ui", 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-ui-model = { module = "com.google.android.horologist:horologist-media-ui-model", version.ref = "horologist" }
147151
horologist-roboscreenshots = { module = "com.google.android.horologist:horologist-roboscreenshots", version.ref = "horologist" }
148152
junit = { module = "junit:junit", version.ref = "junit" }
149153
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
@@ -162,6 +166,7 @@ rometools-modules = { module = "com.rometools:rome-modules", version.ref = "rome
162166
rometools-rome = { module = "com.rometools:rome", version.ref = "rome" }
163167
androidx-media3-session = {module = "androidx.media3:media3-session",version.ref = "media3"}
164168
androidx-media3-exoplayer = {module = "androidx.media3:media3-exoplayer", version.ref = "media3"}
169+
androidx-material3-android = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" }
165170

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

Jetcaster/wear/build.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ plugins {
2020
alias(libs.plugins.ksp)
2121
alias(libs.plugins.hilt)
2222
alias(libs.plugins.compose)
23+
alias(libs.plugins.kotlin.serialization)
2324
}
2425

2526
android {
@@ -74,7 +75,6 @@ android {
7475

7576
dependencies {
7677

77-
7878
def composeBom = platform(libs.androidx.compose.bom)
7979

8080
// General compose dependencies
@@ -90,6 +90,9 @@ dependencies {
9090
// https://issuetracker.google.com/issues/new?component=1077552&template=1598429&pli=1
9191
implementation libs.androidx.wear.compose.material
9292

93+
// For using the phone Typography
94+
implementation libs.androidx.material3.android
95+
9396
implementation(libs.kotlinx.collections.immutable)
9497

9598
// Foundation is additive, so you can use the mobile version in your Wear OS app.
@@ -104,7 +107,9 @@ dependencies {
104107

105108
//Horologist Media toolkit
106109
implementation libs.horologist.media.ui
110+
implementation libs.horologist.media.ui.model
107111
implementation libs.horologist.audio.ui
112+
implementation libs.horologist.audio.ui.model
108113
implementation libs.horologist.media.data
109114
implementation libs.horologist.images.coil
110115

@@ -140,9 +145,7 @@ dependencies {
140145
testImplementation libs.roborazzi
141146
testImplementation libs.roborazzi.compose
142147
testImplementation libs.roborazzi.rule
143-
testImplementation(libs.horologist.roboscreenshots) {
144-
exclude(group: "com.github.QuickBirdEng.kotlin-snapshot-testing")
145-
}
148+
testImplementation(libs.horologist.roboscreenshots)
146149

147150
androidTestImplementation libs.androidx.test.ext.junit
148151
androidTestImplementation libs.androidx.test.espresso.core

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class MainActivity : ComponentActivity() {
2929
lateinit var navController: NavHostController
3030

3131
override fun onCreate(savedInstanceState: Bundle?) {
32-
installSplashScreen()
3332
super.onCreate(savedInstanceState)
3433

3534
setContent {

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ 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
@@ -28,6 +27,10 @@ import androidx.lifecycle.viewmodel.compose.viewModel
2827
import androidx.navigation.NavHostController
2928
import androidx.wear.compose.navigation.SwipeDismissableNavHost
3029
import androidx.wear.compose.navigation.composable
30+
import androidx.wear.compose.foundation.pager.rememberPagerState
31+
import androidx.wear.compose.material3.AppScaffold
32+
import androidx.wear.compose.material3.ScreenScaffold
33+
import androidx.wear.compose.navigation.rememberSwipeDismissableNavController
3134
import androidx.wear.compose.navigation.rememberSwipeDismissableNavHostState
3235
import com.example.jetcaster.theme.WearAppTheme
3336
import com.example.jetcaster.ui.Episode
@@ -49,8 +52,6 @@ import com.example.jetcaster.ui.podcasts.PodcastsScreen
4952
import com.example.jetcaster.ui.queue.QueueScreen
5053
import com.google.android.horologist.audio.ui.VolumeScreen
5154
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
5455
import com.google.android.horologist.media.ui.navigation.MediaNavController.navigateToPlayer
5556
import com.google.android.horologist.media.ui.navigation.MediaNavController.navigateToVolume
5657
import com.google.android.horologist.media.ui.navigation.NavigationScreens
@@ -64,7 +65,7 @@ fun WearApp(navController: NavHostController) {
6465
WearAppTheme {
6566
AppScaffold {
6667
SwipeDismissableNavHost(
67-
startDestination = NavigationScreens.Player.playerDestination(),
68+
startDestination = NavigationScreens.Player.navRoute,
6869
navController = navController,
6970
modifier = Modifier.background(Color.Transparent),
7071
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: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
onPrimary = Color(0xFF542104),
48+
primaryContainer = primaryContainerDark,
49+
onPrimaryContainer = onPrimaryContainerDark,
50+
secondary = secondaryDark,
51+
onSecondary = onSecondaryDark,
52+
secondaryContainer = secondaryContainerDark,
53+
onSecondaryContainer = onSecondaryContainerDark,
54+
tertiary = tertiaryDark,
55+
onTertiary = onTertiaryDark,
56+
tertiaryContainer = tertiaryContainerDarkMediumContrast,
57+
error = errorDark,
58+
onError = onErrorDark,
59+
errorContainer = errorContainerDark,
60+
onErrorContainer = onErrorContainerDarkMediumContrast,
61+
background = backgroundDark,
62+
onBackground = onBackgroundDarkMediumContrast,
63+
onSurface = onSurfaceVariantDarkMediumContrast,
64+
onSurfaceVariant = onSurfaceVariantDark,
65+
surfaceContainer = surfaceContainerDarkMediumContrast,
66+
surfaceContainerLow = surfaceContainerLowDarkMediumContrast,
67+
surfaceContainerHigh = surfaceContainerHighDarkMediumContrast,
68+
outline = outlineDark,
69+
outlineVariant = outlineVariantDark,
70+
)

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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
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,
2727
// For shapes, we generally recommend using the default Material Wear shapes which are
28-
// optimized for round and non-round devices.
29-
content = content,
28+
// optimized for round devices.
29+
content = content
3030
)
3131
}

0 commit comments

Comments
 (0)