Skip to content

Commit 7ca17f6

Browse files
authored
Merge branch 'main' into av/remove-dolphin-preview-todos
2 parents bfedf75 + 40c0cb2 commit 7ca17f6

File tree

190 files changed

+1909
-1628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+1909
-1628
lines changed

.github/PULL_REQUEST_TEMPLATE/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ label: 'triage me'
66
Thank you for opening a Pull Request!
77
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
88
- [ ] Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
9-
- [ ] Ensure the tests and linter pass (`./gradlew spotlessApply` to automatically apply formatting)
9+
- [ ] Ensure the tests and linter pass (`./gradlew --init-script gradle/init.gradle.kts spotlessApply` to automatically apply formatting)
1010
- [ ] Appropriate docs were updated (if necessary)
1111

1212
Is this your first Pull Request?

.github/workflows/Build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ jobs:
3434
uses: gradle/gradle-build-action@v2
3535

3636
- name: Check spotless
37-
run: ./gradlew spotlessCheck --stacktrace
37+
run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
3838

3939
- name: Check lint
40-
run: ./gradlew lintDebug --stacktrace
40+
run: ./gradlew lintDemoDebug --stacktrace
4141

4242
- name: Build all build type and flavor permutations
4343
run: ./gradlew assemble --stacktrace
@@ -61,7 +61,7 @@ jobs:
6161
androidTest:
6262
needs: build
6363
runs-on: macOS-latest # enables hardware acceleration in the virtual machine
64-
timeout-minutes: 45
64+
timeout-minutes: 55
6565
strategy:
6666
matrix:
6767
api-level: [23, 26, 30]

app-nia-catalog/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# :app-nia-catalog module
2+
3+
![Dependency graph](../docs/images/graphs/dep_graph_app_nia_catalog.png)

app-nia-catalog/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
plugins {
1717
id("nowinandroid.android.application")
1818
id("nowinandroid.android.application.compose")
19-
id("nowinandroid.spotless")
2019
}
2120

2221
android {
@@ -33,6 +32,7 @@ android {
3332
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
3433
}
3534
}
35+
namespace = "com.google.samples.apps.niacatalog"
3636
}
3737

3838
dependencies {

app-nia-catalog/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
-->
17-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
18-
package="com.google.samples.apps.niacatalog">
17+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1918

2019
<application
2120
android:allowBackup="true"

app/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# :app module
2+
3+
![Dependency graph](../docs/images/graphs/dep_graph_app.png)

app/build.gradle.kts

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,13 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import com.google.samples.apps.nowinandroid.Flavor
17-
import com.google.samples.apps.nowinandroid.FlavorDimension
1816

1917
plugins {
2018
id("nowinandroid.android.application")
2119
id("nowinandroid.android.application.compose")
2220
id("nowinandroid.android.application.jacoco")
23-
kotlin("kapt")
21+
id("nowinandroid.android.hilt")
2422
id("jacoco")
25-
id("dagger.hilt.android.plugin")
26-
id("nowinandroid.spotless")
2723
id("nowinandroid.firebase-perf")
2824
}
2925

@@ -67,19 +63,6 @@ android {
6763
}
6864
}
6965

70-
// @see Flavor for more details on the app product flavors.
71-
flavorDimensions += FlavorDimension.contentType.name
72-
productFlavors {
73-
Flavor.values().forEach {
74-
create(it.name) {
75-
dimension = it.dimension.name
76-
if (it.applicationIdSuffix != null) {
77-
applicationIdSuffix = it.applicationIdSuffix
78-
}
79-
}
80-
}
81-
}
82-
8366
packagingOptions {
8467
resources {
8568
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
@@ -90,6 +73,7 @@ android {
9073
isIncludeAndroidResources = true
9174
}
9275
}
76+
namespace = "com.google.samples.apps.nowinandroid"
9377
}
9478

