summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-02-24 18:09:44 -0800
committerWinson Chung <winsonc@google.com>2011-02-25 13:48:14 -0800
commit1908d07151e0d3f82899f368874e41ed1e49ba16 (patch)
tree3fb2446187a953e3204d66948640ea4762490fce
parentf4204b8c1ab1ccfc99ed3bc9a0e113f6722769cc (diff)
downloadandroid_packages_apps_Trebuchet-1908d07151e0d3f82899f368874e41ed1e49ba16.tar.gz
android_packages_apps_Trebuchet-1908d07151e0d3f82899f368874e41ed1e49ba16.tar.bz2
android_packages_apps_Trebuchet-1908d07151e0d3f82899f368874e41ed1e49ba16.zip
Refactoring and fixing bugs in Customize tray.
Change-Id: Ia37d3033d64036fd09f5f33443eb9f575e311c7c
-rw-r--r--res/layout-xlarge-port/customization_drawer.xml2
-rw-r--r--res/layout-xlarge/customize_paged_view_wallpaper.xml14
-rw-r--r--res/layout-xlarge/customize_paged_view_widget.xml16
-rw-r--r--res/layout-xlarge/launcher.xml2
-rw-r--r--res/values-xlarge-land/dimens.xml2
-rw-r--r--res/values-xlarge-port/dimens.xml2
-rw-r--r--src/com/android/launcher2/CustomizePagedView.java45
-rw-r--r--src/com/android/launcher2/HolographicOutlineHelper.java2
-rw-r--r--src/com/android/launcher2/PagedView.java21
-rw-r--r--src/com/android/launcher2/PagedViewWidget.java35
10 files changed, 107 insertions, 34 deletions
diff --git a/res/layout-xlarge-port/customization_drawer.xml b/res/layout-xlarge-port/customization_drawer.xml
index a1bc7cc8a..0381be0aa 100644
--- a/res/layout-xlarge-port/customization_drawer.xml
+++ b/res/layout-xlarge-port/customization_drawer.xml
@@ -21,7 +21,7 @@
android:layout_height="match_parent"
launcher:wallpaperCellSpanX="3"
launcher:wallpaperCellCountX="9"
- launcher:widgetCellCountX="10"
+ launcher:widgetCellCountX="9"
launcher:cellCountX="5"
launcher:cellCountY="3"
launcher:pageLayoutWidthGap="36dp"
diff --git a/res/layout-xlarge/customize_paged_view_wallpaper.xml b/res/layout-xlarge/customize_paged_view_wallpaper.xml
index e3be86d87..8c5abc8d9 100644
--- a/res/layout-xlarge/customize_paged_view_wallpaper.xml
+++ b/res/layout-xlarge/customize_paged_view_wallpaper.xml
@@ -18,12 +18,11 @@
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
android:layout_width="wrap_content"
- android:layout_height="365dp"
- android:paddingLeft="12.5dp"
- android:paddingRight="12.5dp"
- android:paddingBottom="50dp"
- android:gravity="top"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
android:orientation="vertical"
+ android:paddingRight="25dp"
+ android:paddingBottom="50dp"
launcher:blurColor="#FF6B8CF0"
launcher:outlineColor="#FF8CD2FF">
@@ -33,7 +32,8 @@
android:id="@+id/wallpaper_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_weight="1.0"
+ android:layout_weight="1"
+ android:adjustViewBounds="true"
android:scaleType="fitStart" />
<!-- The divider image. -->
@@ -41,6 +41,7 @@
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_weight="0"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:src="@drawable/widget_divider" />
@@ -50,6 +51,7 @@
android:id="@+id/wallpaper_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_weight="0"
android:gravity="left"
android:textColor="#FFFFFFFF"
diff --git a/res/layout-xlarge/customize_paged_view_widget.xml b/res/layout-xlarge/customize_paged_view_widget.xml
index 3b95ebc66..c0b455251 100644
--- a/res/layout-xlarge/customize_paged_view_widget.xml
+++ b/res/layout-xlarge/customize_paged_view_widget.xml
@@ -18,13 +18,11 @@
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
android:layout_width="wrap_content"
- android:layout_height="365dp"
- android:paddingLeft="12.5dp"
- android:paddingTop="12.5dp"
- android:paddingRight="12.5dp"
- android:paddingBottom="50dp"
- android:gravity="top"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
android:orientation="vertical"
+ android:paddingRight="25dp"
+ android:paddingBottom="50dp"
launcher:blurColor="#FF6B8CF0"
launcher:outlineColor="#FF8CD2FF">
@@ -34,7 +32,8 @@
android:id="@+id/widget_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_weight="1.0"
+ android:layout_weight="1"
+ android:adjustViewBounds="true"
android:scaleType="fitStart" />
<!-- The divider image. -->
@@ -42,6 +41,7 @@
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_weight="0"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:src="@drawable/widget_divider" />
@@ -51,6 +51,7 @@
android:id="@+id/widget_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_weight="0"
android:gravity="left"
android:textColor="#FFFFFFFF"
@@ -69,6 +70,7 @@
android:id="@+id/widget_dims"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_weight="0"
android:gravity="left"
android:textColor="#FF999999"
diff --git a/res/layout-xlarge/launcher.xml b/res/layout-xlarge/launcher.xml
index 7f2b8e169..a7cf3214c 100644
--- a/res/layout-xlarge/launcher.xml
+++ b/res/layout-xlarge/launcher.xml
@@ -205,7 +205,7 @@
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="@dimen/customization_drawer_content_height">
</FrameLayout>
</LinearLayout>
</TabHost>
diff --git a/res/values-xlarge-land/dimens.xml b/res/values-xlarge-land/dimens.xml
index ccea6eb71..b3d40d584 100644
--- a/res/values-xlarge-land/dimens.xml
+++ b/res/values-xlarge-land/dimens.xml
@@ -26,5 +26,7 @@
<dimen name="workspace_page_spacing">50dp</dimen>
<dimen name="customization_drawer_height">480dp</dimen>
+ <dimen name="customization_drawer_content_height">420dp</dimen>
+ <dimen name="customization_drawer_content_min_width">952dp</dimen>
<dimen name="customization_drawer_tab_widget_width">952dp</dimen>
</resources> \ No newline at end of file
diff --git a/res/values-xlarge-port/dimens.xml b/res/values-xlarge-port/dimens.xml
index eca8f4472..8a4c78bc7 100644
--- a/res/values-xlarge-port/dimens.xml
+++ b/res/values-xlarge-port/dimens.xml
@@ -26,5 +26,7 @@
<dimen name="workspace_page_spacing">64dp</dimen>
<dimen name="customization_drawer_height">800dp</dimen>
+ <dimen name="customization_drawer_content_height">420dp</dimen>
+ <dimen name="customization_drawer_content_min_width">640dp</dimen>
<dimen name="customization_drawer_tab_widget_width">700dp</dimen>
</resources> \ No newline at end of file
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 2b54e3f3c..e80eda3a7 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -40,6 +40,7 @@ import android.content.res.XmlResourceParser;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.graphics.Bitmap.Config;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
@@ -90,6 +91,10 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
// The mapping between the pages and the widgets that will be laid out on them
private ArrayList<ArrayList<AppWidgetProviderInfo>> mWidgetPages;
+ // This is used if we want to set a min width on pages so that things inside them left align to
+ // a fixed size
+ private int mMinPageWidth;
+
// The max dimensions for the ImageView we use for displaying a widget
private int mMaxWidgetWidth;
@@ -165,6 +170,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
final Resources r = context.getResources();
setDragSlopeThreshold(
r.getInteger(R.integer.config_customizationDrawerDragSlopeThreshold) / 100.0f);
+ mMinPageWidth = r.getDimensionPixelSize(R.dimen.customization_drawer_content_min_width);
setVisibility(View.GONE);
setSoundEffectsEnabled(false);
@@ -544,12 +550,12 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
}
}
- private Bitmap drawableToBitmap(Drawable d) {
+ private Bitmap drawableToBitmap(Drawable d, float scaleX, float scaleY) {
final Rect bounds = d.getBounds();
final int w = bounds.width();
final int h = bounds.height();
Bitmap b = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
- renderDrawableToBitmap(d, b, 0, 0, w, h);
+ renderDrawableToBitmap(d, b, 0, 0, w, h, scaleX, scaleY);
return b;
}
@@ -575,7 +581,13 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
// Get the widget preview as the drag representation
final LinearLayout l = (LinearLayout) v;
final ImageView i = (ImageView) l.findViewById(R.id.widget_preview);
- mDragBitmap = drawableToBitmap(i.getDrawable());
+
+ // Calculate how much to scale the drag preview
+ RectF tmpScaleRect = new RectF(0,0,1,1);
+ i.getImageMatrix().mapRect(tmpScaleRect);
+
+ mDragBitmap = drawableToBitmap(i.getDrawable(), tmpScaleRect.right,
+ tmpScaleRect.bottom);
i.getLocationOnScreen(mDragViewOrigin);
PendingAddWidgetInfo createWidgetInfo = (PendingAddWidgetInfo) v.getTag();
@@ -596,7 +608,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
// get icon (top compound drawable, index is 1)
final TextView tv = (TextView) v;
final Drawable icon = tv.getCompoundDrawables()[1];
- mDragBitmap = drawableToBitmap(icon);
+ mDragBitmap = drawableToBitmap(icon, 1.0f, 1.0f);
Object dragInfo = v.getTag();
if (mCustomizationType == CustomizationType.ApplicationCustomization) {
@@ -679,9 +691,11 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
/**
* Helper function to draw a drawable to the specified canvas with the specified bounds.
*/
- private void renderDrawableToBitmap(Drawable d, Bitmap bitmap, int x, int y, int w, int h) {
+ private void renderDrawableToBitmap(Drawable d, Bitmap bitmap, int x, int y, int w, int h,
+ float scaleX, float scaleY) {
if (bitmap != null) mCanvas.setBitmap(bitmap);
mCanvas.save();
+ mCanvas.scale(scaleX, scaleY);
final Rect oldBounds = d.copyBounds();
d.setBounds(x, y, x + w, y + h);
d.draw(mCanvas);
@@ -768,7 +782,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
background = resources.getDrawable(R.drawable.default_widget_preview);
}
- renderDrawableToBitmap(background, bitmap, 0, 0, width, height);
+ renderDrawableToBitmap(background, bitmap, 0, 0, width, height, 1.0f, 1.0f);
// If we don't have a custom icon, we use the app icon on the default background
if (!foundCustomDrawable) {
@@ -780,7 +794,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
final int iconSize = minDim / 2;
final int offset = iconSize / 4;
- renderDrawableToBitmap(icon, null, offset, offset, iconSize, iconSize);
+ renderDrawableToBitmap(icon, null, offset, offset, iconSize, iconSize, 1.0f, 1.0f);
} catch (Resources.NotFoundException e) {
// if we can't find the icon, then just don't draw it
}
@@ -820,7 +834,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
int height = (int) (Math.max(minDim, Math.min(maxDim, info.minHeight)) * sScaleFactor);
final Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
final Drawable background = resources.getDrawable(R.drawable.default_widget_preview);
- renderDrawableToBitmap(background, bitmap, 0, 0, width, height);
+ renderDrawableToBitmap(background, bitmap, 0, 0, width, height, 1.0f, 1.0f);
// Draw the icon flush left
try {
@@ -834,7 +848,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
final int iconSize = minDim / 2;
final int offset = iconSize / 4;
- renderDrawableToBitmap(icon, null, offset, offset, iconSize, iconSize);
+ renderDrawableToBitmap(icon, null, offset, offset, iconSize, iconSize, 1.0f, 1.0f);
} catch (Resources.NotFoundException e) {
// if we can't find the icon, then just don't draw it
}
@@ -860,7 +874,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
}
final Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
- renderDrawableToBitmap(drawable, bitmap, 0, 0, width, height);
+ renderDrawableToBitmap(drawable, bitmap, 0, 0, width, height, 1.0f, 1.0f);
newDrawable = new FastBitmapDrawable(bitmap);
}
@@ -917,6 +931,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
PagedViewWidget l = (PagedViewWidget) mInflater.inflate(
R.layout.customize_paged_view_widget, layout, false);
+
l.applyFromAppWidgetProviderInfo(info, icon, mMaxWidgetWidth, cellSpans,
mPageViewIconCache, (numPages > 1));
l.setTag(createItemInfo);
@@ -1072,10 +1087,12 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
@Override
public void syncPages() {
+ boolean enforceMinimumPagedWidths = false;
boolean centerPagedViewCellLayouts = false;
switch (mCustomizationType) {
case WidgetCustomization:
syncWidgetPages();
+ enforceMinimumPagedWidths = true;
break;
case ShortcutCustomization:
syncListPages(mShortcutList);
@@ -1083,6 +1100,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
break;
case WallpaperCustomization:
syncWallpaperPages();
+ enforceMinimumPagedWidths = true;
break;
case ApplicationCustomization:
syncAppPages();
@@ -1108,7 +1126,12 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
}
}
- // bound the current page
+ // Set a min page width for PagedView layout if we have more than a single page
+ if (enforceMinimumPagedWidths) {
+ setMinimumWidthOverride((childCount > 1) ? mMinPageWidth : 0);
+ }
+
+ // Bound the current page index
requestLayout();
post(new Runnable() {
@Override
diff --git a/src/com/android/launcher2/HolographicOutlineHelper.java b/src/com/android/launcher2/HolographicOutlineHelper.java
index 1efc1231f..80548fb5c 100644
--- a/src/com/android/launcher2/HolographicOutlineHelper.java
+++ b/src/com/android/launcher2/HolographicOutlineHelper.java
@@ -32,6 +32,7 @@ public class HolographicOutlineHelper {
private final Paint mAlphaClipPaint = new Paint();
public static final int MAX_OUTER_BLUR_RADIUS;
+ public static final int MIN_OUTER_BLUR_RADIUS;
private static final BlurMaskFilter sExtraThickOuterBlurMaskFilter;
private static final BlurMaskFilter sThickOuterBlurMaskFilter;
@@ -48,6 +49,7 @@ public class HolographicOutlineHelper {
static {
final float scale = LauncherApplication.getScreenDensity();
+ MIN_OUTER_BLUR_RADIUS = (int) (scale * 1.0f);
MAX_OUTER_BLUR_RADIUS = (int) (scale * 12.0f);
sExtraThickOuterBlurMaskFilter = new BlurMaskFilter(scale * 12.0f, BlurMaskFilter.Blur.OUTER);
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 66383cb6b..c2fcd9f21 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -100,6 +100,7 @@ public abstract class PagedView extends ViewGroup {
protected int mTouchSlop;
private int mPagingTouchSlop;
private int mMaximumVelocity;
+ private int mMinimumWidth;
protected int mPageSpacing;
protected int mPageLayoutPaddingTop;
protected int mPageLayoutPaddingBottom;
@@ -175,13 +176,13 @@ public abstract class PagedView extends ViewGroup {
R.styleable.PagedView, defStyle, 0);
mPageSpacing = a.getDimensionPixelSize(R.styleable.PagedView_pageSpacing, 0);
mPageLayoutPaddingTop = a.getDimensionPixelSize(
- R.styleable.PagedView_pageLayoutPaddingTop, 10);
+ R.styleable.PagedView_pageLayoutPaddingTop, 0);
mPageLayoutPaddingBottom = a.getDimensionPixelSize(
- R.styleable.PagedView_pageLayoutPaddingBottom, 10);
+ R.styleable.PagedView_pageLayoutPaddingBottom, 0);
mPageLayoutPaddingLeft = a.getDimensionPixelSize(
- R.styleable.PagedView_pageLayoutPaddingLeft, 10);
+ R.styleable.PagedView_pageLayoutPaddingLeft, 0);
mPageLayoutPaddingRight = a.getDimensionPixelSize(
- R.styleable.PagedView_pageLayoutPaddingRight, 10);
+ R.styleable.PagedView_pageLayoutPaddingRight, 0);
mPageLayoutWidthGap = a.getDimensionPixelSize(
R.styleable.PagedView_pageLayoutWidthGap, -1);
mPageLayoutHeightGap = a.getDimensionPixelSize(
@@ -1138,8 +1139,16 @@ public abstract class PagedView extends ViewGroup {
return -1;
}
+ protected void setMinimumWidthOverride(int minimumWidth) {
+ mMinimumWidth = minimumWidth;
+ }
+
+ protected int getChildWidth(int index) {
+ return Math.max(mMinimumWidth, getChildAt(index).getMeasuredWidth());
+ }
+
protected int getRelativeChildOffset(int index) {
- return (getMeasuredWidth() - getChildAt(index).getMeasuredWidth()) / 2;
+ return (getMeasuredWidth() - getChildWidth(index)) / 2;
}
protected int getChildOffset(int index) {
@@ -1154,7 +1163,7 @@ public abstract class PagedView extends ViewGroup {
}
protected int getScaledMeasuredWidth(View child) {
- return (int) (child.getMeasuredWidth() * mLayoutScale + 0.5f);
+ return (int) (Math.max(mMinimumWidth, child.getMeasuredWidth()) * mLayoutScale + 0.5f);
}
int getPageNearestToCenterOfScreen() {
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index 07b215d44..72f928b54 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -27,7 +27,11 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
+import android.graphics.PorterDuff;
import android.graphics.PorterDuff.Mode;
+import android.graphics.PorterDuffXfermode;
+import android.graphics.Rect;
+import android.graphics.RectF;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
@@ -52,6 +56,10 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
private Bitmap mHolographicOutline;
private final Canvas mHolographicOutlineCanvas = new Canvas();
private FastBitmapDrawable mPreview;
+ private ImageView mPreviewImageView;
+ private final RectF mTmpScaleRect = new RectF();
+ private final Rect mEraseStrokeRect = new Rect();
+ private final Paint mEraseStrokeRectPaint = new Paint();
private PagedViewIconCache.Key mIconCacheKey;
private PagedViewIconCache mIconCache;
@@ -81,8 +89,11 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
public void handleMessage(Message msg) {
final PagedViewWidget widget = (PagedViewWidget) msg.obj;
final int prevAlpha = widget.mPreview.getAlpha();
- final Bitmap outline = Bitmap.createBitmap(widget.getWidth(), widget.getHeight(),
- Bitmap.Config.ARGB_8888);
+ final int width = Math.max(widget.mPreview.getIntrinsicWidth(),
+ widget.getMeasuredWidth());
+ final int height = Math.max(widget.mPreview.getIntrinsicHeight(),
+ widget.getMeasuredHeight());
+ final Bitmap outline = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
widget.mHolographicOutlineCanvas.setBitmap(outline);
widget.mHolographicOutlineCanvas.save();
@@ -94,6 +105,12 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
widget.mHolographicOutlineCanvas.drawColor(Color.argb(156, 0, 0, 0), Mode.SRC_OVER);
widget.mHolographicOutlineCanvas.restore();
+ // To account for the fact that some previews run up straight to the edge (we subtract
+ // the edge from the holographic preview (before we apply the holograph)
+ widget.mEraseStrokeRect.set(0, 0, width, height);
+ widget.mHolographicOutlineCanvas.drawRect(widget.mEraseStrokeRect,
+ widget.mEraseStrokeRectPaint);
+
sHolographicOutlineHelper.applyThickExpensiveOutlineWithBlur(outline,
widget.mHolographicOutlineCanvas, widget.mHoloBlurColor,
widget.mHoloOutlineColor);
@@ -123,6 +140,11 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
defStyle, 0);
mHoloBlurColor = a.getColor(R.styleable.PagedViewWidget_blurColor, 0);
mHoloOutlineColor = a.getColor(R.styleable.PagedViewWidget_outlineColor, 0);
+ mEraseStrokeRectPaint.setStyle(Paint.Style.STROKE);
+ mEraseStrokeRectPaint.setStrokeWidth(HolographicOutlineHelper.MIN_OUTER_BLUR_RADIUS);
+ mEraseStrokeRectPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
+ mEraseStrokeRectPaint.setFilterBitmap(true);
+ mEraseStrokeRectPaint.setAntiAlias(true);
a.recycle();
if (sHolographicOutlineHelper == null) {
@@ -158,6 +180,7 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
final ImageView image = (ImageView) findViewById(R.id.widget_preview);
image.setMaxWidth(maxWidth);
image.setImageDrawable(preview);
+ mPreviewImageView = image;
final TextView name = (TextView) findViewById(R.id.widget_name);
name.setText(info.label);
name.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
@@ -179,6 +202,7 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
ImageView image = (ImageView) findViewById(R.id.wallpaper_preview);
image.setMaxWidth(maxWidth);
image.setImageDrawable(preview);
+ mPreviewImageView = image;
TextView name = (TextView) findViewById(R.id.wallpaper_name);
name.setText(info.loadLabel(packageManager));
name.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
@@ -211,8 +235,15 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
// draw any blended overlays
if (mHolographicOutline != null && mHolographicAlpha > 0) {
+ // Calculate how much to scale the holographic preview
+ mTmpScaleRect.set(0,0,1,1);
+ mPreviewImageView.getImageMatrix().mapRect(mTmpScaleRect);
+
mPaint.setAlpha(mHolographicAlpha);
+ canvas.save();
+ canvas.scale(mTmpScaleRect.right, mTmpScaleRect.bottom);
canvas.drawBitmap(mHolographicOutline, 0, 0, mPaint);
+ canvas.restore();
}
}