From f5a5811506b3c667fc3055d07fa69ba313f3cfb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Mlynari=C4=8D?= Date: Wed, 14 Jun 2023 10:23:22 +0200 Subject: [PATCH 1/5] Add contentType to news feed Before ScrollForYouFeedBenchmark_scrollFeedCompilationFull frameDurationCpuMs P50 4.9, P90 6.9, P95 7.6, P99 9.5 frameOverrunMs P50 -10.3, P90 -6.8, P95 -2.8, P99 -2.1 Traces: Iteration 0 1 2 3 4 5 6 7 8 9 After ScrollForYouFeedBenchmark_scrollFeedCompilationFull frameDurationCpuMs P50 4.6, P90 6.3, P95 7.2, P99 9.2 frameOverrunMs P50 -10.6, P90 -8.7, P95 -7.8, P99 -4.7 Traces: Iteration 0 1 2 3 4 5 6 7 8 9 Change-Id: I5589776f9627c27154873529c9ca9dd055a8a8ef --- .../google/samples/apps/nowinandroid/core/ui/NewsFeed.kt | 6 +++++- .../apps/nowinandroid/feature/foryou/ForYouScreen.kt | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt b/core/ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt index 58ec216fd..22783abc1 100644 --- a/core/ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt +++ b/core/ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt @@ -57,7 +57,11 @@ fun LazyGridScope.newsFeed( when (feedState) { NewsFeedUiState.Loading -> Unit is NewsFeedUiState.Success -> { - items(feedState.feed, key = { it.id }) { userNewsResource -> + items( + feedState.feed, + key = { it.id }, + contentType = { "newsFeedItem" }, + ) { userNewsResource -> val resourceUrl by remember { mutableStateOf(Uri.parse(userNewsResource.url)) } diff --git a/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt b/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt index 70cc7e541..0c6aa40e1 100644 --- a/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt +++ b/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt @@ -182,7 +182,7 @@ internal fun ForYouScreen( onTopicClick = onTopicClick, ) - item(span = { GridItemSpan(maxLineSpan) }) { + item(span = { GridItemSpan(maxLineSpan) }, contentType = { "bottomSpacing" }) { Column { Spacer(modifier = Modifier.height(8.dp)) // Add space for the content to clear the "offline" snackbar. @@ -240,7 +240,7 @@ private fun LazyGridScope.onboarding( -> Unit is OnboardingUiState.Shown -> { - item(span = { GridItemSpan(maxLineSpan) }) { + item(span = { GridItemSpan(maxLineSpan) }, contentType = "onboarding") { Column(modifier = interestsItemModifier) { Text( text = stringResource(R.string.onboarding_guidance_title), From 3cadf84adba370379f917557e47bb2f10bc9578d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Mlynari=C4=8D?= Date: Thu, 15 Jun 2023 09:59:19 +0200 Subject: [PATCH 2/5] Don't use lambda contentType for a single item Change-Id: I0588c031428d523707463c5f0f0b6c586ea5e2c3 --- .../samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt b/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt index 0c6aa40e1..eaa0c58fa 100644 --- a/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt +++ b/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt @@ -182,7 +182,7 @@ internal fun ForYouScreen( onTopicClick = onTopicClick, ) - item(span = { GridItemSpan(maxLineSpan) }, contentType = { "bottomSpacing" }) { + item(span = { GridItemSpan(maxLineSpan) }, contentType = "bottomSpacing") { Column { Spacer(modifier = Modifier.height(8.dp)) // Add space for the content to clear the "offline" snackbar. From 43c087d7aa87fb48127720bf8fd874325583ad09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Mlynari=C4=8D?= Date: Thu, 15 Jun 2023 09:59:25 +0200 Subject: [PATCH 3/5] Add named arguments Change-Id: Ic91ae4fc04bf8eb92c3e5845c7e984475526ec91 --- .../com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt b/core/ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt index 22783abc1..16cd3edf7 100644 --- a/core/ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt +++ b/core/ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt @@ -58,7 +58,7 @@ fun LazyGridScope.newsFeed( NewsFeedUiState.Loading -> Unit is NewsFeedUiState.Success -> { items( - feedState.feed, + items = feedState.feed, key = { it.id }, contentType = { "newsFeedItem" }, ) { userNewsResource -> From 5bd3b4394ca1edebad6df064bc2f75499bf31dca Mon Sep 17 00:00:00 2001 From: wiryadev Date: Sat, 17 Jun 2023 16:55:12 +0700 Subject: [PATCH 4/5] remove M1 Mac Rosetta caution in README.md --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 9aca22cbd..1b1fb795e 100644 --- a/README.md +++ b/README.md @@ -45,11 +45,6 @@ understanding of which libraries and tools are being used, the reasoning behind UI, testing, architecture and more, and how all of these different pieces of the project fit together to create a complete app. -NOTE: Building the app using an M1 Mac will require the use of -[Rosetta](https://support.apple.com/en-gb/HT211861). See -[the following bug](https://github.com/protocolbuffers/protobuf/issues/9397#issuecomment-1086138036) -for more details. - # Architecture The **Now in Android** app follows the From 3c9ff51454e6135668d190f3595e4fdccb9e3e35 Mon Sep 17 00:00:00 2001 From: tsumuchan Date: Tue, 20 Jun 2023 07:01:58 +0900 Subject: [PATCH 5/5] fix: close tag --- docs/ModularizationLearningJourney.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ModularizationLearningJourney.md b/docs/ModularizationLearningJourney.md index 8cee53672..a9766c68d 100644 --- a/docs/ModularizationLearningJourney.md +++ b/docs/ModularizationLearningJourney.md @@ -171,7 +171,7 @@ Using the above modularization strategy, the Now in Android app has the followin core:ui - Composite UI components and resources used by feature modules, such as the news feed. Unlike the designsystem module, it is dependent on the data layer since it renders models, like news resources. + Composite UI components and resources used by feature modules, such as the news feed. Unlike the designsystem module, it is dependent on the data layer since it renders models, like news resources. NewsFeed NewsResourceCardExpanded