Skip to content

Commit d67b1a2

Browse files
authored
Merge branch 'android:main' into rename-test-function
2 parents e017b84 + 19f6f9e commit d67b1a2

File tree

24 files changed

+415
-135
lines changed

24 files changed

+415
-135
lines changed

app-nia-catalog/dependencies/releaseRuntimeClasspath.txt

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,41 @@ androidx.browser:browser:1.6.0
1212
androidx.collection:collection-jvm:1.4.0
1313
androidx.collection:collection-ktx:1.4.0
1414
androidx.collection:collection:1.4.0
15-
androidx.compose.animation:animation-android:1.6.1
16-
androidx.compose.animation:animation-core-android:1.6.1
17-
androidx.compose.animation:animation-core:1.6.1
18-
androidx.compose.animation:animation:1.6.1
19-
androidx.compose.foundation:foundation-android:1.6.1
20-
androidx.compose.foundation:foundation-layout-android:1.6.1
21-
androidx.compose.foundation:foundation-layout:1.6.1
22-
androidx.compose.foundation:foundation:1.6.1
15+
androidx.compose.animation:animation-android:1.6.2
16+
androidx.compose.animation:animation-core-android:1.6.2
17+
androidx.compose.animation:animation-core:1.6.2
18+
androidx.compose.animation:animation:1.6.2
19+
androidx.compose.foundation:foundation-android:1.6.2
20+
androidx.compose.foundation:foundation-layout-android:1.6.2
21+
androidx.compose.foundation:foundation-layout:1.6.2
22+
androidx.compose.foundation:foundation:1.6.2
2323
androidx.compose.material3:material3-android:1.2.0
2424
androidx.compose.material3:material3:1.2.0
25-
androidx.compose.material:material-icons-core-android:1.6.1
26-
androidx.compose.material:material-icons-core:1.6.1
27-
androidx.compose.material:material-icons-extended-android:1.6.1
28-
androidx.compose.material:material-icons-extended:1.6.1
29-
androidx.compose.material:material-ripple-android:1.6.1
30-
androidx.compose.material:material-ripple:1.6.1
31-
androidx.compose.runtime:runtime-android:1.6.1
32-
androidx.compose.runtime:runtime-saveable-android:1.6.1
33-
androidx.compose.runtime:runtime-saveable:1.6.1
34-
androidx.compose.runtime:runtime:1.6.1
35-
androidx.compose.ui:ui-android:1.6.1
36-
androidx.compose.ui:ui-geometry-android:1.6.1
37-
androidx.compose.ui:ui-geometry:1.6.1
38-
androidx.compose.ui:ui-graphics-android:1.6.1
39-
androidx.compose.ui:ui-graphics:1.6.1
40-
androidx.compose.ui:ui-text-android:1.6.1
41-
androidx.compose.ui:ui-text:1.6.1
42-
androidx.compose.ui:ui-tooling-preview-android:1.6.1
43-
androidx.compose.ui:ui-tooling-preview:1.6.1
44-
androidx.compose.ui:ui-unit-android:1.6.1
45-
androidx.compose.ui:ui-unit:1.6.1
46-
androidx.compose.ui:ui-util-android:1.6.1
47-
androidx.compose.ui:ui-util:1.6.1
48-
androidx.compose.ui:ui:1.6.1
49-
androidx.compose:compose-bom:2024.02.00
25+
androidx.compose.material:material-icons-core-android:1.6.2
26+
androidx.compose.material:material-icons-core:1.6.2
27+
androidx.compose.material:material-icons-extended-android:1.6.2
28+
androidx.compose.material:material-icons-extended:1.6.2
29+
androidx.compose.material:material-ripple-android:1.6.2
30+
androidx.compose.material:material-ripple:1.6.2
31+
androidx.compose.runtime:runtime-android:1.6.2
32+
androidx.compose.runtime:runtime-saveable-android:1.6.2
33+
androidx.compose.runtime:runtime-saveable:1.6.2
34+
androidx.compose.runtime:runtime:1.6.2
35+
androidx.compose.ui:ui-android:1.6.2
36+
androidx.compose.ui:ui-geometry-android:1.6.2
37+
androidx.compose.ui:ui-geometry:1.6.2
38+
androidx.compose.ui:ui-graphics-android:1.6.2
39+
androidx.compose.ui:ui-graphics:1.6.2
40+
androidx.compose.ui:ui-text-android:1.6.2
41+
androidx.compose.ui:ui-text:1.6.2
42+
androidx.compose.ui:ui-tooling-preview-android:1.6.2
43+
androidx.compose.ui:ui-tooling-preview:1.6.2
44+
androidx.compose.ui:ui-unit-android:1.6.2
45+
androidx.compose.ui:ui-unit:1.6.2
46+
androidx.compose.ui:ui-util-android:1.6.2
47+
androidx.compose.ui:ui-util:1.6.2
48+
androidx.compose.ui:ui:1.6.2
49+
androidx.compose:compose-bom:2024.02.01
5050
androidx.concurrent:concurrent-futures:1.1.0
5151
androidx.core:core-ktx:1.12.0
5252
androidx.core:core:1.12.0

