Skip to content

Commit 21777ab

Browse files
authored
Merge pull request #799 from android/tm/feed-content-type
Add contentType to news feed
2 parents 6da68f6 + 8e1e994 commit 21777ab

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+
items = 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)