diff options
author | Jeff Hamilton <jham@android.com> | 2010-09-07 12:36:30 -0700 |
---|---|---|
committer | Jeff Hamilton <jham@android.com> | 2010-09-15 22:15:59 -0500 |
commit | 1a805652e389d9404ee0fda7c993a6202332e92b (patch) | |
tree | 5c545f48bca2fbf18c08db79babb38e1fa914919 /src/com/android/browser/BookmarksLoader.java | |
parent | 28beae80725eace55fd018dd7431d1fedeb10e25 (diff) | |
download | packages_apps_Browser-1a805652e389d9404ee0fda7c993a6202332e92b.zip packages_apps_Browser-1a805652e389d9404ee0fda7c993a6202332e92b.tar.gz packages_apps_Browser-1a805652e389d9404ee0fda7c993a6202332e92b.tar.bz2 |
A bunch of updates to BrowserProvider2.
The images are now shared between the history
and bookmarks tables so updates to one are
reflected in the other.
Added a parameter for specifying a limit when
calling query().
Added a combined view of history and bookmarks.
Added a way to get a distinct list of the
accounts providing bookmarks.
Added the ability to find the server unique
IDs for parent and insert_after when doing
a query for a row.
Change-Id: I9afa15bcf7ca68468793c49fbec701e516e4540e
Diffstat (limited to 'src/com/android/browser/BookmarksLoader.java')
-rw-r--r-- | src/com/android/browser/BookmarksLoader.java | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/com/android/browser/BookmarksLoader.java b/src/com/android/browser/BookmarksLoader.java index 9d5e3ed..0947184 100644 --- a/src/com/android/browser/BookmarksLoader.java +++ b/src/com/android/browser/BookmarksLoader.java @@ -18,10 +18,13 @@ package com.android.browser; import android.content.Context; import android.content.CursorLoader; +import android.net.Uri; import android.provider.BrowserContract.Bookmarks; +import android.text.TextUtils; public class BookmarksLoader extends CursorLoader { - public static final String ARG_ROOT_FOLDER = "root"; + public static final String ARG_ACCOUNT_TYPE = "acct_type"; + public static final String ARG_ACCOUNT_NAME = "acct_name"; public static final int COLUMN_INDEX_ID = 0; public static final int COLUMN_INDEX_URL = 1; @@ -42,7 +45,26 @@ public class BookmarksLoader extends CursorLoader { Bookmarks.POSITION, // 7 }; - public BookmarksLoader(Context context, int rootFolder) { - super(context, Bookmarks.CONTENT_URI_DEFAULT_FOLDER, PROJECTION, null, null, null); + private String mAccountType; + private String mAccountName; + + public BookmarksLoader(Context context, String accountType, String accountName) { + super(context, addAccount(Bookmarks.CONTENT_URI_DEFAULT_FOLDER, accountType, accountName), + PROJECTION, null, null, null); + mAccountType = accountType; + mAccountName = accountName; + } + + @Override + public void setUri(Uri uri) { + super.setUri(addAccount(uri, mAccountType, mAccountName)); + } + + private static Uri addAccount(Uri uri, String accountType, String accountName) { + if (!TextUtils.isEmpty(accountType) && !TextUtils.isEmpty(accountName)) { + return uri.buildUpon().appendQueryParameter(Bookmarks.PARAM_ACCOUNT_TYPE, accountType). + appendQueryParameter(Bookmarks.PARAM_ACCOUNT_NAME, accountName).build(); + } + return uri; } } |