diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-11-12 09:58:29 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2016-12-07 15:55:47 -0800 |
commit | 55cb70bf70d6defe84fe44e0d942998adefbb71c (patch) | |
tree | 2b2c1d472153110c3920f99f9493d6deeb19b2d1 /src/com/android/launcher3/BubbleTextView.java | |
parent | 4633be64e863a96c63f814a2386b23b02d43910b (diff) | |
download | android_packages_apps_Trebuchet-55cb70bf70d6defe84fe44e0d942998adefbb71c.tar.gz android_packages_apps_Trebuchet-55cb70bf70d6defe84fe44e0d942998adefbb71c.tar.bz2 android_packages_apps_Trebuchet-55cb70bf70d6defe84fe44e0d942998adefbb71c.zip |
Adding an overridable DrawableFactory to allow creating custom icon drawables
> Adding ItemInfo as a parameter for creating drawable
Change-Id: I793acb0381d2b8df4db0a08317dddf1464788ebc
Diffstat (limited to 'src/com/android/launcher3/BubbleTextView.java')
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index dbb797dc5..51cd0527f 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -16,7 +16,6 @@ package com.android.launcher3; -import android.annotation.TargetApi; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; @@ -26,9 +25,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Region; -import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; -import android.os.Build; import android.util.AttributeSet; import android.util.SparseArray; import android.util.TypedValue; @@ -42,6 +39,7 @@ import android.widget.TextView; import com.android.launcher3.IconCache.IconLoadRequest; import com.android.launcher3.folder.FolderIcon; +import com.android.launcher3.graphics.DrawableFactory; import com.android.launcher3.graphics.HolographicOutlineHelper; import com.android.launcher3.model.PackageItemInfo; @@ -190,7 +188,7 @@ public class BubbleTextView extends TextView } private void applyIconAndLabel(Bitmap icon, ItemInfo info) { - FastBitmapDrawable iconDrawable = mLauncher.createIconDrawable(icon); + FastBitmapDrawable iconDrawable = DrawableFactory.get(getContext()).newIcon(icon, info); iconDrawable.setIsDisabled(info.isDisabled()); setIcon(iconDrawable); setText(info.title); @@ -202,15 +200,6 @@ public class BubbleTextView extends TextView } /** - * Used for measurement only, sets some dummy values on this view. - */ - public void applyDummyInfo() { - ColorDrawable d = new ColorDrawable(); - setIcon(mLauncher.resizeIconDrawable(d)); - setText(""); - } - - /** * Overrides the default long press timeout. */ public void setLongPressTimeout(int longPressTimeout) { @@ -528,12 +517,9 @@ public class BubbleTextView extends TextView /** * Sets the icon for this view based on the layout direction. */ - @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private void setIcon(Drawable icon) { mIcon = icon; - if (mIconSize != -1) { - mIcon.setBounds(0, 0, mIconSize, mIconSize); - } + mIcon.setBounds(0, 0, mIconSize, mIconSize); applyCompoundDrawables(mIcon); } |