summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/DownloadTouchIcon.java
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2009-09-18 16:29:38 -0400
committerPatrick Scott <phanna@android.com>2009-09-22 13:24:56 -0400
commit59ce830c6eab58171b727abe5282c4abadb1a040 (patch)
tree640b5ad95bd7df401919fec89ca3b7662045518a /src/com/android/browser/DownloadTouchIcon.java
parentf4672127dba061c9d4d69a1139e9c8e43d740a49 (diff)
downloadpackages_apps_Browser-59ce830c6eab58171b727abe5282c4abadb1a040.tar.gz
packages_apps_Browser-59ce830c6eab58171b727abe5282c4abadb1a040.tar.bz2
packages_apps_Browser-59ce830c6eab58171b727abe5282c4abadb1a040.zip
Support precomposed app icons.
The precomposed icon overrides any other touch icon. We still need to do the round rect clip because apparently apple still applies the rounded corners, just not the glass effect. Inset the rectangle by 1 to fit the icons better.
Diffstat (limited to 'src/com/android/browser/DownloadTouchIcon.java')
-rw-r--r--src/com/android/browser/DownloadTouchIcon.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/com/android/browser/DownloadTouchIcon.java b/src/com/android/browser/DownloadTouchIcon.java
index 6662e0905..07d2d3ae6 100644
--- a/src/com/android/browser/DownloadTouchIcon.java
+++ b/src/com/android/browser/DownloadTouchIcon.java
@@ -42,8 +42,11 @@ class DownloadTouchIcon extends AsyncTask<String, Void, Bitmap> {
private final String mOriginalUrl;
private final String mUrl;
private final String mUserAgent;
+ /* package */ BrowserActivity mActivity;
- public DownloadTouchIcon(ContentResolver cr, Cursor c, WebView view) {
+ public DownloadTouchIcon(BrowserActivity activity, ContentResolver cr,
+ Cursor c, WebView view) {
+ mActivity = activity;
mContentResolver = cr;
mCursor = c;
// Store these in case they change.
@@ -53,6 +56,7 @@ class DownloadTouchIcon extends AsyncTask<String, Void, Bitmap> {
}
public DownloadTouchIcon(ContentResolver cr, Cursor c, String url) {
+ mActivity = null;
mContentResolver = cr;
mCursor = c;
mOriginalUrl = null;
@@ -96,10 +100,24 @@ class DownloadTouchIcon extends AsyncTask<String, Void, Bitmap> {
}
@Override
+ protected void onCancelled() {
+ if (mCursor != null) {
+ mCursor.close();
+ }
+ }
+
+ @Override
public void onPostExecute(Bitmap icon) {
- if (icon == null || mCursor == null) {
+ // Do this first in case the download failed.
+ if (mActivity != null) {
+ // Remove the touch icon loader from the BrowserActivity.
+ mActivity.mTouchIconLoader = null;
+ }
+
+ if (icon == null || mCursor == null || isCancelled()) {
return;
}
+
final ByteArrayOutputStream os = new ByteArrayOutputStream();
icon.compress(Bitmap.CompressFormat.PNG, 100, os);
ContentValues values = new ContentValues();