9579
dependencies {
@@ -103,7 +87,8 @@ dependencies {
10387
implementation(project(":core:designsystem"))
10488
implementation(project(":core:navigation"))
10589

106-
implementation(project(":sync"))
90+
implementation(project(":sync:work"))
91+
implementation(project(":sync:sync-test"))
10792

10893
androidTestImplementation(project(":core:testing"))
10994
androidTestImplementation(project(":core:datastore-test"))
@@ -124,17 +109,13 @@ dependencies {
124109

125110
implementation(libs.coil.kt)
126111
implementation(libs.coil.kt.svg)
112+
}
127113

128-
implementation(libs.hilt.android)
129-
kapt(libs.hilt.compiler)
130-
kaptAndroidTest(libs.hilt.compiler)
131-
132-
// androidx.test is forcing JUnit, 4.12. This forces it to use 4.13
133-
configurations.configureEach {
134-
resolutionStrategy {
135-
force(libs.junit4)
136-
// Temporary workaround for https://issuetracker.google.com/174733673
137-
force("org.objenesis:objenesis:2.6")
138-
}
114+
// androidx.test is forcing JUnit, 4.12. This forces it to use 4.13
115+
configurations.configureEach {
116+
resolutionStrategy {
117+
force(libs.junit4)
118+
// Temporary workaround for https://issuetracker.google.com/174733673
119+
force("org.objenesis:objenesis:2.6")
139120
}
140-
}
121+
}

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import androidx.compose.ui.test.performClick
2525
import androidx.test.espresso.Espresso
2626
import androidx.test.espresso.NoActivityResumedException
2727
import com.google.samples.apps.nowinandroid.MainActivity
28-
import com.google.samples.apps.nowinandroid.R
28+
import com.google.samples.apps.nowinandroid.feature.foryou.R as FeatureForyouR
29+
import com.google.samples.apps.nowinandroid.feature.interests.R as FeatureInterestsR
2930
import dagger.hilt.android.testing.BindValue
3031
import dagger.hilt.android.testing.HiltAndroidRule
3132
import dagger.hilt.android.testing.HiltAndroidTest
@@ -70,11 +71,11 @@ class NavigationTest {
7071
@Before
7172
fun setup() {
7273
composeTestRule.activity.apply {
73-
done = getString(R.string.done)
74-
navigateUp = getString(R.string.navigate_up)
75-
forYouLoading = getString(R.string.for_you_loading)
76-
forYou = getString(R.string.for_you)
77-
interests = getString(R.string.interests)
74+
done = getString(FeatureForyouR.string.done)
75+
navigateUp = getString(FeatureForyouR.string.navigate_up)
76+
forYouLoading = getString(FeatureForyouR.string.for_you_loading)
77+
forYou = getString(FeatureForyouR.string.for_you)
78+
interests = getString(FeatureInterestsR.string.interests)
7879
sampleTopic = "Headlines"
7980
}
8081
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
limitations under the License.
1616
-->
1717
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
18-
xmlns:tools="http://schemas.android.com/tools"
19-
package="com.google.samples.apps.nowinandroid">
18+
xmlns:tools="http://schemas.android.com/tools">
2019

2120
<uses-permission android:name="android.permission.INTERNET" />
2221

app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api
3131
import androidx.compose.material3.Icon
3232
import androidx.compose.material3.MaterialTheme
3333
import androidx.compose.material3.Scaffold
34-
import androidx.compose.material3.Surface
3534
import androidx.compose.material3.Text
3635
import androidx.compose.material3.windowsizeclass.WindowSizeClass
3736
import androidx.compose.runtime.Composable
@@ -45,13 +44,15 @@ import androidx.compose.ui.semantics.testTagsAsResourceId
4544
import androidx.navigation.NavDestination
4645
import androidx.navigation.NavDestination.Companion.hierarchy
4746
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaBackground
47+
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaGradientBackground
4848
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaNavigationBar
4949
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaNavigationBarItem
5050
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaNavigationRail
5151
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaNavigationRailItem
5252
import com.google.samples.apps.nowinandroid.core.designsystem.icon.Icon.DrawableResourceIcon
5353
import com.google.samples.apps.nowinandroid.core.designsystem.icon.Icon.ImageVectorIcon
5454
import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme
55+
import com.google.samples.apps.nowinandroid.feature.foryou.navigation.ForYouDestination
5556
import com.google.samples.apps.nowinandroid.navigation.NiaNavHost
5657
import com.google.samples.apps.nowinandroid.navigation.TopLevelDestination
5758

@@ -66,13 +67,20 @@ fun NiaApp(
6667
appState: NiaAppState = rememberNiaAppState(windowSizeClass)
6768
) {
6869
NiaTheme {
69-
NiaBackground {
70+
val background: @Composable (@Composable () -> Unit) -> Unit =
71+
when (appState.currentDestination?.route) {
72+
ForYouDestination.route -> { content -> NiaGradientBackground(content = content) }
73+
else -> { content -> NiaBackground(content = content) }
74+
}
75+
76+
background {
7077
Scaffold(
7178
modifier = Modifier.semantics {
7279
testTagsAsResourceId = true
7380
},
7481
containerColor = Color.Transparent,
7582
contentColor = MaterialTheme.colorScheme.onBackground,
83+
contentWindowInsets = WindowInsets(0, 0, 0, 0),
7684
bottomBar = {
7785
if (appState.shouldShowBottomBar) {
7886
NiaBottomBar(
@@ -158,42 +166,32 @@ private fun NiaBottomBar(
158166
onNavigateToDestination: (TopLevelDestination) -> Unit,
159167
currentDestination: NavDestination?
160168
) {
161-
// Wrap the navigation bar in a surface so the color behind the system
162-
// navigation is equal to the container color of the navigation bar.
163-
Surface(color = MaterialTheme.colorScheme.surface) {
164-
NiaNavigationBar(
165-
modifier = Modifier.windowInsetsPadding(
166-
WindowInsets.safeDrawing.only(
167-
WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom
168-
)
169+
NiaNavigationBar {
170+
destinations.forEach { destination ->
171+
val selected =
172+
currentDestination?.hierarchy?.any { it.route == destination.route } == true
173+
NiaNavigationBarItem(
174+
selected = selected,
175+
onClick = { onNavigateToDestination(destination) },
176+
icon = {
177+
val icon = if (selected) {
178+
destination.selectedIcon
179+
} else {
180+
destination.unselectedIcon
181+
}
182+
when (icon) {
183+
is ImageVectorIcon -> Icon(
184+
imageVector = icon.imageVector,
185+
contentDescription = null
186+
)
187+
is DrawableResourceIcon -> Icon(
188+
painter = painterResource(id = icon.id),
189+
contentDescription = null
190+
)
191+
}
192+
},
193+
label = { Text(stringResource(destination.iconTextId)) }
169194
)
170-
) {
171-
destinations.forEach { destination ->
172-
val selected =
173-
currentDestination?.hierarchy?.any { it.route == destination.route } == true
174-
NiaNavigationBarItem(
175-
selected = selected,
176-
onClick = { onNavigateToDestination(destination) },
177-
icon = {
178-
val icon = if (selected) {
179-
destination.selectedIcon
180-
} else {
181-
destination.unselectedIcon
182-
}
183-
when (icon) {
184-
is ImageVectorIcon -> Icon(
185-
imageVector = icon.imageVector,
186-
contentDescription = null
187-
)
188-
is DrawableResourceIcon -> Icon(
189-
painter = painterResource(id = icon.id),
190-
contentDescription = null
191-
)
192-
}
193-
},
194-
label = { Text(stringResource(destination.iconTextId)) }
195-
)
196-
}
197195
}
198196
}
199197
}

0 commit comments

Comments
 (0)