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
pull/799/head
Tomáš Mlynarič 2 years ago
parent c0ba97e170
commit 4a8a43551a

@ -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))
}

@ -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),

Loading…
Cancel
Save