Updating the PreloadIconDrawable

> The drawable gets the path from MaskIconDrawable path, instead of
  using a circle
> The progress changes are animated as well

Bug: 34831873
Change-Id: I4e7f0b610f4fd94de8e0cfcf8b179b775cf0b4d8
This commit is contained in:
Sunny Goyal
2017-02-06 10:43:27 -08:00
parent e1fa0145d3
commit 96ac68a481
24 changed files with 443 additions and 350 deletions
+3 -23
View File
@@ -19,7 +19,6 @@ package com.android.launcher3;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -27,7 +26,6 @@ import android.graphics.Paint;
import android.graphics.Region;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -45,6 +43,7 @@ import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.graphics.DrawableFactory;
import com.android.launcher3.graphics.HolographicOutlineHelper;
import com.android.launcher3.graphics.IconPalette;
import com.android.launcher3.graphics.PreloadIconDrawable;
import com.android.launcher3.model.PackageItemInfo;
import java.text.NumberFormat;
@@ -57,8 +56,6 @@ import java.text.NumberFormat;
public class BubbleTextView extends TextView
implements BaseRecyclerViewFastScrollBar.FastScrollFocusableView, ItemInfoUpdateReceiver {
private static SparseArray<Theme> sPreloaderThemes = new SparseArray<Theme>(2);
// Dimensions in DP
private static final float AMBIENT_SHADOW_RADIUS = 2.5f;
private static final float KEY_SHADOW_RADIUS = 1f;
@@ -423,10 +420,6 @@ public class BubbleTextView extends TextView
super.onAttachedToWindow();
if (mBackground != null) mBackground.setCallback(this);
if (mIcon instanceof PreloadIconDrawable) {
((PreloadIconDrawable) mIcon).applyPreloaderTheme(getPreloaderTheme());
}
mSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
@@ -495,7 +488,8 @@ public class BubbleTextView extends TextView
if (mIcon instanceof PreloadIconDrawable) {
preloadDrawable = (PreloadIconDrawable) mIcon;
} else {
preloadDrawable = new PreloadIconDrawable(mIcon, getPreloaderTheme());
preloadDrawable = DrawableFactory.get(getContext())
.newPendingIcon(info.iconBitmap, getContext());
setIcon(preloadDrawable);
}
@@ -520,20 +514,6 @@ public class BubbleTextView extends TextView
: null;
}
private Theme getPreloaderTheme() {
Object tag = getTag();
int style = ((tag != null) && (tag instanceof ShortcutInfo) &&
(((ShortcutInfo) tag).container >= 0)) ? R.style.PreloadIcon_Folder
: R.style.PreloadIcon;
Theme theme = sPreloaderThemes.get(style);
if (theme == null) {
theme = getResources().newTheme();
theme.applyStyle(style, true);
sPreloaderThemes.put(style, theme);
}
return theme;
}
/**
* Sets the icon for this view based on the layout direction.
*/