summaryrefslogtreecommitdiffstats
path: root/src/com/android/contacts/GroupMetaDataLoader.java
diff options
context:
space:
mode:
authorKatherine Kuan <katherinekuan@google.com>2011-06-07 12:38:29 -0700
committerKatherine Kuan <katherinekuan@google.com>2011-06-10 10:53:56 -0700
commitbe18de05d6f6a107c552e369bce58f51c946fde7 (patch)
tree60d6e76e7264e1a53ae2d3347c97dc78656a756f /src/com/android/contacts/GroupMetaDataLoader.java
parent239829bd49925ed9d2f8dfd60425f04de386cdf8 (diff)
downloadpackages_apps_Contacts-be18de05d6f6a107c552e369bce58f51c946fde7.tar.gz
packages_apps_Contacts-be18de05d6f6a107c552e369bce58f51c946fde7.tar.bz2
packages_apps_Contacts-be18de05d6f6a107c552e369bce58f51c946fde7.zip
Add group detail fragment on tablet
- Add action bar on GroupDetailActivity, title, and subtitle - Make everything use the groupUri instead of passing around account name, type, group Id, and group title - Fix some of the callback listeners between the group fragments and group activities - Add factory methods to ContactListFilter Change-Id: I63066ea6eefde1e57562b6396d6dc590ed023c84
Diffstat (limited to 'src/com/android/contacts/GroupMetaDataLoader.java')
-rw-r--r--src/com/android/contacts/GroupMetaDataLoader.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/com/android/contacts/GroupMetaDataLoader.java b/src/com/android/contacts/GroupMetaDataLoader.java
index d08d007f1..927697ab1 100644
--- a/src/com/android/contacts/GroupMetaDataLoader.java
+++ b/src/com/android/contacts/GroupMetaDataLoader.java
@@ -17,10 +17,12 @@ package com.android.contacts;
import android.content.Context;
import android.content.CursorLoader;
+import android.net.Uri;
import android.provider.ContactsContract.Groups;
/**
- * Group meta-data loader. Loads all groups from the database.
+ * Group meta-data loader. Loads all groups or just a single group from the
+ * database (if given a {@link Uri}).
*/
public final class GroupMetaDataLoader extends CursorLoader {
@@ -40,8 +42,23 @@ public final class GroupMetaDataLoader extends CursorLoader {
public final static int AUTO_ADD = 4;
public final static int FAVORITES = 5;
- public GroupMetaDataLoader(Context context) {
- super(context, Groups.CONTENT_URI, COLUMNS, Groups.ACCOUNT_TYPE + " NOT NULL AND "
+ public GroupMetaDataLoader(Context context, Uri groupUri) {
+ super(context, ensureIsGroupUri(groupUri), COLUMNS, Groups.ACCOUNT_TYPE + " NOT NULL AND "
+ Groups.ACCOUNT_NAME + " NOT NULL", null, null);
}
+
+ /**
+ * Ensures that this is a valid group URI. If invalid, then an exception is
+ * thrown. Otherwise, the original URI is returned.
+ */
+ private static Uri ensureIsGroupUri(final Uri groupUri) {
+ // TODO: Fix ContactsProvider2 getType method to resolve the group Uris
+ if (groupUri == null) {
+ throw new IllegalArgumentException("Uri must not be null");
+ }
+ if (!groupUri.toString().startsWith(Groups.CONTENT_URI.toString())) {
+ throw new IllegalArgumentException("Invalid group Uri: " + groupUri);
+ }
+ return groupUri;
+ }
}