diff options
author | John Reck <jreck@google.com> | 2010-11-11 17:15:55 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2010-11-11 17:15:55 -0800 |
commit | 1097e3d7533fda2437da0fb98f6b08c63d9f2b03 (patch) | |
tree | 2eaaa3dc699aa8730034d8f2f6c3996048861a8d /src/com/android/browser/provider | |
parent | e222fe87a6a582b283cbad0f6967e908c4bfe85e (diff) | |
download | packages_apps_Browser-1097e3d7533fda2437da0fb98f6b08c63d9f2b03.zip packages_apps_Browser-1097e3d7533fda2437da0fb98f6b08c63d9f2b03.tar.gz packages_apps_Browser-1097e3d7533fda2437da0fb98f6b08c63d9f2b03.tar.bz2 |
Fixes bookmark sort order
Bug: 3185357
Changes the default sort behavior of bookmarks. If the browser is not
sync'd, then folders are sorted before bookmarks. If the browser is
sync'd, then the user-specified position takes absolute priority.
Change-Id: Ie27938a59714b0cd27c4419a66aab5076df69104
Diffstat (limited to 'src/com/android/browser/provider')
-rw-r--r-- | src/com/android/browser/provider/BrowserProvider2.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java index 5b87d0f..8d9f1fe 100644 --- a/src/com/android/browser/provider/BrowserProvider2.java +++ b/src/com/android/browser/provider/BrowserProvider2.java @@ -99,8 +99,12 @@ public class BrowserProvider2 extends SQLiteContentProvider { public static final long FIXED_ID_ROOT = 1; - // BookmarkListWidgetService.ORDER_BY_CLAUSE has a copy of this default sort order - static final String DEFAULT_BOOKMARKS_SORT_ORDER = "position ASC, _id ASC"; + // Default sort order for unsync'd bookmarks + static final String DEFAULT_BOOKMARKS_SORT_ORDER = + Bookmarks.IS_FOLDER + " DESC, position ASC, _id ASC"; + + // Default sort order for sync'd bookmarks + static final String DEFAULT_BOOKMARKS_SORT_ORDER_SYNC = "position ASC, _id ASC"; static final UriMatcher URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH); @@ -604,7 +608,12 @@ public class BrowserProvider2 extends SQLiteContentProvider { // Set a default sort order if one isn't specified if (TextUtils.isEmpty(sortOrder)) { - sortOrder = DEFAULT_BOOKMARKS_SORT_ORDER; + if (!TextUtils.isEmpty(accountType) + && !TextUtils.isEmpty(accountName)) { + sortOrder = DEFAULT_BOOKMARKS_SORT_ORDER_SYNC; + } else { + sortOrder = DEFAULT_BOOKMARKS_SORT_ORDER; + } } qb.setProjectionMap(BOOKMARKS_PROJECTION_MAP); @@ -630,8 +639,13 @@ public class BrowserProvider2 extends SQLiteContentProvider { qb.setTables(TABLE_BOOKMARKS_JOIN_IMAGES); String[] args; String query; + // Set a default sort order if one isn't specified if (TextUtils.isEmpty(sortOrder)) { - sortOrder = DEFAULT_BOOKMARKS_SORT_ORDER; + if (useAccount) { + sortOrder = DEFAULT_BOOKMARKS_SORT_ORDER_SYNC; + } else { + sortOrder = DEFAULT_BOOKMARKS_SORT_ORDER; + } } if (!useAccount) { qb.setProjectionMap(BOOKMARKS_PROJECTION_MAP); |