summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-11-29 15:41:15 +0000
committerBen Murdoch <benm@google.com>2010-11-30 12:33:14 +0000
commit77835fd4a5ab14a21e5cc3382922755328ed81a9 (patch)
tree801c60cf8a4ede2e7c46e546c76b7003e4d22ea5 /src/com/android/browser
parent0b859b48126dfc34b0e122c8b56d0cae1e3c87cf (diff)
downloadpackages_apps_Browser-77835fd4a5ab14a21e5cc3382922755328ed81a9.tar.gz
packages_apps_Browser-77835fd4a5ab14a21e5cc3382922755328ed81a9.tar.bz2
packages_apps_Browser-77835fd4a5ab14a21e5cc3382922755328ed81a9.zip
Update homescreen icon generator to look better on xlarge devices.
Copy mipmap-hdpi resources into mipmap-xlarge to provide larger assets for xlarge devices (previously we were picking them up from mipmap-mdpi). With the larger icons, we also need to increase the size of the rectangle we draw the favicon onto (otherwise we see the points of the star coming out of the favicon). Bug: 3224340 Change-Id: If0a297836c288104a32e5dbcd5d886d5849f9698
Diffstat (limited to 'src/com/android/browser')
-rw-r--r--src/com/android/browser/BookmarkUtils.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/com/android/browser/BookmarkUtils.java b/src/com/android/browser/BookmarkUtils.java
index a63b90fb0..c72cbd1da 100644
--- a/src/com/android/browser/BookmarkUtils.java
+++ b/src/com/android/browser/BookmarkUtils.java
@@ -70,14 +70,14 @@ class BookmarkUtils {
if (icon != null) {
// Now draw the correct icon background into our new bitmap.
- canvas.drawBitmap(icon, null, iconBounds, null);
+ Paint p = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
+ canvas.drawBitmap(icon, null, iconBounds, p);
}
// If we have a favicon, overlay it in a nice rounded white box on top of the
// background.
if (favicon != null) {
- drawFaviconToCanvas(favicon, canvas, iconBounds,
- context.getResources().getDisplayMetrics().density);
+ drawFaviconToCanvas(context, favicon, canvas, iconBounds);
}
}
return bm;
@@ -139,8 +139,8 @@ class BookmarkUtils {
canvas.drawPath(path, paint);
}
- private static void drawFaviconToCanvas(Bitmap favicon, Canvas canvas, Rect iconBounds,
- float density) {
+ private static void drawFaviconToCanvas(Context context, Bitmap favicon, Canvas canvas,
+ Rect iconBounds) {
// Make a Paint for the white background rectangle and for
// filtering the favicon.
Paint p = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
@@ -148,15 +148,16 @@ class BookmarkUtils {
p.setColor(Color.WHITE);
// Create a rectangle that is slightly wider than the favicon
- final float iconSize = 16 * density; // 16x16 favicon
- final float padding = 2 * density; // white padding around icon
- final float rectSize = iconSize + 2 * padding;
- final float x = iconBounds.exactCenterX() - (rectSize / 2);
- // Note: Subtract 2 dip from the y position since the box is
+ int faviconDimension = context.getResources().getDimensionPixelSize(R.dimen.favicon_size);
+ int faviconPaddedRectDimension = context.getResources().getDimensionPixelSize(
+ R.dimen.favicon_padded_size);
+ float padding = (faviconPaddedRectDimension - faviconDimension) / 2;
+ final float x = iconBounds.exactCenterX() - (faviconPaddedRectDimension / 2);
+ // Note: Subtract from the y position since the box is
// slightly higher than center. Use padding since it is already
- // 2 * density.
- final float y = iconBounds.exactCenterY() - (rectSize / 2) - padding;
- RectF r = new RectF(x, y, x + rectSize, y + rectSize);
+ // device independent.
+ final float y = iconBounds.exactCenterY() - (faviconPaddedRectDimension / 2) - padding;
+ RectF r = new RectF(x, y, x + faviconPaddedRectDimension, y + faviconPaddedRectDimension);
// Draw a white rounded rectangle behind the favicon
canvas.drawRoundRect(r, 2, 2, p);
@@ -165,7 +166,7 @@ class BookmarkUtils {
// rectangle but inset by the padding
// (results in a 16x16 favicon).
r.inset(padding, padding);
- canvas.drawBitmap(favicon, null, r, p);
+ canvas.drawBitmap(favicon, null, r, null);
}
/* package */ static Uri getBookmarksUri(Context context) {