Skip to content

Commit 4a8a435

Browse files
committed
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
1 parent c0ba97e commit 4a8a435

File tree

2 files changed

+7
-3
lines changed
  • core/ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui
  • feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou

2 files changed

+7
-3
lines changed

core/ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/NewsFeed.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ fun LazyGridScope.newsFeed(
5757
when (feedState) {
5858
NewsFeedUiState.Loading -> Unit
5959
is NewsFeedUiState.Success -> {
60-
items(feedState.feed, key = { it.id }) { userNewsResource ->
60+
items(
61+
feedState.feed,
62+
key = { it.id },
63+
contentType = { "newsFeedItem" },
64+
) { userNewsResource ->
6165
val resourceUrl by remember {
6266
mutableStateOf(Uri.parse(userNewsResource.url))
6367
}

feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ internal fun ForYouScreen(
182182
onTopicClick = onTopicClick,
183183
)
184184

185-
item(span = { GridItemSpan(maxLineSpan) }) {
185+
item(span = { GridItemSpan(maxLineSpan) }, contentType = { "bottomSpacing" }) {
186186
Column {
187187
Spacer(modifier = Modifier.height(8.dp))
188188
// Add space for the content to clear the "offline" snackbar.
@@ -240,7 +240,7 @@ private fun LazyGridScope.onboarding(
240240
-> Unit
241241

242242
is OnboardingUiState.Shown -> {
243-
item(span = { GridItemSpan(maxLineSpan) }) {
243+
item(span = { GridItemSpan(maxLineSpan) }, contentType = "onboarding") {
244244
Column(modifier = interestsItemModifier) {
245245
Text(
246246
text = stringResource(R.string.onboarding_guidance_title),

0 commit comments

Comments
 (0)