From a0b5a17ca80a77acd78cf2ac4ea66658f257e909 Mon Sep 17 00:00:00 2001 From: MrSluffy Date: Sat, 15 Feb 2025 07:32:37 +0800 Subject: [PATCH] fixed : label disappear in workspace - closes : #5256 --- src/com/android/launcher3/BubbleTextView.java | 8 +++++--- src/com/android/launcher3/CellLayout.java | 10 ++++++---- src/com/android/launcher3/DeviceProfile.java | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 16c6db09a5..bd891aa6eb 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -849,9 +849,11 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, // Text should be visible everywhere but the hotseat. Object tag = getParent() instanceof FolderIcon ? ((View) getParent()).getTag() : getTag(); ItemInfo info = tag instanceof ItemInfo ? (ItemInfo) tag : null; - return info == null || ((info.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT - && info.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION) - && !PreferenceExtensionsKt.firstBlocking(pref2.getEnableLabelInDock())); + if (info != null && (info.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT + && info.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION)) { + return !PreferenceExtensionsKt.firstBlocking(pref2.getEnableLabelInDock()); + } + return true; } public void setTextVisibility(boolean visible) { diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 986d9d7d02..92277800f1 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -757,10 +757,12 @@ public class CellLayout extends ViewGroup { CellLayoutLayoutParams params, boolean markCells) { final CellLayoutLayoutParams lp = params; - // Hotseat icons - remove text - if (child instanceof BubbleTextView) { - BubbleTextView bubbleChild = (BubbleTextView) child; - bubbleChild.setTextVisibility(PreferenceExtensionsKt.firstBlocking(pref.getEnableLabelInDock())); + // Hotseat icons - modified by lawnchair + if (child instanceof BubbleTextView bubbleChild) { + boolean enableLabel = mContainerType == HOTSEAT + ? PreferenceExtensionsKt.firstBlocking(pref.getEnableLabelInDock()) + : true; + bubbleChild.setTextVisibility(enableLabel); } child.setScaleX(DEFAULT_SCALE); diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 38ce097738..41273c9f46 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -938,7 +938,7 @@ public class DeviceProfile { hotseatCellHeightPx = getIconSizeWithOverlap(hotseatIconSizePx * 2) - hotseatIconSizePx / 2; hotseatCellHeightPx += isLabelInDock ? iconTextHeight : 0; - hotseatQsbSpace += isLabelInDock ? iconTextHeight : 0; + hotseatQsbSpace += isLabelInDock ? (iconTextHeight / 2) : 0; var space = Math.abs(hotseatCellHeightPx / 2) - 16;