app/build.gradle.kts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,21 @@ dependencies {
8989
implementation(projects.sync.work)
9090

9191
implementation(libs.androidx.activity.compose)
92+
implementation(libs.androidx.compose.material3.adaptive)
93+
implementation(libs.androidx.compose.material3.windowSizeClass)
94+
implementation(libs.androidx.compose.runtime.tracing)
9295
implementation(libs.androidx.core.ktx)
9396
implementation(libs.androidx.core.splashscreen)
94-
implementation(libs.androidx.tracing.ktx)
97+
implementation(libs.androidx.hilt.navigation.compose)
9598
implementation(libs.androidx.lifecycle.runtimeCompose)
96-
implementation(libs.androidx.compose.runtime.tracing)
97-
implementation(libs.androidx.compose.material3.windowSizeClass)
9899
implementation(libs.androidx.navigation.compose)
99100
implementation(libs.androidx.profileinstaller)
101+
implementation(libs.androidx.tracing.ktx)
100102
implementation(libs.kotlinx.coroutines.guava)
101103
implementation(libs.coil.kt)
102104

105+
ksp(libs.hilt.compiler)
106+
103107
debugImplementation(libs.androidx.compose.ui.testManifest)
104108
debugImplementation(projects.uiTestHiltManifest)
105109

app/dependencies/prodReleaseRuntimeClasspath.txt

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,46 @@ androidx.browser:browser:1.6.0
1313
androidx.collection:collection-jvm:1.4.0
1414
androidx.collection:collection-ktx:1.4.0
1515
androidx.collection:collection:1.4.0
16-
androidx.compose.animation:animation-android:1.6.1
17-
androidx.compose.animation:animation-core-android:1.6.1
18-
androidx.compose.animation:animation-core:1.6.1
19-
androidx.compose.animation:animation:1.6.1
20-
androidx.compose.foundation:foundation-android:1.6.1
21-
androidx.compose.foundation:foundation-layout-android:1.6.1
22-
androidx.compose.foundation:foundation-layout:1.6.1
23-
androidx.compose.foundation:foundation:1.6.1
16+
androidx.compose.animation:animation-android:1.6.2
17+
androidx.compose.animation:animation-core-android:1.6.2
18+
androidx.compose.animation:animation-core:1.6.2
19+
androidx.compose.animation:animation:1.6.2
20+
androidx.compose.foundation:foundation-android:1.6.2
21+
androidx.compose.foundation:foundation-layout-android:1.6.2
22+
androidx.compose.foundation:foundation-layout:1.6.2
23+
androidx.compose.foundation:foundation:1.6.2
24+
androidx.compose.material3:material3-adaptive-android:1.0.0-alpha06
25+
androidx.compose.material3:material3-adaptive:1.0.0-alpha06
2426
androidx.compose.material3:material3-android:1.2.0
2527
androidx.compose.material3:material3-window-size-class-android:1.2.0
2628
androidx.compose.material3:material3-window-size-class:1.2.0
2729
androidx.compose.material3:material3:1.2.0
28-
androidx.compose.material:material-icons-core-android:1.6.1
29-
androidx.compose.material:material-icons-core:1.6.1
30-
androidx.compose.material:material-icons-extended-android:1.6.1
31-
androidx.compose.material:material-icons-extended:1.6.1
32-
androidx.compose.material:material-ripple-android:1.6.1
33-
androidx.compose.material:material-ripple:1.6.1
34-
androidx.compose.runtime:runtime-android:1.6.1
35-
androidx.compose.runtime:runtime-saveable-android:1.6.1
36-
androidx.compose.runtime:runtime-saveable:1.6.1
30+
androidx.compose.material:material-icons-core-android:1.6.2
31+
androidx.compose.material:material-icons-core:1.6.2
32+
androidx.compose.material:material-icons-extended-android:1.6.2
33+
androidx.compose.material:material-icons-extended:1.6.2
34+
androidx.compose.material:material-ripple-android:1.6.2
35+
androidx.compose.material:material-ripple:1.6.2
36+
androidx.compose.runtime:runtime-android:1.6.2
37+
androidx.compose.runtime:runtime-saveable-android:1.6.2
38+
androidx.compose.runtime:runtime-saveable:1.6.2
3739
androidx.compose.runtime:runtime-tracing:1.0.0-beta01
38-
androidx.compose.runtime:runtime:1.6.1
39-
androidx.compose.ui:ui-android:1.6.1
40-
androidx.compose.ui:ui-geometry-android:1.6.1
41-
androidx.compose.ui:ui-geometry:1.6.1
42-
androidx.compose.ui:ui-graphics-android:1.6.1
43-
androidx.compose.ui:ui-graphics:1.6.1
44-
androidx.compose.ui:ui-text-android:1.6.1
45-
androidx.compose.ui:ui-text:1.6.1
46-
androidx.compose.ui:ui-tooling-preview-android:1.6.1
47-
androidx.compose.ui:ui-tooling-preview:1.6.1
48-
androidx.compose.ui:ui-unit-android:1.6.1
49-
androidx.compose.ui:ui-unit:1.6.1
50-
androidx.compose.ui:ui-util-android:1.6.1
51-
androidx.compose.ui:ui-util:1.6.1
52-
androidx.compose.ui:ui:1.6.1
53-
androidx.compose:compose-bom:2024.02.00
40+
androidx.compose.runtime:runtime:1.6.2
41+
androidx.compose.ui:ui-android:1.6.2
42+
androidx.compose.ui:ui-geometry-android:1.6.2
43+
androidx.compose.ui:ui-geometry:1.6.2
44+
androidx.compose.ui:ui-graphics-android:1.6.2
45+
androidx.compose.ui:ui-graphics:1.6.2
46+
androidx.compose.ui:ui-text-android:1.6.2
47+
androidx.compose.ui:ui-text:1.6.2
48+
androidx.compose.ui:ui-tooling-preview-android:1.6.2
49+
androidx.compose.ui:ui-tooling-preview:1.6.2
50+
androidx.compose.ui:ui-unit-android:1.6.2
51+
androidx.compose.ui:ui-unit:1.6.2
52+
androidx.compose.ui:ui-util-android:1.6.2
53+
androidx.compose.ui:ui-util:1.6.2
54+
androidx.compose.ui:ui:1.6.2
55+
androidx.compose:compose-bom:2024.02.01
5456
androidx.concurrent:concurrent-futures:1.1.0
5557
androidx.core:core-ktx:1.12.0
5658
androidx.core:core-splashscreen:1.0.1
@@ -116,7 +118,8 @@ androidx.vectordrawable:vectordrawable-animated:1.1.0
116118
androidx.vectordrawable:vectordrawable:1.1.0
117119
androidx.versionedparcelable:versionedparcelable:1.1.1
118120
androidx.viewpager:viewpager:1.0.0
119-
androidx.window:window:1.0.0
121+
androidx.window.extensions.core:core:1.0.0
122+
androidx.window:window:1.2.0
120123
androidx.work:work-runtime-ktx:2.9.0
121124
androidx.work:work-runtime:2.9.0
122125
com.caverock:androidsvg-aar:1.4

app/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,19 +274,19 @@ class NavigationTest {
274274

275275
// Select the last topic
276276
val topic = runBlocking {
277-
topicsRepository.getTopics().first().sortedBy(Topic::name).last().name
277+
topicsRepository.getTopics().first().sortedBy(Topic::name).last()
278278
}
279-
onNodeWithTag("interests:topics").performScrollToNode(hasText(topic))
280-
onNodeWithText(topic).performClick()
279+
onNodeWithTag("interests:topics").performScrollToNode(hasText(topic.name))
280+
onNodeWithText(topic.name).performClick()
281281

282282
// Switch tab
283283
onNodeWithText(forYou).performClick()
284284

285285
// Come back to Interests
286286
onNodeWithText(interests).performClick()
287287

288-
// Verify we're not in the list of interests
289-
onNodeWithTag("interests:topics").assertDoesNotExist()
288+
// Verify the topic is still shown
289+
onNodeWithTag("topic:${topic.id}").assertExists()
290290
}
291291
}
292292
}

