Merge "Fixing issue where shortcut holographic outlines were different than widgets. (Bug 5659891)" into ics-mr1

This commit is contained in:
Winson Chung
2011-11-23 17:00:17 -08:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 15 deletions
@@ -560,7 +560,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
PendingAddItemInfo createItemInfo = (PendingAddItemInfo) v.getTag(); PendingAddItemInfo createItemInfo = (PendingAddItemInfo) v.getTag();
// Compose the drag image // Compose the drag image
Bitmap b; Bitmap preview;
Bitmap outline;
if (createItemInfo instanceof PendingAddWidgetInfo) { if (createItemInfo instanceof PendingAddWidgetInfo) {
PendingAddWidgetInfo createWidgetInfo = (PendingAddWidgetInfo) createItemInfo; PendingAddWidgetInfo createWidgetInfo = (PendingAddWidgetInfo) createItemInfo;
int[] spanXY = mLauncher.getSpanForWidget(createWidgetInfo, null); int[] spanXY = mLauncher.getSpanForWidget(createWidgetInfo, null);
@@ -569,20 +570,17 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int[] maxSize = mLauncher.getWorkspace().estimateItemSize(spanXY[0], spanXY[1], int[] maxSize = mLauncher.getWorkspace().estimateItemSize(spanXY[0], spanXY[1],
createWidgetInfo, true); createWidgetInfo, true);
b = getWidgetPreview(createWidgetInfo.componentName, createWidgetInfo.previewImage, preview = getWidgetPreview(createWidgetInfo.componentName, createWidgetInfo.previewImage,
createWidgetInfo.icon, spanXY[0], spanXY[1], maxSize[0], maxSize[1]); createWidgetInfo.icon, spanXY[0], spanXY[1], maxSize[0], maxSize[1]);
} else { } else {
// Workaround for the fact that we don't keep the original ResolveInfo associated with // Workaround for the fact that we don't keep the original ResolveInfo associated with
// the shortcut around. To get the icon, we just render the preview image (which has // the shortcut around. To get the icon, we just render the preview image (which has
// the shortcut icon) to a new drag bitmap that clips the non-icon space. // the shortcut icon) to a new drag bitmap that clips the non-icon space.
b = Bitmap.createBitmap(mWidgetPreviewIconPaddedDimension, preview = Bitmap.createBitmap(mWidgetPreviewIconPaddedDimension,
mWidgetPreviewIconPaddedDimension, Bitmap.Config.ARGB_8888); mWidgetPreviewIconPaddedDimension, Bitmap.Config.ARGB_8888);
Drawable preview = image.getDrawable(); Drawable d = image.getDrawable();
mCanvas.setBitmap(b); mCanvas.setBitmap(preview);
mCanvas.save(); d.draw(mCanvas);
preview.draw(mCanvas);
mCanvas.restore();
mCanvas.drawColor(mDragViewMultiplyColor, PorterDuff.Mode.MULTIPLY);
mCanvas.setBitmap(null); mCanvas.setBitmap(null);
createItemInfo.spanX = createItemInfo.spanY = 1; createItemInfo.spanX = createItemInfo.spanY = 1;
} }
@@ -597,12 +595,21 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
} }
} }
// Save the preview for the outline generation, then dim the preview
outline = Bitmap.createScaledBitmap(preview, preview.getWidth(), preview.getHeight(),
false);
mCanvas.setBitmap(preview);
mCanvas.drawColor(mDragViewMultiplyColor, PorterDuff.Mode.MULTIPLY);
mCanvas.setBitmap(null);
// Start the drag // Start the drag
alphaClipPaint = null;
mLauncher.lockScreenOrientationOnLargeUI(); mLauncher.lockScreenOrientationOnLargeUI();
mLauncher.getWorkspace().onDragStartedWithItem(createItemInfo, b, alphaClipPaint); mLauncher.getWorkspace().onDragStartedWithItem(createItemInfo, outline, alphaClipPaint);
mDragController.startDrag(image, b, this, createItemInfo, mDragController.startDrag(image, preview, this, createItemInfo,
DragController.DRAG_ACTION_COPY, null); DragController.DRAG_ACTION_COPY, null);
b.recycle(); outline.recycle();
preview.recycle();
} }
@Override @Override
protected boolean beginDragging(View v) { protected boolean beginDragging(View v) {
+1 -3
View File
@@ -1891,9 +1891,7 @@ public class Workspace extends SmoothPagedView
// center the image // center the image
dst.offset((w - scaledWidth) / 2, (h - scaledHeight) / 2); dst.offset((w - scaledWidth) / 2, (h - scaledHeight) / 2);
Paint p = new Paint(); canvas.drawBitmap(orig, src, dst, null);
p.setFilterBitmap(true);
canvas.drawBitmap(orig, src, dst, p);
mOutlineHelper.applyMediumExpensiveOutlineWithBlur(b, canvas, outlineColor, outlineColor, mOutlineHelper.applyMediumExpensiveOutlineWithBlur(b, canvas, outlineColor, outlineColor,
alphaClipPaint); alphaClipPaint);
canvas.setBitmap(null); canvas.setBitmap(null);