diff --git a/res/layout/widgets_list_row_view.xml b/res/layout/widgets_list_row_view.xml
index 91baf7a769..eec57a5df3 100644
--- a/res/layout/widgets_list_row_view.xml
+++ b/res/layout/widgets_list_row_view.xml
@@ -31,7 +31,6 @@
android:layout_height="@dimen/widget_section_height"
android:background="?android:attr/colorPrimary"
android:drawablePadding="@dimen/widget_section_horizontal_padding"
- android:ellipsize="end"
android:focusable="true"
android:gravity="start|center_vertical"
android:paddingBottom="@dimen/widget_section_vertical_padding"
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ac6a6b1b53..8076c800ed 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -112,7 +112,6 @@
- true
- center_horizontal
- true
- - marquee
- ?android:attr/textColorSecondary
- sans-serif-condensed
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index fc61155d37..4fd39b0838 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -28,6 +28,7 @@ import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.support.v4.graphics.ColorUtils;
+import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
import android.util.Property;
import android.util.TypedValue;
@@ -163,10 +164,18 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
mLongPressHelper = new CheckLongPressHelper(this);
mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
+ setEllipsize(TruncateAt.END);
setAccessibilityDelegate(mActivity.getAccessibilityDelegate());
}
+ @Override
+ protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
+ // Disable marques when not focused to that, so that updating text does not cause relayout.
+ setEllipsize(focused ? TruncateAt.MARQUEE : TruncateAt.END);
+ super.onFocusChanged(focused, direction, previouslyFocusedRect);
+ }
+
/**
* Resets the view so it can be recycled.
*/
@@ -521,31 +530,30 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
* Sets the icon for this view based on the layout direction.
*/
private void setIcon(Drawable icon) {
- mIcon = icon;
- mIcon.setBounds(0, 0, mIconSize, mIconSize);
if (mIsIconVisible) {
- applyCompoundDrawables(mIcon);
+ applyCompoundDrawables(icon);
}
+ mIcon = icon;
}
public void setIconVisible(boolean visible) {
mIsIconVisible = visible;
- mDisableRelayout = true;
- Drawable icon = mIcon;
- if (!visible) {
- icon = new ColorDrawable(Color.TRANSPARENT);
- icon.setBounds(0, 0, mIconSize, mIconSize);
- }
+ Drawable icon = visible ? mIcon : new ColorDrawable(Color.TRANSPARENT);
applyCompoundDrawables(icon);
- mDisableRelayout = false;
}
protected void applyCompoundDrawables(Drawable icon) {
+ // If we had already set an icon before, disable relayout as the icon size is the
+ // same as before.
+ mDisableRelayout = mIcon != null;
+
+ icon.setBounds(0, 0, mIconSize, mIconSize);
if (mLayoutHorizontal) {
setCompoundDrawablesRelative(icon, null, null, null);
} else {
setCompoundDrawables(null, icon, null, null);
}
+ mDisableRelayout = false;
}
@Override
diff --git a/src/com/android/launcher3/views/DoubleShadowBubbleTextView.java b/src/com/android/launcher3/views/DoubleShadowBubbleTextView.java
index 01b63bec47..a11a8c5377 100644
--- a/src/com/android/launcher3/views/DoubleShadowBubbleTextView.java
+++ b/src/com/android/launcher3/views/DoubleShadowBubbleTextView.java
@@ -20,7 +20,6 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
-import android.graphics.Region;
import android.support.v4.graphics.ColorUtils;
import android.util.AttributeSet;
import android.widget.TextView;