From 8906cfcc3fe979bb5263a1f19f54cad05fb7f96d Mon Sep 17 00:00:00 2001 From: Elise Richards Date: Fri, 15 Oct 2021 14:35:17 -0700 Subject: [PATCH] For #21522: Wrap section titles on home (#21836) --- .../mozilla/fenix/compose/SectionHeader.kt | 2 +- .../pocket/PocketStoriesViewHolder.kt | 4 +++ .../res/layout/history_metadata_header.xml | 24 ++++++++------- .../res/layout/recent_bookmarks_header.xml | 23 ++++++++------- .../main/res/layout/recent_tabs_header.xml | 29 ++++++++++--------- 5 files changed, 46 insertions(+), 36 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/compose/SectionHeader.kt b/app/src/main/java/org/mozilla/fenix/compose/SectionHeader.kt index b53c87c48d..a358fcd1eb 100644 --- a/app/src/main/java/org/mozilla/fenix/compose/SectionHeader.kt +++ b/app/src/main/java/org/mozilla/fenix/compose/SectionHeader.kt @@ -60,7 +60,7 @@ fun HomeSectionHeader( fontSize = 16.sp, lineHeight = 20.sp ), - maxLines = 1, + maxLines = 2, overflow = TextOverflow.Ellipsis, color = FirefoxTheme.colors.textPrimary ) diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/pocket/PocketStoriesViewHolder.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/pocket/PocketStoriesViewHolder.kt index e3d357e2c3..35d3262705 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/pocket/PocketStoriesViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/pocket/PocketStoriesViewHolder.kt @@ -11,8 +11,10 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy @@ -98,6 +100,7 @@ fun PocketStories( modifier = Modifier .fillMaxWidth() .padding(horizontal = horizontalPadding.dp) + .wrapContentHeight(align = Alignment.Top) ) Spacer(Modifier.height(17.dp)) @@ -111,6 +114,7 @@ fun PocketStories( modifier = Modifier .fillMaxWidth() .padding(horizontal = horizontalPadding.dp) + .wrapContentHeight(align = Alignment.Top) ) Spacer(Modifier.height(17.dp)) diff --git a/app/src/main/res/layout/history_metadata_header.xml b/app/src/main/res/layout/history_metadata_header.xml index 56f30d3844..138bfd42ca 100644 --- a/app/src/main/res/layout/history_metadata_header.xml +++ b/app/src/main/res/layout/history_metadata_header.xml @@ -8,18 +8,20 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="@dimen/home_item_horizontal_margin" - android:layout_marginTop="40dp"> + android:layout_marginTop="40dp" + android:layout_marginBottom="16dp"> diff --git a/app/src/main/res/layout/recent_bookmarks_header.xml b/app/src/main/res/layout/recent_bookmarks_header.xml index e08ffdd189..0c97c2285f 100644 --- a/app/src/main/res/layout/recent_bookmarks_header.xml +++ b/app/src/main/res/layout/recent_bookmarks_header.xml @@ -14,14 +14,15 @@ + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/recent_tabs_header.xml b/app/src/main/res/layout/recent_tabs_header.xml index 76a9e5820f..6876c48a30 100644 --- a/app/src/main/res/layout/recent_tabs_header.xml +++ b/app/src/main/res/layout/recent_tabs_header.xml @@ -7,35 +7,38 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="@dimen/home_item_horizontal_margin" - android:layout_marginTop="40dp"> + android:layout_marginTop="40dp" + android:layout_marginBottom="16dp"> + app:layout_constraintEnd_toStartOf="@id/show_all_button" + app:layout_constraintTop_toTopOf="parent" />