diff options
| author | Patrick Scott <phanna@android.com> | 2009-08-04 13:22:29 -0400 |
|---|---|---|
| committer | Patrick Scott <phanna@android.com> | 2009-08-05 10:52:30 -0400 |
| commit | 3918d4443ff38ef1870e02aa51a8b29f8352bb1a (patch) | |
| tree | 72751daaca11780acba4f57c73619f4f37f6964c /src/com/android/browser/AddBookmarkPage.java | |
| parent | 13feaed9ab1b9a3b8cc5ac1b33e36005802b9fc3 (diff) | |
Implement onReceivedTouchIconUrl.
Add DownloadTouchIcon, an AsyncTask that downloads the apple-touch-icon for urls
that are marked as bookmarks. The touch icon is stored in the bookmark database
similar to favicons and thumbnails. If a shortcut is created for a bookmark
containing a touch icon, the touch icon is used (with rounded corners).
Refactor the bookmarks query to be a static function. The function uses the
original url and new url to look for matching bookmarks. This takes care of
redirects as well as bookmarks containing queries.
Diffstat (limited to 'src/com/android/browser/AddBookmarkPage.java')
| -rw-r--r-- | src/com/android/browser/AddBookmarkPage.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java index 191659a9..d2695464 100644 --- a/src/com/android/browser/AddBookmarkPage.java +++ b/src/com/android/browser/AddBookmarkPage.java @@ -20,6 +20,7 @@ import android.app.Activity; import android.content.ContentResolver; import android.content.Intent; import android.content.res.Resources; +import android.database.Cursor; import android.net.ParseException; import android.net.WebAddress; import android.os.Bundle; @@ -42,6 +43,7 @@ public class AddBookmarkPage extends Activity { private View mCancelButton; private boolean mEditingExisting; private Bundle mMap; + private String mTouchIconUrl; private View.OnClickListener mSaveBookmark = new View.OnClickListener() { public void onClick(View v) { @@ -78,6 +80,7 @@ public class AddBookmarkPage extends Activity { } title = mMap.getString("title"); url = mMap.getString("url"); + mTouchIconUrl = mMap.getString("touch_icon_url"); } mTitle = (EditText) findViewById(R.id.title); @@ -142,7 +145,15 @@ public class AddBookmarkPage extends Activity { setResult(RESULT_OK, (new Intent()).setAction( getIntent().toString()).putExtras(mMap)); } else { - Bookmarks.addBookmark(null, getContentResolver(), url, title, true); + final ContentResolver cr = getContentResolver(); + Bookmarks.addBookmark(null, cr, url, title, true); + if (mTouchIconUrl != null) { + final Cursor c = + BrowserBookmarksAdapter.queryBookmarksForUrl( + cr, null, url); + new DownloadTouchIcon(cr, c, url) + .execute(mTouchIconUrl); + } setResult(RESULT_OK); } } catch (IllegalStateException e) { |
