diff options
| author | Patrick Scott <phanna@android.com> | 2009-09-18 16:29:38 -0400 |
|---|---|---|
| committer | Patrick Scott <phanna@android.com> | 2009-09-22 13:24:56 -0400 |
| commit | 59ce830c6eab58171b727abe5282c4abadb1a040 (patch) | |
| tree | 640b5ad95bd7df401919fec89ca3b7662045518a /src/com/android/browser/DownloadTouchIcon.java | |
| parent | f4672127dba061c9d4d69a1139e9c8e43d740a49 (diff) | |
| download | packages_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.java | 22 |
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(); |
