Fix disappearing Bookmarks Page
Ensure that the breadcrumb and bookmarks are
always initialized even if the Database has no
entries.
Change-Id: Ia35bd506314a72db6f9aaacc845b11887412f629
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index 935bdc6..15994ca 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -149,6 +149,20 @@
lm.restartLoader(id, args, this);
id++;
}
+ if (id == LOADER_BOOKMARKS){ // Didn't find any bookmarks
+ Bundle args = new Bundle();
+ args.putString(ACCOUNT_NAME, "null");
+ args.putString(ACCOUNT_TYPE, "null");
+ BrowserBookmarksAdapter adapter = new BrowserBookmarksAdapter(
+ getActivity());
+ mBookmarkAdapters.put(id, adapter);
+ boolean expand = true;
+ try {
+ expand = mState.getBoolean(BookmarkExpandableView.LOCAL_ACCOUNT_NAME);
+ } catch (JSONException e) {} // no state for accountName
+ mGrid.addAccount("null", adapter, expand);
+ lm.restartLoader(id, args, this);
+ }
// TODO: Figure out what a reload of these means
// Currently, a reload is triggered whenever bookmarks change
// This is less than ideal