From 1dd8cd43ff1bf1d7b8ef257b19e761b3eee296a7 Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 13 May 2011 11:22:09 -0700 Subject: Fix bug where wrong folder contents are loaded Change-Id: Ie8d6fcf7161bbcdc51462821bbb54653bd6531b0 --- src/com/android/browser/AddBookmarkPage.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java index 3524c22..18667f3 100644 --- a/src/com/android/browser/AddBookmarkPage.java +++ b/src/com/android/browser/AddBookmarkPage.java @@ -455,15 +455,24 @@ public class AddBookmarkPage extends Activity BrowserContract.Bookmarks.IS_FOLDER }; String where = BrowserContract.Bookmarks.IS_FOLDER + " != 0"; + String whereArgs[] = null; if (mEditingFolder) { - where += " AND " + BrowserContract.Bookmarks._ID + " != " - + mMap.getLong(BrowserContract.Bookmarks._ID); + where += " AND " + BrowserContract.Bookmarks._ID + " != ?"; + whereArgs = new String[] { Long.toString(mMap.getLong( + BrowserContract.Bookmarks._ID)) }; + } + long currentFolder; + Object data = mCrumbs.getTopData(); + if (data != null) { + currentFolder = ((Folder) data).Id; + } else { + currentFolder = mRootFolder; } return new CursorLoader(this, - getUriForFolder(mCurrentFolder), + getUriForFolder(currentFolder), projection, where, - null, + whereArgs, BrowserContract.Bookmarks._ID + " ASC"); default: throw new AssertionError("Asking for nonexistant loader!"); -- cgit v1.1