app/src/main/kotlin/com/google/samples/apps/nowinandroid/navigation/NiaNavHost.kt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ import androidx.navigation.compose.NavHost
2222
import com.google.samples.apps.nowinandroid.feature.bookmarks.navigation.bookmarksScreen
2323
import com.google.samples.apps.nowinandroid.feature.foryou.navigation.FOR_YOU_ROUTE
2424
import com.google.samples.apps.nowinandroid.feature.foryou.navigation.forYouScreen
25-
import com.google.samples.apps.nowinandroid.feature.interests.navigation.interestsGraph
25+
import com.google.samples.apps.nowinandroid.feature.interests.navigation.navigateToInterests
2626
import com.google.samples.apps.nowinandroid.feature.search.navigation.searchScreen
27-
import com.google.samples.apps.nowinandroid.feature.topic.navigation.navigateToTopic
28-
import com.google.samples.apps.nowinandroid.feature.topic.navigation.topicScreen
2927
import com.google.samples.apps.nowinandroid.navigation.TopLevelDestination.INTERESTS
3028
import com.google.samples.apps.nowinandroid.ui.NiaAppState
29+
import com.google.samples.apps.nowinandroid.ui.interests2pane.interestsListDetailScreen
3130

3231
/**
3332
* Top-level navigation graph. Navigation is organized as explained at
@@ -49,24 +48,16 @@ fun NiaNavHost(
4948
startDestination = startDestination,
5049
modifier = modifier,
5150
) {
52-
forYouScreen(onTopicClick = navController::navigateToTopic)
51+
forYouScreen(onTopicClick = navController::navigateToInterests)
5352
bookmarksScreen(
54-
onTopicClick = navController::navigateToTopic,
53+
onTopicClick = navController::navigateToInterests,
5554
onShowSnackbar = onShowSnackbar,
5655
)
5756
searchScreen(
5857
onBackClick = navController::popBackStack,
5958
onInterestsClick = { appState.navigateToTopLevelDestination(INTERESTS) },
60-
onTopicClick = navController::navigateToTopic,
61-
)
62-
interestsGraph(
63-
onTopicClick = navController::navigateToTopic,
64-
nestedGraphs = {
65-
topicScreen(
66-
onBackClick = navController::popBackStack,
67-
onTopicClick = navController::navigateToTopic,
68-
)
69-
},
59+
onTopicClick = navController::navigateToInterests,
7060
)
61+
interestsListDetailScreen()
7162
}
7263
}

app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import com.google.samples.apps.nowinandroid.feature.bookmarks.navigation.navigat
3939
import com.google.samples.apps.nowinandroid.feature.foryou.navigation.FOR_YOU_ROUTE
4040
import com.google.samples.apps.nowinandroid.feature.foryou.navigation.navigateToForYou
4141
import com.google.samples.apps.nowinandroid.feature.interests.navigation.INTERESTS_ROUTE
42-
import com.google.samples.apps.nowinandroid.feature.interests.navigation.navigateToInterestsGraph
42+
import com.google.samples.apps.nowinandroid.feature.interests.navigation.navigateToInterests
4343
import com.google.samples.apps.nowinandroid.feature.search.navigation.navigateToSearch
4444
import com.google.samples.apps.nowinandroid.navigation.TopLevelDestination
4545
import com.google.samples.apps.nowinandroid.navigation.TopLevelDestination.BOOKMARKS
@@ -173,7 +173,7 @@ class NiaAppState(
173173
when (topLevelDestination) {
174174
FOR_YOU -> navController.navigateToForYou(topLevelNavOptions)
175175
BOOKMARKS -> navController.navigateToBookmarks(topLevelNavOptions)
176-
INTERESTS -> navController.navigateToInterestsGraph(topLevelNavOptions)
176+
INTERESTS -> navController.navigateToInterests(null, topLevelNavOptions)
177177
}
178178
}
179179
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2024 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.google.samples.apps.nowinandroid.ui.interests2pane
18+
19+
import androidx.lifecycle.SavedStateHandle
20+
import androidx.lifecycle.ViewModel
21+
import com.google.samples.apps.nowinandroid.feature.interests.navigation.TOPIC_ID_ARG
22+
import dagger.hilt.android.lifecycle.HiltViewModel
23+
import kotlinx.coroutines.flow.StateFlow
24+
import javax.inject.Inject
25+
26+
@HiltViewModel
27+
class Interests2PaneViewModel @Inject constructor(
28+
private val savedStateHandle: SavedStateHandle,
29+
) : ViewModel() {
30+
val selectedTopicId: StateFlow<String?> = savedStateHandle.getStateFlow(TOPIC_ID_ARG, null)
31+
32+
fun onTopicClick(topicId: String?) {
33+
savedStateHandle[TOPIC_ID_ARG] = topicId
34+
}
35+
}

0 commit comments

Comments
 (0)