commit 52dc04090e6ac35ffe5fa5b31e801cc292905d7d
parent 49b1cf840d01340d8c2fb325e477ec2c0e704feb
Author: Devota Aabel <daabel@mozilla.com>
Date: Fri, 12 Dec 2025 20:10:52 +0000
Bug 2005539- Update homepage stories card so that the title is truncated to two lines, and show the publisher below non-sponsored stories. r=gl,android-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D276070
Diffstat:
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/pocket/ui/Stories.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/pocket/ui/Stories.kt
@@ -57,8 +57,7 @@ import org.mozilla.fenix.home.ui.HomepageTestTag.HOMEPAGE_STORY
import org.mozilla.fenix.theme.FirefoxTheme
import kotlin.math.roundToInt
-private const val DEFAULT_MAX_LINES = 3
-private const val SPONSORED_MAX_LINES = 2
+private const val DEFAULT_MAX_LINES = 2
private const val ACCESSIBILITY_MAX_LINES_SCALE_FACTOR = 1.2f
/**
@@ -90,7 +89,7 @@ fun SponsoredContentStory(
testTag = "pocket.sponsoredContent.title"
},
overflow = TextOverflow.Ellipsis,
- maxLines = maxSponsoredLines(),
+ maxLines = maxLines(),
style = FirefoxTheme.typography.body2,
)
@@ -100,7 +99,6 @@ fun SponsoredContentStory(
testTagsAsResourceId = true
testTag = "pocket.sponsoredContent.identifier"
},
- color = MaterialTheme.colorScheme.onSurfaceVariant,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
style = FirefoxTheme.typography.caption,
@@ -146,6 +144,13 @@ fun ContentRecommendationStory(
maxLines = maxLines(),
style = FirefoxTheme.typography.body2,
)
+
+ Text(
+ text = recommendation.publisher,
+ overflow = TextOverflow.Ellipsis,
+ maxLines = 1,
+ style = FirefoxTheme.typography.caption,
+ )
}
}
@@ -325,10 +330,6 @@ private fun maxLines() = if (limitMaxLines()) DEFAULT_MAX_LINES else Int.MAX_VAL
@Composable
@ReadOnlyComposable
-private fun maxSponsoredLines() = if (limitMaxLines()) SPONSORED_MAX_LINES else Int.MAX_VALUE
-
-@Composable
-@ReadOnlyComposable
private fun limitMaxLines() = LocalConfiguration.current.fontScale <= ACCESSIBILITY_MAX_LINES_SCALE_FACTOR
private class StoryProvider : PreviewParameterProvider<PocketStory> {