Skip to content

Commit

Permalink
[Cormorant] Handle long toolbar titles by adding an ellipses
Browse files Browse the repository at this point in the history
In order to avoid having long titles change the size of the follow button, I created a Linear Layout to encompass the text and the button, and give the text a weight of 1 (100%) and width of 0dp.

Screenshot of broken UI: https://screenshot.googleplex.com/5t7xgovwdhgrmdM
Screenshot of new fixed UI: https://screenshot.googleplex.com/3YWUFDsCp6q98qe

(cherry picked from commit 30263a7)

Bug: 1408853
Change-Id: I6eb335048ee00680c8eb147a42f4c28a04f6c468
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4198240
Reviewed-by: Cathy Li <chili@chromium.org>
Commit-Queue: Wissem Gamra <wiss@chromium.org>
Reviewed-by: Jeffrey Cohen <jeffreycohen@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1097697}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4213319
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Wissem Gamra <wiss@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5563@{#88}
Cr-Branched-From: 3ac59a6-refs/heads/main@{#1097615}
  • Loading branch information
Wissem Gamra authored and Chromium LUCI CQ committed Feb 1, 2023
1 parent 7dbce99 commit 585569e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 27 deletions.
62 changes: 35 additions & 27 deletions chrome/browser/creator/android/java/res/layout/creator_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,44 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
style="@style/CreatorActivityNoActionBar" >
<TextView
android:id="@+id/creator_title_toolbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:visibility="gone"
android:textAppearance="@style/TextAppearance.Headline.Primary" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/creator_all_buttons_toolbar"
android:layout_gravity="end"
android:visibility="gone" >
<org.chromium.ui.widget.ButtonCompat
android:id="@+id/creator_follow_button_toolbar"
android:layout_width="wrap_content"
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/creator_title_toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/CreatorFollowFilledButtonToolbar"
android:text="@string/menu_follow"
android:drawableStart="@drawable/follow_add"
android:visibility="gone" />
<org.chromium.ui.widget.ButtonCompat
android:id="@+id/creator_following_button_toolbar"
android:singleLine="true"
android:visibility="gone"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:paddingEnd="@dimen/creator_toolbar_text_padding"
android:textAppearance="@style/TextAppearance.Headline.Primary" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/CreatorFollowReverseButtonToolbar"
android:text="@string/menu_following"
android:drawableStart="@drawable/following_checkmark"
android:visibility="gone" />
</FrameLayout>
android:id="@+id/creator_all_buttons_toolbar"
android:layout_gravity="end"
android:visibility="gone" >
<org.chromium.ui.widget.ButtonCompat
android:id="@+id/creator_follow_button_toolbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/CreatorFollowFilledButtonToolbar"
android:text="@string/menu_follow"
android:drawableStart="@drawable/follow_add"
android:visibility="gone" />
<org.chromium.ui.widget.ButtonCompat
android:id="@+id/creator_following_button_toolbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/CreatorFollowReverseButtonToolbar"
android:text="@string/menu_following"
android:drawableStart="@drawable/following_checkmark"
android:visibility="gone" />
</FrameLayout>
</LinearLayout>
</com.google.android.material.appbar.MaterialToolbar>
<View
android:id="@+id/creator_toolbar_bottom_border"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/creator/android/java/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ found in the LICENSE file.
<!-- Toolbar dimensions -->
<dimen name="creator_toolbar_bottom_border_height">1dp</dimen>
<dimen name="creator_toolbar_inset_start">0dp</dimen>
<dimen name="creator_toolbar_text_padding">10dp</dimen>

<!-- Profile dimensions -->
<dimen name="creator_profile_container_width">0dp</dimen>
Expand Down

0 comments on commit 585569e

Please sign in to comment.