From 2c72b9bd1a36b863c8178a2938f52a4ebd6adcbd Mon Sep 17 00:00:00 2001 From: Toni Barzic Date: Thu, 26 Sep 2024 00:20:56 +0000 Subject: [PATCH] Fix cropped folder name text in arabic Centralize the folder name within folder footer using gravity property instead of adding padding to the folder name view. Padding as calculated was cropping the folder name to the text line height, which was insuficient in some cases, as eveidenced by the linked bug. Bug: b/358006967 Test: Open a folder on home screen with arabic system language. Verify that the folder name displays correctly. Flag: EXEMPT bugfix Change-Id: I4436c224f7f6541f447e3a5354ff870cf4d50698 --- res/layout/user_folder_icon_normalized.xml | 5 ++--- src/com/android/launcher3/folder/Folder.java | 5 +---- src/com/android/launcher3/folder/FolderPagedView.java | 5 +++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/res/layout/user_folder_icon_normalized.xml b/res/layout/user_folder_icon_normalized.xml index 43a8aac8b2..002e7b7eec 100644 --- a/res/layout/user_folder_icon_normalized.xml +++ b/res/layout/user_folder_icon_normalized.xml @@ -40,12 +40,11 @@ implements Cli // Update footer mPageIndicator.setVisibility(getPageCount() > 1 ? View.VISIBLE : View.GONE); // Set the gravity as LEFT or RIGHT instead of START, as START depends on the actual text. - mFolder.getFolderName().setGravity(getPageCount() > 1 - ? (mIsRtl ? Gravity.RIGHT : Gravity.LEFT) : Gravity.CENTER_HORIZONTAL); + int horizontalGravity = getPageCount() > 1 + ? (mIsRtl ? Gravity.RIGHT : Gravity.LEFT) : Gravity.CENTER_HORIZONTAL; + mFolder.getFolderName().setGravity(horizontalGravity | Gravity.CENTER_VERTICAL); } public int getDesiredWidth() {