summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/browser')
-rw-r--r--src/com/android/browser/provider/BrowserProvider2.java22
-rw-r--r--src/com/android/browser/widget/BookmarkListWidgetService.java6
2 files changed, 19 insertions, 9 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);
diff --git a/src/com/android/browser/widget/BookmarkListWidgetService.java b/src/com/android/browser/widget/BookmarkListWidgetService.java
index 893d3f5..1120536 100644
--- a/src/com/android/browser/widget/BookmarkListWidgetService.java
+++ b/src/com/android/browser/widget/BookmarkListWidgetService.java
@@ -67,10 +67,6 @@ public class BookmarkListWidgetService extends RemoteViewsService {
BrowserContract.Bookmarks.PARENT,
BrowserContract.Bookmarks.POSITION};
- // Ordering merged with DEFAULT_BOOKMARK_SORT_ORDER from BrowserProvider2
- private static final String ORDER_BY_CLAUSE =
- Bookmarks.IS_FOLDER + " DESC, position ASC, _id ASC";
-
private Map<Integer, BookmarkFactory> mFactories;
private Handler mUiHandler;
private BookmarksObserver mBookmarksObserver;
@@ -310,7 +306,7 @@ public class BookmarkListWidgetService extends RemoteViewsService {
Cursor c = null;
try {
c = mContext.getContentResolver().query(uri, PROJECTION,
- where, null, ORDER_BY_CLAUSE);
+ where, null, null);
if (c != null) {
mBookmarks = new ArrayList<RenderResult>(c.getCount() + 1);
if (folder != null) {