Skip to content

Commit 355a4a6

Browse files
[Quick View] Merging compose-latest to main (#985)
2 parents e0c2383 + 7659a1d commit 355a4a6

File tree

38 files changed

+457
-449
lines changed

38 files changed

+457
-449
lines changed

Crane/app/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ android {
9898
}
9999

100100
dependencies {
101+
val composeBom = platform(libs.androidx.compose.bom)
102+
implementation(composeBom)
103+
androidTestImplementation(composeBom)
104+
101105
implementation(libs.kotlin.stdlib)
102106
implementation(libs.kotlinx.coroutines.android)
103107

Crane/benchmark/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ android {
3939
}
4040

4141
dependencies {
42+
val composeBom = platform(libs.androidx.compose.bom)
43+
implementation(composeBom)
44+
4245
implementation(libs.androidx.test.ext.junit)
4346
implementation(libs.androidx.test.espresso.core)
4447
implementation(libs.androidx.test.uiautomator)

Crane/gradle/libs.versions.toml

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
# Do not add a dependency to an individual sample, edit the global version instead.
44
#####
55
[versions]
6-
accompanist = "0.25.1"
7-
androidGradlePlugin = "7.3.0"
8-
androidx-activity-compose = "1.5.1"
9-
androidx-appcompat = "1.5.0"
6+
accompanist = "0.26.5-rc"
7+
androidGradlePlugin = "7.3.1"
8+
androidx-activity-compose = "1.6.0"
9+
androidx-appcompat = "1.5.1"
1010
androidx-benchmark = "1.1.0"
1111
androidx-benchmark-junit4 = "1.1.0-beta04"
12+
androidx-compose-bom = "2022.10.00"
1213
androidx-constraintlayout = "1.0.1"
13-
androidx-corektx = "1.8.0"
14+
androidx-corektx = "1.9.0"
1415
androidx-lifecycle-compose = "2.5.1"
15-
androidx-lifecycle-runtime-compose = "2.6.0-alpha02" # merge with above when not alpha
16-
androidx-navigation = "2.5.1"
16+
androidx-lifecycle-runtime-compose = "2.6.0-alpha03"
17+
androidx-navigation = "2.5.2"
1718
androidx-palette = "1.0.0"
18-
androidx-test = "1.3.0"
19-
androidx-test-espresso = "3.3.0"
19+
androidx-test = "1.4.0"
20+
androidx-test-espresso = "3.5.0-alpha06" # Alpha for Compose bugfix and to match upstream, https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:gradle/libs.versions.toml;l=30
2021
androidx-test-ext-junit = "1.1.3"
2122
androidx-test-ext-truth = "1.4.0"
2223
androidx-window = "1.1.0-alpha03"
@@ -25,12 +26,7 @@ androix-test-uiautomator = "2.2.0"
2526
coil = "2.2.0"
2627
# @keep
2728
compileSdk = "33"
28-
compose = "1.2.1"
29-
compose-compiler = "1.3.0"
30-
# @pin to be updated manually - check JetChat tests
31-
compose-material3 = "1.0.0-alpha15"
32-
# @pin to be updated manually - check JetChat tests
33-
compose-materialWindow = "1.0.0-alpha15"
29+
compose-compiler = "1.3.2"
3430
compose-snapshot = "-"
3531
coroutines = "1.6.4"
3632
google-maps = "18.1.0"
@@ -39,14 +35,14 @@ hiltExt = "1.0.0"
3935
# @pin When updating to AGP 7.3.0-beta03 and up we can update this https://developer.android.com/studio/write/java8-support#library-desugaring-versions
4036
jdkDesugar = "1.1.5"
4137
junit = "4.13.2"
42-
kotlin = "1.7.10"
38+
kotlin = "1.7.20"
4339
maps-compose = "2.5.3"
44-
material = "1.7.0-beta01"
40+
material = "1.8.0-alpha01"
4541
# @keep
4642
minSdk = "21"
4743
okhttp = "4.10.0"
4844
# @pin Bump to latest after Espresso 3.5.0 goes stable (due to https://github.com/robolectric/robolectric/issues/6593)
49-
roboelectric = "4.5.1"
45+
robolectric = "4.5.1"
5046
rome = "1.18.0"
5147
room = "2.5.0-alpha02"
5248
secrets = "2.0.1"
@@ -65,24 +61,25 @@ androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref
6561
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
6662
androidx-benchmark-macrobenchmark = { module = "androidx.benchmark:benchmark-macro", version.ref = "androidx-benchmark" }
6763
androidx-benchmark-macrobenchmark-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "androidx-benchmark-junit4" }
68-
androidx-compose-animation = { module = "androidx.compose.animation:animation", version.ref = "compose" }
69-
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
70-
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "compose" }
71-
androidx-compose-material = { module = "androidx.compose.material:material", version.ref = "compose" }
72-
androidx-compose-material-iconsExtended = { module = "androidx.compose.material:material-icons-extended", version.ref = "compose" }
73-
androidx-compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }
74-
androidx-compose-materialWindow = { module = "androidx.compose.material3:material3-window-size-class", version.ref = "compose-materialWindow" }
75-
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "compose" }
76-
androidx-compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata", version.ref = "compose" }
77-
androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
78-
androidx-compose-ui-googlefonts = { module = "androidx.compose.ui:ui-text-google-fonts", version.ref = "compose" }
79-
androidx-compose-ui-test = { module = "androidx.compose.ui:ui-test", version.ref = "compose" }
80-
androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" }
81-
androidx-compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose" }
82-
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
83-
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
84-
androidx-compose-ui-util = { module = "androidx.compose.ui:ui-util", version.ref = "compose" }
85-
androidx-compose-ui-viewbinding = { module = "androidx.compose.ui:ui-viewbinding", version.ref = "compose" }
64+
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidx-compose-bom" }
65+
androidx-compose-animation = { module = "androidx.compose.animation:animation" }
66+
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" }
67+
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" }
68+
androidx-compose-material = { module = "androidx.compose.material:material" }
69+
androidx-compose-material-iconsExtended = { module = "androidx.compose.material:material-icons-extended" }
70+
androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
71+
androidx-compose-materialWindow = { module = "androidx.compose.material3:material3-window-size-class" }
72+
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime" }
73+
androidx-compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata" }
74+
androidx-compose-ui = { module = "androidx.compose.ui:ui" }
75+
androidx-compose-ui-googlefonts = { module = "androidx.compose.ui:ui-text-google-fonts" }
76+
androidx-compose-ui-test = { module = "androidx.compose.ui:ui-test" }
77+
androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
78+
androidx-compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
79+
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
80+
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
81+
androidx-compose-ui-util = { module = "androidx.compose.ui:ui-util" }
82+
androidx-compose-ui-viewbinding = { module = "androidx.compose.ui:ui-viewbinding" }
8683
androidx-constraintlayout-compose = { module = "androidx.constraintlayout:constraintlayout-compose", version.ref = "androidx-constraintlayout" }
8784
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-corektx" }
8885
androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "androidxHiltNavigationCompose" }
@@ -124,7 +121,7 @@ kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutine
124121
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
125122
okhttp-logging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
126123
okhttp3 = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
127-
robolectric = { module = "org.robolectric:robolectric", version.ref = "roboelectric" }
124+
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
128125
rometools-modules = { module = "com.rometools:rome-modules", version.ref = "rome" }
129126
rometools-rome = { module = "com.rometools:rome", version.ref = "rome" }
130127
secrets-gradlePlugin = { module = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin", version.ref = "secrets" }

JetNews/app/build.gradle.kts

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -94,33 +94,25 @@ android {
9494
}
9595

9696
dependencies {
97+
val composeBom = platform(libs.androidx.compose.bom)
98+
implementation(composeBom)
99+
androidTestImplementation(composeBom)
100+
97101
implementation(libs.kotlin.stdlib)
98102
implementation(libs.kotlinx.coroutines.android)
99103

100-
// TODO: Replace when all samples use the same Material3 & Compose version
101-
implementation("androidx.compose.animation:animation:1.3.0-beta03")
102-
implementation("androidx.compose.foundation:foundation-layout:1.3.0-beta03")
103-
implementation("androidx.compose.material:material-icons-extended:1.3.0-beta03")
104-
implementation("androidx.compose.material3:material3:1.0.0-beta03")
105-
implementation("androidx.compose.material3:material3-window-size-class:1.0.0-beta03")
106-
implementation("androidx.compose.runtime:runtime-livedata:1.3.0-beta03")
107-
implementation("androidx.compose.ui:ui-tooling-preview:1.3.0-beta03")
108-
debugImplementation("androidx.compose.ui:ui-test-manifest:1.3.0-beta03")
109-
debugImplementation("androidx.compose.ui:ui-tooling:1.3.0-beta03")
110-
// implementation(libs.androidx.compose.animation)
111-
// implementation(libs.androidx.compose.foundation.layout)
112-
// implementation(libs.androidx.compose.material.iconsExtended)
113-
// implementation(libs.androidx.compose.material3)
114-
// implementation(libs.androidx.compose.materialWindow)
115-
// implementation(libs.androidx.compose.runtime.livedata)
116-
// implementation(libs.androidx.compose.ui.tooling.preview)
117-
// debugImplementation(libs.androidx.compose.ui.test.manifest)
118-
// debugImplementation(libs.androidx.compose.ui.tooling)
119-
120-
implementation("com.google.accompanist:accompanist-swiperefresh:0.26.4-beta")
121-
implementation("com.google.accompanist:accompanist-systemuicontroller:0.26.4-beta")
122-
// implementation(libs.accompanist.swiperefresh)
123-
// implementation(libs.accompanist.systemuicontroller)
104+
implementation(libs.androidx.compose.animation)
105+
implementation(libs.androidx.compose.foundation.layout)
106+
implementation(libs.androidx.compose.material.iconsExtended)
107+
implementation(libs.androidx.compose.material3)
108+
implementation(libs.androidx.compose.materialWindow)
109+
implementation(libs.androidx.compose.runtime.livedata)
110+
implementation(libs.androidx.compose.ui.tooling.preview)
111+
debugImplementation(libs.androidx.compose.ui.test.manifest)
112+
debugImplementation(libs.androidx.compose.ui.tooling)
113+
114+
implementation(libs.accompanist.swiperefresh)
115+
implementation(libs.accompanist.systemuicontroller)
124116

125117
implementation(libs.androidx.appcompat)
126118
implementation(libs.androidx.activity.ktx)
@@ -131,7 +123,7 @@ dependencies {
131123
implementation(libs.androidx.lifecycle.viewmodel.savedstate)
132124
implementation(libs.androidx.lifecycle.livedata.ktx)
133125
implementation(libs.androidx.lifecycle.viewModelCompose)
134-
126+
implementation(libs.androidx.lifecycle.runtime.compose)
135127
implementation(libs.androidx.navigation.compose)
136128
implementation(libs.androidx.window)
137129

@@ -147,9 +139,7 @@ dependencies {
147139
androidTestImplementation(libs.androidx.compose.ui.test)
148140
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
149141
// Robolectric dependencies
150-
// TODO: Replace when all samples use the same Material3 & Compose version
151-
implementation("androidx.compose.ui:ui-test-junit4:1.3.0-beta03")
152-
// testImplementation(libs.androidx.compose.ui.test.junit4)
142+
testImplementation(libs.androidx.compose.ui.test.junit4)
153143
testImplementation(libs.robolectric)
154144
}
155145

JetNews/app/src/main/java/com/example/jetnews/ui/home/HomeRoute.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ import androidx.compose.foundation.lazy.rememberLazyListState
2121
import androidx.compose.material3.Scaffold
2222
import androidx.compose.material3.SnackbarHostState
2323
import androidx.compose.runtime.Composable
24-
import androidx.compose.runtime.collectAsState
2524
import androidx.compose.runtime.getValue
2625
import androidx.compose.runtime.key
2726
import androidx.compose.runtime.remember
27+
import androidx.lifecycle.compose.ExperimentalLifecycleComposeApi
28+
import androidx.lifecycle.compose.collectAsStateWithLifecycle
2829
import com.example.jetnews.ui.article.ArticleScreen
2930
import com.example.jetnews.ui.home.HomeScreenType.ArticleDetails
3031
import com.example.jetnews.ui.home.HomeScreenType.Feed
@@ -40,6 +41,7 @@ import com.example.jetnews.ui.home.HomeScreenType.FeedWithArticleDetails
4041
* @param openDrawer (event) request opening the app drawer
4142
* @param snackbarHostState (state) state for the [Scaffold] component on this screen
4243
*/
44+
@OptIn(ExperimentalLifecycleComposeApi::class)
4345
@Composable
4446
fun HomeRoute(
4547
homeViewModel: HomeViewModel,
@@ -48,7 +50,7 @@ fun HomeRoute(
4850
snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }
4951
) {
5052
// UiState of the HomeScreen
51-
val uiState by homeViewModel.uiState.collectAsState()
53+
val uiState by homeViewModel.uiState.collectAsStateWithLifecycle()
5254

5355
HomeRoute(
5456
uiState = uiState,

JetNews/app/src/main/java/com/example/jetnews/ui/interests/InterestsScreen.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import androidx.compose.material3.Tab
5151
import androidx.compose.material3.TabRow
5252
import androidx.compose.material3.Text
5353
import androidx.compose.runtime.Composable
54-
import androidx.compose.runtime.collectAsState
5554
import androidx.compose.runtime.getValue
5655
import androidx.compose.runtime.mutableStateOf
5756
import androidx.compose.runtime.saveable.rememberSaveable
@@ -69,6 +68,8 @@ import androidx.compose.ui.unit.Dp
6968
import androidx.compose.ui.unit.constrainHeight
7069
import androidx.compose.ui.unit.constrainWidth
7170
import androidx.compose.ui.unit.dp
71+
import androidx.lifecycle.compose.ExperimentalLifecycleComposeApi
72+
import androidx.lifecycle.compose.collectAsStateWithLifecycle
7273
import com.example.jetnews.R
7374
import com.example.jetnews.data.Result
7475
import com.example.jetnews.data.interests.InterestSection
@@ -166,15 +167,16 @@ fun InterestsScreen(
166167
* Remembers the content for each tab on the Interests screen
167168
* gathering application data from [InterestsViewModel]
168169
*/
170+
@OptIn(ExperimentalLifecycleComposeApi::class)
169171
@Composable
170172
fun rememberTabContent(interestsViewModel: InterestsViewModel): List<TabContent> {
171173
// UiState of the InterestsScreen
172-
val uiState by interestsViewModel.uiState.collectAsState()
174+
val uiState by interestsViewModel.uiState.collectAsStateWithLifecycle()
173175

174176
// Describe the screen sections here since each section needs 2 states and 1 event.
175177
// Pass them to the stateless InterestsScreen using a tabContent.
176178
val topicsSection = TabContent(Sections.Topics) {
177-
val selectedTopics by interestsViewModel.selectedTopics.collectAsState()
179+
val selectedTopics by interestsViewModel.selectedTopics.collectAsStateWithLifecycle()
178180
TabWithSections(
179181
sections = uiState.topics,
180182
selectedTopics = selectedTopics,
@@ -183,7 +185,7 @@ fun rememberTabContent(interestsViewModel: InterestsViewModel): List<TabContent>
183185
}
184186

185187
val peopleSection = TabContent(Sections.People) {
186-
val selectedPeople by interestsViewModel.selectedPeople.collectAsState()
188+
val selectedPeople by interestsViewModel.selectedPeople.collectAsStateWithLifecycle()
187189
TabWithTopics(
188190
topics = uiState.people,
189191
selectedTopics = selectedPeople,
@@ -192,7 +194,8 @@ fun rememberTabContent(interestsViewModel: InterestsViewModel): List<TabContent>
192194
}
193195

194196
val publicationSection = TabContent(Sections.Publications) {
195-
val selectedPublications by interestsViewModel.selectedPublications.collectAsState()
197+
val selectedPublications by interestsViewModel.selectedPublications
198+
.collectAsStateWithLifecycle()
196199
TabWithTopics(
197200
topics = uiState.publications,
198201
selectedTopics = selectedPublications,

0 commit comments

Comments
 (0)