From 825480fbccdb3f5b2d49930ddfc894d8815c6c31 Mon Sep 17 00:00:00 2001 From: hyunyoungs Date: Fri, 24 Mar 2023 10:11:15 -0700 Subject: [PATCH] Icon should not disappear on drag and drop Bug: 275009677 Test: BubbleTextViewTest Change-Id: Iddff7a0130c9a0ddb76223064338459dbe9b52e8 --- src/com/android/launcher3/BubbleTextView.java | 8 +++++--- .../src/com/android/launcher3/ui/BubbleTextViewTest.java | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index ea79c5584d..db5eb1e5bc 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -72,9 +72,9 @@ import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.PopupContainerWithArrow; -import com.android.launcher3.util.MultiTranslateDelegate; import com.android.launcher3.search.StringMatcherUtility; import com.android.launcher3.util.IntArray; +import com.android.launcher3.util.MultiTranslateDelegate; import com.android.launcher3.util.SafeCloseable; import com.android.launcher3.util.ShortcutUtil; import com.android.launcher3.views.ActivityContext; @@ -269,8 +269,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, mDotParams.scale = 0f; mForceHideDot = false; setBackground(null); - setSingleLine(true); - setMaxLines(1); + if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() + || FeatureFlags.ENABLE_TWOLINE_DEVICESEARCH.get()) { + setMaxLines(1); + } setTag(null); if (mIconLoadRequest != null) { diff --git a/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java b/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java index d07c6c26fd..fdba4eb2a3 100644 --- a/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java +++ b/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java @@ -21,6 +21,7 @@ import static androidx.test.core.app.ApplicationProvider.getApplicationContext; import static com.android.launcher3.config.FeatureFlags.ENABLE_TWOLINE_ALLAPPS; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import android.content.Context; import android.graphics.Typeface; @@ -79,7 +80,6 @@ public class BubbleTextViewTest { mBubbleTextView = new BubbleTextView(mContext); mBubbleTextView.reset(); mBubbleTextView.setDisplayAllApps(); - assertEquals(ONE_LINE, mBubbleTextView.getMaxLines()); BubbleTextView testView = new BubbleTextView(mContext); testView.setTypeface(Typeface.MONOSPACE); @@ -108,7 +108,7 @@ public class BubbleTextViewTest { mBubbleTextView.setTypeface(Typeface.MONOSPACE); mBubbleTextView.measure(mLimitedWidth, 0); mBubbleTextView.onPreDraw(); - assertEquals(ONE_LINE, mBubbleTextView.getMaxLines()); + assertNotEquals(TWO_LINE, mBubbleTextView.getMaxLines()); } catch (Exception e) { throw new RuntimeException(e); }