summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/dragndrop
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2018-10-18 15:05:45 -0700
committerHyunyoung Song <hyunyoungs@google.com>2018-10-19 14:33:46 -0700
commitcda96a5b43b7facfd64ef58f54763862731c9bc4 (patch)
tree76d0d64e7eac0202689feec3c4985b0722d6f044 /src/com/android/launcher3/dragndrop
parent6083c63e81e2ea5e55feb9e46c887d886dbc183f (diff)
downloadandroid_packages_apps_Trebuchet-cda96a5b43b7facfd64ef58f54763862731c9bc4.tar.gz
android_packages_apps_Trebuchet-cda96a5b43b7facfd64ef58f54763862731c9bc4.tar.bz2
android_packages_apps_Trebuchet-cda96a5b43b7facfd64ef58f54763862731c9bc4.zip
Setup make icon-loader library
Bug: 115891474 Test: make -j10 icon-loader Next step: Launcher will depend on icon-loader in next CL Change-Id: I797ddb857cf8be79f3be6ca2f174c593ca3713a5
Diffstat (limited to 'src/com/android/launcher3/dragndrop')
-rw-r--r--src/com/android/launcher3/dragndrop/DragView.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java
index 6d1efd587..b6a8b50a9 100644
--- a/src/com/android/launcher3/dragndrop/DragView.java
+++ b/src/com/android/launcher3/dragndrop/DragView.java
@@ -204,7 +204,7 @@ public class DragView extends View {
public void run() {
LauncherAppState appState = LauncherAppState.getInstance(mLauncher);
Object[] outObj = new Object[1];
- final Drawable dr = getFullDrawable(info, appState, outObj);
+ Drawable dr = getFullDrawable(info, appState, outObj);
if (dr instanceof AdaptiveIconDrawable) {
int w = mBitmap.getWidth();
@@ -220,10 +220,20 @@ public class DragView extends View {
mBadge = getBadge(info, appState, outObj[0]);
mBadge.setBounds(badgeBounds);
- LauncherIcons li = LauncherIcons.obtain(mLauncher);
- Utilities.scaleRectAboutCenter(bounds,
- li.getNormalizer().getScale(dr, null, null, null));
- li.recycle();
+ // Do not draw the background in case of folder as its translucent
+ mDrawBitmap = !(dr instanceof FolderAdaptiveIcon);
+
+ try (LauncherIcons li = LauncherIcons.obtain(mLauncher)) {
+ Drawable nDr; // drawable to be normalized
+ if (mDrawBitmap) {
+ nDr = dr;
+ } else {
+ // Since we just want the scale, avoid heavy drawing operations
+ nDr = new AdaptiveIconDrawable(new ColorDrawable(Color.BLACK), null);
+ }
+ Utilities.scaleRectAboutCenter(bounds,
+ li.getNormalizer().getScale(nDr, null, null, null));
+ }
AdaptiveIconDrawable adaptiveIcon = (AdaptiveIconDrawable) dr;
// Shrink very tiny bit so that the clip path is smaller than the original bitmap
@@ -259,9 +269,6 @@ public class DragView extends View {
// Assign the variable on the UI thread to avoid race conditions.
mScaledMaskPath = mask;
- // Do not draw the background in case of folder as its translucent
- mDrawBitmap = !(dr instanceof FolderAdaptiveIcon);
-
if (info.isDisabled()) {
FastBitmapDrawable d = new FastBitmapDrawable((Bitmap) null);
d.setIsDisabled(true);