Bug 752052 - updateBookmark updates all bookmarks with the same URL, not a specific bookmark. r=rnewman

This commit is contained in:
Margaret Leibovic 2012-05-07 15:33:07 -07:00
parent 26cc7c4f60
commit bc80d6ffc7
4 changed files with 9 additions and 34 deletions

View File

@ -569,7 +569,7 @@ public class AwesomeBar extends GeckoActivity implements GeckoEventListener {
@Override
public Void doInBackground(Void... params) {
String newUrl = locationText.getText().toString().trim();
BrowserDB.updateBookmark(mResolver, url, newUrl, nameText.getText().toString(),
BrowserDB.updateBookmark(mResolver, id, newUrl, nameText.getText().toString(),
keywordText.getText().toString());
return null;
}

View File

@ -263,33 +263,8 @@ public class AndroidBrowserDB implements BrowserDB.BrowserDBIface {
addBookmarkPre11(cr, title, uri);
}
public void updateBookmarkPre11(ContentResolver cr, String oldUri, String uri, String title) {
ContentValues values = new ContentValues();
values.put(Browser.BookmarkColumns.TITLE, title);
values.put(Browser.BookmarkColumns.URL, uri);
cr.update(Browser.BOOKMARKS_URI,
values,
Browser.BookmarkColumns.URL + " = ?",
new String[] { oldUri });
}
public void updateBookmarkPost11(ContentResolver cr, String oldUri, String uri, String title) {
ContentValues values = new ContentValues();
values.put(Browser.BookmarkColumns.TITLE, title);
values.put(Browser.BookmarkColumns.URL, uri);
cr.update(BOOKMARKS_CONTENT_URI_POST_11,
values,
Browser.BookmarkColumns.URL + " = ?",
new String[] { oldUri });
}
public void updateBookmark(ContentResolver cr, String oldUri, String uri, String title, String keyword) {
if (Build.VERSION.SDK_INT >= 11)
updateBookmarkPost11(cr, oldUri, uri, title);
else
updateBookmarkPre11(cr, oldUri, uri, title);
public void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword) {
// Not implemented
}
public void removeBookmarkPre11(ContentResolver cr, String uri) {

View File

@ -89,7 +89,7 @@ public class BrowserDB {
public void removeBookmarksWithURL(ContentResolver cr, String uri);
public void updateBookmark(ContentResolver cr, String oldUri, String uri, String title, String keyword);
public void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword);
public BitmapDrawable getFaviconForUrl(ContentResolver cr, String uri);
@ -168,8 +168,8 @@ public class BrowserDB {
sDb.removeBookmarksWithURL(cr, uri);
}
public static void updateBookmark(ContentResolver cr, String oldUri, String uri, String title, String keyword) {
sDb.updateBookmark(cr, oldUri, uri, title, keyword);
public static void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword) {
sDb.updateBookmark(cr, id, uri, title, keyword);
}
public static BitmapDrawable getFaviconForUrl(ContentResolver cr, String uri) {

View File

@ -501,7 +501,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
cr.registerContentObserver(uri, false, observer);
}
public void updateBookmark(ContentResolver cr, String oldUri, String uri, String title, String keyword) {
public void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword) {
ContentValues values = new ContentValues();
values.put(Browser.BookmarkColumns.TITLE, title);
values.put(Bookmarks.URL, uri);
@ -509,8 +509,8 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
cr.update(mBookmarksUriWithProfile,
values,
Bookmarks.URL + " = ?",
new String[] { oldUri });
Bookmarks._ID + " = ?",
new String[] { String.valueOf(id) });
}
public BitmapDrawable getFaviconForUrl(ContentResolver cr, String uri) {