summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2010-02-25 11:44:40 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-02-25 11:44:40 -0800
commitb4dc4ad5f0048a0bbfbed493e31beabcf4c59538 (patch)
tree9467f7a765e8396904c24d1462556cb03fa5e5a3
parent385effd3192a16b737a7d4fbe4fc71c6cf467627 (diff)
parentc0fdde99a36be4eed618a2c71cec84c7bcb95626 (diff)
downloadpackages_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.pngbin3356 -> 3328 bytes
-rw-r--r--res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark_icon.pngbin0 -> 2412 bytes
-rw-r--r--res/drawable-mdpi/ic_launcher_shortcut_browser_bookmark_icon.pngbin0 -> 1633 bytes
-rw-r--r--src/com/android/browser/BrowserBookmarksPage.java20
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
index f861650..7b2c680 100644
--- a/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark.png
+++ b/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark_icon.png b/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark_icon.png
new file mode 100644
index 0000000..57fc915
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_shortcut_browser_bookmark_icon.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_shortcut_browser_bookmark_icon.png b/res/drawable-mdpi/ic_launcher_shortcut_browser_bookmark_icon.png
new file mode 100644
index 0000000..ba82911
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_shortcut_browser_bookmark_icon.png
Binary files differ
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);