diff options
author | Patrick Scott <phanna@android.com> | 2010-02-25 11:44:40 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-02-25 11:44:40 -0800 |
commit | b4dc4ad5f0048a0bbfbed493e31beabcf4c59538 (patch) | |
tree | 9467f7a765e8396904c24d1462556cb03fa5e5a3 | |
parent | 385effd3192a16b737a7d4fbe4fc71c6cf467627 (diff) | |
parent | c0fdde99a36be4eed618a2c71cec84c7bcb95626 (diff) | |
download | packages_apps_Browser-b4dc4ad5f0048a0bbfbed493e31beabcf4c59538.zip packages_apps_Browser-b4dc4ad5f0048a0bbfbed493e31beabcf4c59538.tar.gz packages_apps_Browser-b4dc4ad5f0048a0bbfbed493e31beabcf4c59538.tar.bz2 |
Merge "Update the shortcut icons with new assets."
-rw-r--r-- | res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark.png | bin | 3356 -> 3328 bytes | |||
-rw-r--r-- | res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark_icon.png | bin | 0 -> 2412 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_launcher_shortcut_browser_bookmark_icon.png | bin | 0 -> 1633 bytes | |||
-rw-r--r-- | src/com/android/browser/BrowserBookmarksPage.java | 20 |
4 files changed, 15 insertions, 5 deletions
diff --git a/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark.png b/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark.png Binary files differindex f861650..7b2c680 100644 --- a/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark.png +++ b/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark.png diff --git a/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark_icon.png b/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark_icon.png Binary files differnew file mode 100644 index 0000000..57fc915 --- /dev/null +++ b/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark_icon.png diff --git a/res/drawable-mdpi/ic_launcher_shortcut_browser_bookmark_icon.png b/res/drawable-mdpi/ic_launcher_shortcut_browser_bookmark_icon.png Binary files differnew file mode 100644 index 0000000..ba82911 --- /dev/null +++ b/res/drawable-mdpi/ic_launcher_shortcut_browser_bookmark_icon.png diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java index d835f84..1183b70 100644 --- a/src/com/android/browser/BrowserBookmarksPage.java +++ b/src/com/android/browser/BrowserBookmarksPage.java @@ -30,6 +30,7 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; +import android.graphics.Rect; import android.graphics.RectF; import android.net.Uri; import android.os.Bundle; @@ -445,7 +446,7 @@ public class BrowserBookmarksPage extends Activity implements R.drawable.ic_launcher_shortcut_browser_bookmark)); } else { Bitmap icon = BitmapFactory.decodeResource(getResources(), - R.drawable.ic_launcher_shortcut_browser_bookmark); + R.drawable.ic_launcher_shortcut_browser_bookmark_icon); // Make a copy of the regular icon so we can modify the pixels. Bitmap copy = icon.copy(Bitmap.Config.ARGB_8888, true); @@ -458,13 +459,22 @@ public class BrowserBookmarksPage extends Activity implements p.setStyle(Paint.Style.FILL_AND_STROKE); p.setColor(Color.WHITE); - float density = getResources().getDisplayMetrics().density; + final float density = + getResources().getDisplayMetrics().density; // Create a rectangle that is slightly wider than the favicon final float iconSize = 16 * density; // 16x16 favicon - final float padding = 2; // white padding around icon + final float padding = 2 * density; // white padding around icon final float rectSize = iconSize + 2 * padding; - final float y = icon.getHeight() - rectSize; - RectF r = new RectF(0, y, rectSize, y + rectSize); + + final Rect iconBounds = + new Rect(0, 0, icon.getWidth(), icon.getHeight()); + final float x = iconBounds.exactCenterX() - (rectSize / 2); + // Note: Subtract 2 dip 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); // Draw a white rounded rectangle behind the favicon canvas.drawRoundRect(r, 2, 2, p); |