am a108d9fc
: Final tweaks to visuals of widget picker
* commit 'a108d9fc0edd3b4f741fae595e35a246fbc700ff': Final tweaks to visuals of widget picker
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 274 B |
Binary file not shown.
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 250 B |
Binary file not shown.
Before Width: | Height: | Size: 316 B After Width: | Height: | Size: 359 B |
@@ -216,7 +216,6 @@ public class KeyguardAppWidgetPickActivity extends Activity
|
|||||||
mResources.getDimensionPixelSize(R.dimen.appwidget_preview_width);
|
mResources.getDimensionPixelSize(R.dimen.appwidget_preview_width);
|
||||||
int appWidgetPreviewHeight =
|
int appWidgetPreviewHeight =
|
||||||
mResources.getDimensionPixelSize(R.dimen.appwidget_preview_height);
|
mResources.getDimensionPixelSize(R.dimen.appwidget_preview_height);
|
||||||
// TODO: fix the hspan, vspan of the default preview
|
|
||||||
Bitmap b = getWidgetPreview(new ComponentName(packageName, className),
|
Bitmap b = getWidgetPreview(new ComponentName(packageName, className),
|
||||||
appWidgetPreviewId, iconId,
|
appWidgetPreviewId, iconId,
|
||||||
appWidgetPreviewWidth, appWidgetPreviewHeight);
|
appWidgetPreviewWidth, appWidgetPreviewHeight);
|
||||||
@@ -322,32 +321,18 @@ public class KeyguardAppWidgetPickActivity extends Activity
|
|||||||
bitmapHeight = drawable.getIntrinsicHeight();
|
bitmapHeight = drawable.getIntrinsicHeight();
|
||||||
} else {
|
} else {
|
||||||
// Generate a preview image if we couldn't load one
|
// Generate a preview image if we couldn't load one
|
||||||
bitmapWidth = maxWidth;
|
bitmapWidth = appIconSize;
|
||||||
bitmapHeight = maxHeight;
|
bitmapHeight = appIconSize;
|
||||||
defaultPreview = Bitmap.createBitmap(bitmapWidth, bitmapHeight,
|
defaultPreview = Bitmap.createBitmap(bitmapWidth, bitmapHeight,
|
||||||
Config.ARGB_8888);
|
Config.ARGB_8888);
|
||||||
final Canvas c = sCachedAppWidgetPreviewCanvas.get();
|
|
||||||
c.setBitmap(defaultPreview);
|
|
||||||
c.drawColor(0xFF2D2D2D);
|
|
||||||
c.setBitmap(null);
|
|
||||||
|
|
||||||
// Draw the icon in the top left corner
|
|
||||||
final float marginPercentage = 0.125f;
|
|
||||||
final float finalIconSize = (bitmapHeight / 2);
|
|
||||||
float iconScale = finalIconSize / appIconSize;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Drawable icon = null;
|
Drawable icon = null;
|
||||||
int hoffset =
|
|
||||||
(int) (finalIconSize * marginPercentage);
|
|
||||||
int yoffset =
|
|
||||||
(int) (finalIconSize * marginPercentage);
|
|
||||||
if (iconId > 0)
|
if (iconId > 0)
|
||||||
icon = getFullResIcon(packageName, iconId);
|
icon = getFullResIcon(packageName, iconId);
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
renderDrawableToBitmap(icon, defaultPreview, hoffset,
|
renderDrawableToBitmap(icon, defaultPreview, 0,
|
||||||
yoffset, (int) (appIconSize * iconScale),
|
0, appIconSize, appIconSize);
|
||||||
(int) (appIconSize * iconScale));
|
|
||||||
}
|
}
|
||||||
} catch (Resources.NotFoundException e) {
|
} catch (Resources.NotFoundException e) {
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user