diff --git a/res/drawable-hdpi/default_widget_preview_holo.9.png b/res/drawable-hdpi/default_widget_preview_holo.9.png index 6745e49455..0b4a6343fc 100644 Binary files a/res/drawable-hdpi/default_widget_preview_holo.9.png and b/res/drawable-hdpi/default_widget_preview_holo.9.png differ diff --git a/res/drawable-hdpi/portal_container_holo.9.png b/res/drawable-hdpi/portal_container_holo.9.png index c4976124cb..557ee5a986 100644 Binary files a/res/drawable-hdpi/portal_container_holo.9.png and b/res/drawable-hdpi/portal_container_holo.9.png differ diff --git a/res/drawable-hdpi/portal_ring_inner_holo.png b/res/drawable-hdpi/portal_ring_inner_holo.png index 477e56977b..e953221565 100644 Binary files a/res/drawable-hdpi/portal_ring_inner_holo.png and b/res/drawable-hdpi/portal_ring_inner_holo.png differ diff --git a/res/drawable-hdpi/portal_ring_inner_nolip_holo.png b/res/drawable-hdpi/portal_ring_inner_nolip_holo.png new file mode 100644 index 0000000000..257fc691b2 Binary files /dev/null and b/res/drawable-hdpi/portal_ring_inner_nolip_holo.png differ diff --git a/res/drawable-hdpi/portal_ring_outer_holo.png b/res/drawable-hdpi/portal_ring_outer_holo.png index 2b635cb1bb..2bf0c0d183 100644 Binary files a/res/drawable-hdpi/portal_ring_outer_holo.png and b/res/drawable-hdpi/portal_ring_outer_holo.png differ diff --git a/res/drawable-hdpi/portal_ring_rest.png b/res/drawable-hdpi/portal_ring_rest.png index b9ef778294..93e3f6be36 100644 Binary files a/res/drawable-hdpi/portal_ring_rest.png and b/res/drawable-hdpi/portal_ring_rest.png differ diff --git a/res/drawable-hdpi/widget_info_bg.9.png b/res/drawable-hdpi/widget_info_bg.9.png deleted file mode 100644 index df4cea9dc1..0000000000 Binary files a/res/drawable-hdpi/widget_info_bg.9.png and /dev/null differ diff --git a/res/drawable-mdpi/default_widget_preview_holo.9.png b/res/drawable-mdpi/default_widget_preview_holo.9.png index f9a97263a9..0bfdaef58d 100644 Binary files a/res/drawable-mdpi/default_widget_preview_holo.9.png and b/res/drawable-mdpi/default_widget_preview_holo.9.png differ diff --git a/res/drawable-mdpi/portal_container_holo.9.png b/res/drawable-mdpi/portal_container_holo.9.png index 30b0fa0faf..9a47517301 100644 Binary files a/res/drawable-mdpi/portal_container_holo.9.png and b/res/drawable-mdpi/portal_container_holo.9.png differ diff --git a/res/drawable-mdpi/portal_ring_inner_holo.png b/res/drawable-mdpi/portal_ring_inner_holo.png index eccea20c45..3d704af652 100644 Binary files a/res/drawable-mdpi/portal_ring_inner_holo.png and b/res/drawable-mdpi/portal_ring_inner_holo.png differ diff --git a/res/drawable-mdpi/portal_ring_inner_nolip_holo.png b/res/drawable-mdpi/portal_ring_inner_nolip_holo.png new file mode 100644 index 0000000000..1dbdbe8410 Binary files /dev/null and b/res/drawable-mdpi/portal_ring_inner_nolip_holo.png differ diff --git a/res/drawable-mdpi/portal_ring_outer_holo.png b/res/drawable-mdpi/portal_ring_outer_holo.png index c5142171d0..3a7303ec5e 100644 Binary files a/res/drawable-mdpi/portal_ring_outer_holo.png and b/res/drawable-mdpi/portal_ring_outer_holo.png differ diff --git a/res/drawable-mdpi/portal_ring_rest.png b/res/drawable-mdpi/portal_ring_rest.png index 3ab8b368fa..259e48c0c7 100644 Binary files a/res/drawable-mdpi/portal_ring_rest.png and b/res/drawable-mdpi/portal_ring_rest.png differ diff --git a/res/drawable-mdpi/widget_info_bg.9.png b/res/drawable-mdpi/widget_info_bg.9.png deleted file mode 100644 index c8c62b58fd..0000000000 Binary files a/res/drawable-mdpi/widget_info_bg.9.png and /dev/null differ diff --git a/res/drawable-xhdpi/default_widget_preview_holo.9.png b/res/drawable-xhdpi/default_widget_preview_holo.9.png index 87cc9753b2..42d57d8437 100644 Binary files a/res/drawable-xhdpi/default_widget_preview_holo.9.png and b/res/drawable-xhdpi/default_widget_preview_holo.9.png differ diff --git a/res/drawable-xhdpi/portal_container_holo.9.png b/res/drawable-xhdpi/portal_container_holo.9.png index 0935a4b758..4ae8d223b7 100644 Binary files a/res/drawable-xhdpi/portal_container_holo.9.png and b/res/drawable-xhdpi/portal_container_holo.9.png differ diff --git a/res/drawable-xhdpi/portal_ring_inner_holo.png b/res/drawable-xhdpi/portal_ring_inner_holo.png index bc34314edf..b9867c0d9c 100644 Binary files a/res/drawable-xhdpi/portal_ring_inner_holo.png and b/res/drawable-xhdpi/portal_ring_inner_holo.png differ diff --git a/res/drawable-xhdpi/portal_ring_inner_nolip_holo.png b/res/drawable-xhdpi/portal_ring_inner_nolip_holo.png new file mode 100644 index 0000000000..e218713e42 Binary files /dev/null and b/res/drawable-xhdpi/portal_ring_inner_nolip_holo.png differ diff --git a/res/drawable-xhdpi/portal_ring_outer_holo.png b/res/drawable-xhdpi/portal_ring_outer_holo.png index a7b5b60133..286bee0391 100644 Binary files a/res/drawable-xhdpi/portal_ring_outer_holo.png and b/res/drawable-xhdpi/portal_ring_outer_holo.png differ diff --git a/res/drawable-xhdpi/portal_ring_rest.png b/res/drawable-xhdpi/portal_ring_rest.png index ba0a652e7c..ab5c2c479b 100644 Binary files a/res/drawable-xhdpi/portal_ring_rest.png and b/res/drawable-xhdpi/portal_ring_rest.png differ diff --git a/res/drawable-xhdpi/widget_info_bg.9.png b/res/drawable-xhdpi/widget_info_bg.9.png deleted file mode 100644 index 19eff05895..0000000000 Binary files a/res/drawable-xhdpi/widget_info_bg.9.png and /dev/null differ diff --git a/res/drawable-xlarge-hdpi/portal_ring_inner_holo.png b/res/drawable-xlarge-hdpi/portal_ring_inner_holo.png index 659c23ba9a..b3be4720a6 100644 Binary files a/res/drawable-xlarge-hdpi/portal_ring_inner_holo.png and b/res/drawable-xlarge-hdpi/portal_ring_inner_holo.png differ diff --git a/res/drawable-xlarge-hdpi/portal_ring_inner_nolip_holo.png b/res/drawable-xlarge-hdpi/portal_ring_inner_nolip_holo.png new file mode 100644 index 0000000000..96b981c50f Binary files /dev/null and b/res/drawable-xlarge-hdpi/portal_ring_inner_nolip_holo.png differ diff --git a/res/drawable-xlarge-hdpi/portal_ring_outer_holo.png b/res/drawable-xlarge-hdpi/portal_ring_outer_holo.png index 8ec67df5a8..bc13a26cde 100644 Binary files a/res/drawable-xlarge-hdpi/portal_ring_outer_holo.png and b/res/drawable-xlarge-hdpi/portal_ring_outer_holo.png differ diff --git a/res/drawable-xlarge-mdpi/portal_ring_inner_holo.png b/res/drawable-xlarge-mdpi/portal_ring_inner_holo.png index 8e3dd576a3..319c074273 100644 Binary files a/res/drawable-xlarge-mdpi/portal_ring_inner_holo.png and b/res/drawable-xlarge-mdpi/portal_ring_inner_holo.png differ diff --git a/res/drawable-xlarge-mdpi/portal_ring_inner_nolip_holo.png b/res/drawable-xlarge-mdpi/portal_ring_inner_nolip_holo.png new file mode 100644 index 0000000000..8537714aa5 Binary files /dev/null and b/res/drawable-xlarge-mdpi/portal_ring_inner_nolip_holo.png differ diff --git a/res/drawable-xlarge-mdpi/portal_ring_outer_holo.png b/res/drawable-xlarge-mdpi/portal_ring_outer_holo.png index 94e0677752..365dcfce98 100644 Binary files a/res/drawable-xlarge-mdpi/portal_ring_outer_holo.png and b/res/drawable-xlarge-mdpi/portal_ring_outer_holo.png differ diff --git a/res/drawable-xlarge-xhdpi/portal_ring_inner_holo.png b/res/drawable-xlarge-xhdpi/portal_ring_inner_holo.png index a013e5a60e..d4ce45f128 100644 Binary files a/res/drawable-xlarge-xhdpi/portal_ring_inner_holo.png and b/res/drawable-xlarge-xhdpi/portal_ring_inner_holo.png differ diff --git a/res/drawable-xlarge-xhdpi/portal_ring_inner_nolip_holo.png b/res/drawable-xlarge-xhdpi/portal_ring_inner_nolip_holo.png new file mode 100644 index 0000000000..9aa13c9878 Binary files /dev/null and b/res/drawable-xlarge-xhdpi/portal_ring_inner_nolip_holo.png differ diff --git a/res/drawable-xlarge-xhdpi/portal_ring_outer_holo.png b/res/drawable-xlarge-xhdpi/portal_ring_outer_holo.png index 7bdaaf39b0..0106cd6e09 100644 Binary files a/res/drawable-xlarge-xhdpi/portal_ring_outer_holo.png and b/res/drawable-xlarge-xhdpi/portal_ring_outer_holo.png differ diff --git a/res/layout-sw720dp/apps_customize_widget.xml b/res/layout-sw720dp/apps_customize_widget.xml index 31c3fbe58f..e707ef7745 100644 --- a/res/layout-sw720dp/apps_customize_widget.xml +++ b/res/layout-sw720dp/apps_customize_widget.xml @@ -32,8 +32,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="4dp" - android:orientation="vertical" - android:background="@drawable/widget_info_bg"> + android:orientation="vertical"> - + android:orientation="horizontal"> targetHeight) { bitmapWidth = Math.min(targetWidth, cellWidth); bitmapHeight = (int) (targetHeight * ((float) bitmapWidth / targetWidth)); - iconScale = Math.min((float) bitmapHeight / (mAppIconSize + 2 * offset), 1f); + iconScale = Math.min((float) bitmapHeight / (mAppIconSize + 2 * minOffset), 1f); } else { bitmapHeight = Math.min(targetHeight, cellHeight); bitmapWidth = (int) (targetWidth * ((float) bitmapHeight / targetHeight)); - iconScale = Math.min((float) bitmapWidth / (mAppIconSize + 2 * offset), 1f); + iconScale = Math.min((float) bitmapWidth / (mAppIconSize + 2 * minOffset), 1f); } } preview = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Config.ARGB_8888); - renderDrawableToBitmap(mDefaultWidgetBackground, preview, 0, 0, bitmapWidth, - bitmapWidth); + if (cellHSpan != 1 || cellVSpan != 1) { + renderDrawableToBitmap(mDefaultWidgetBackground, preview, 0, 0, bitmapWidth, + bitmapHeight); + } // Draw the icon in the top left corner try { Drawable icon = null; + int hoffset = (int) (bitmapWidth / 2 - mAppIconSize * iconScale / 2); + int yoffset = (int) (bitmapHeight / 2 - mAppIconSize * iconScale / 2); if (info.icon > 0) icon = mPackageManager.getDrawable(packageName, info.icon, null); if (icon == null) icon = resources.getDrawable(R.drawable.ic_launcher_application); - renderDrawableToBitmap(icon, preview, (int) (offset * iconScale), - (int) (offset * iconScale), (int) (mAppIconSize * iconScale), + renderDrawableToBitmap(icon, preview, hoffset, yoffset, + (int) (mAppIconSize * iconScale), (int) (mAppIconSize * iconScale)); } catch (Resources.NotFoundException e) {} } diff --git a/src/com/android/launcher2/HolographicOutlineHelper.java b/src/com/android/launcher2/HolographicOutlineHelper.java index 748d89e093..1faaeefdac 100644 --- a/src/com/android/launcher2/HolographicOutlineHelper.java +++ b/src/com/android/launcher2/HolographicOutlineHelper.java @@ -122,10 +122,18 @@ public class HolographicOutlineHelper { */ void applyExpensiveOutlineWithBlur(Bitmap srcDst, Canvas srcDstCanvas, int color, int outlineColor, int thickness) { + applyExpensiveOutlineWithBlur(srcDst, srcDstCanvas, color, outlineColor, mAlphaClipPaint, + thickness); + } + void applyExpensiveOutlineWithBlur(Bitmap srcDst, Canvas srcDstCanvas, int color, + int outlineColor, Paint alphaClipPaint, int thickness) { // We start by removing most of the alpha channel so as to ignore shadows, and // other types of partial transparency when defining the shape of the object - Bitmap glowShape = srcDst.extractAlpha(mAlphaClipPaint, mTempOffset); + if (alphaClipPaint == null) { + alphaClipPaint = mAlphaClipPaint; + } + Bitmap glowShape = srcDst.extractAlpha(alphaClipPaint, mTempOffset); // calculate the outer blur first BlurMaskFilter outerBlurMaskFilter; @@ -216,6 +224,12 @@ public class HolographicOutlineHelper { applyExpensiveOutlineWithBlur(srcDst, srcDstCanvas, color, outlineColor, THICK); } + void applyMediumExpensiveOutlineWithBlur(Bitmap srcDst, Canvas srcDstCanvas, int color, + int outlineColor, Paint alphaClipPaint) { + applyExpensiveOutlineWithBlur(srcDst, srcDstCanvas, color, outlineColor, alphaClipPaint, + MEDIUM); + } + void applyMediumExpensiveOutlineWithBlur(Bitmap srcDst, Canvas srcDstCanvas, int color, int outlineColor) { applyExpensiveOutlineWithBlur(srcDst, srcDstCanvas, color, outlineColor, MEDIUM); diff --git a/src/com/android/launcher2/PendingAddItemInfo.java b/src/com/android/launcher2/PendingAddItemInfo.java index 7b564e0518..e243cc0cd5 100644 --- a/src/com/android/launcher2/PendingAddItemInfo.java +++ b/src/com/android/launcher2/PendingAddItemInfo.java @@ -33,6 +33,7 @@ class PendingAddItemInfo extends ItemInfo { class PendingAddWidgetInfo extends PendingAddItemInfo { int minWidth; int minHeight; + boolean hasDefaultPreview; // Any configuration data that we want to pass to a configuration activity when // starting up a widget @@ -44,6 +45,7 @@ class PendingAddWidgetInfo extends PendingAddItemInfo { componentName = i.provider; minWidth = i.minWidth; minHeight = i.minHeight; + hasDefaultPreview = i.previewImage <= 0; if (dataMimeType != null && data != null) { mimeType = dataMimeType; configurationData = data; diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index bf8907865f..0c297dd824 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -1464,6 +1464,10 @@ public class Workspace extends SmoothPagedView } public void onDragStartedWithItemSpans(int spanX, int spanY, Bitmap b) { + onDragStartedWithItemSpans(spanX, spanY, b, null); + } + + public void onDragStartedWithItemSpans(int spanX, int spanY, Bitmap b, Paint alphaClipPaint) { final Canvas canvas = new Canvas(); // We need to add extra padding to the bitmap to make room for the glow effect @@ -1474,7 +1478,7 @@ public class Workspace extends SmoothPagedView int[] size = cl.cellSpansToSize(spanX, spanY); // The outline is used to visualize where the item will land if dropped - mDragOutline = createDragOutline(b, canvas, bitmapPadding, size[0], size[1]); + mDragOutline = createDragOutline(b, canvas, bitmapPadding, size[0], size[1], alphaClipPaint); } // we call this method whenever a drag and drop in Launcher finishes, even if Workspace was @@ -1817,6 +1821,10 @@ public class Workspace extends SmoothPagedView * Responsibility for the bitmap is transferred to the caller. */ private Bitmap createDragOutline(Bitmap orig, Canvas canvas, int padding, int w, int h) { + return createDragOutline(orig, canvas, padding, w, h, null); + } + private Bitmap createDragOutline(Bitmap orig, Canvas canvas, int padding, int w, int h, + Paint alphaClipPaint) { final int outlineColor = getResources().getColor(android.R.color.holo_blue_light); final Bitmap b = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); canvas.setBitmap(b); @@ -1834,7 +1842,8 @@ public class Workspace extends SmoothPagedView Paint p = new Paint(); p.setFilterBitmap(true); canvas.drawBitmap(orig, src, dst, p); - mOutlineHelper.applyMediumExpensiveOutlineWithBlur(b, canvas, outlineColor, outlineColor); + mOutlineHelper.applyMediumExpensiveOutlineWithBlur(b, canvas, outlineColor, outlineColor, + alphaClipPaint); canvas.setBitmap(null); return b;