blob: 51695f5df8cd915a8919ac23cb7dccf131f4822c [file] [log] [blame]
Katherine Kuanea1c3a52011-07-23 15:28:29 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16package com.android.contacts;
17
18import android.content.Context;
19import android.content.CursorLoader;
Katherine Kuan1866a072011-07-25 15:24:56 -070020import android.net.Uri;
Katherine Kuanea1c3a52011-07-23 15:28:29 -070021import android.provider.ContactsContract.Groups;
22
Wenyi Wang9afadde2016-06-16 15:10:59 -070023import com.android.contacts.group.GroupUtil;
24
Katherine Kuanea1c3a52011-07-23 15:28:29 -070025/**
Katherine Kuan1866a072011-07-25 15:24:56 -070026 * Group loader for the group list that includes details such as the number of contacts per group
27 * and number of groups per account. This list is sorted by account type, account name, where the
28 * group names are in alphabetical order. Note that the list excludes default, favorite, and deleted
29 * groups.
Katherine Kuanea1c3a52011-07-23 15:28:29 -070030 */
31public final class GroupListLoader extends CursorLoader {
Katherine Kuanea1c3a52011-07-23 15:28:29 -070032 private final static String[] COLUMNS = new String[] {
33 Groups.ACCOUNT_NAME,
34 Groups.ACCOUNT_TYPE,
Dave Santoro2b3f3c52011-07-26 17:35:42 -070035 Groups.DATA_SET,
Katherine Kuanea1c3a52011-07-23 15:28:29 -070036 Groups._ID,
37 Groups.TITLE,
Katherine Kuanea1c3a52011-07-23 15:28:29 -070038 Groups.SUMMARY_COUNT,
Wenyi Wang3fafbb22016-06-02 16:56:53 -070039 Groups.GROUP_IS_READ_ONLY,
40 Groups.SYSTEM_ID,
Katherine Kuanea1c3a52011-07-23 15:28:29 -070041 };
42
43 public final static int ACCOUNT_NAME = 0;
44 public final static int ACCOUNT_TYPE = 1;
Dave Santoro2b3f3c52011-07-26 17:35:42 -070045 public final static int DATA_SET = 2;
46 public final static int GROUP_ID = 3;
47 public final static int TITLE = 4;
Daniel Lehmannd78ee902011-08-14 15:28:39 -070048 public final static int MEMBER_COUNT = 5;
Wenyi Wang3fafbb22016-06-02 16:56:53 -070049 public final static int IS_READ_ONLY = 6;
50 public final static int SYSTEM_ID = 7;
Katherine Kuan1866a072011-07-25 15:24:56 -070051
Daisuke Miyakawa08c87462011-08-09 16:41:37 -070052 private static final Uri GROUP_LIST_URI = Groups.CONTENT_SUMMARY_URI;
Katherine Kuanea1c3a52011-07-23 15:28:29 -070053
54 public GroupListLoader(Context context) {
Walter Jang46f90062016-04-14 14:49:12 -070055 super(context,
56 GROUP_LIST_URI,
57 COLUMNS,
Gary Mai5c1bff22016-09-30 15:10:25 -070058 GroupUtil.DEFAULT_SELECTION,
Walter Jang46f90062016-04-14 14:49:12 -070059 null,
Wenyi Wang9afadde2016-06-16 15:10:59 -070060 GroupUtil.getGroupsSortOrder());
Katherine Kuanea1c3a52011-07-23 15:28:29 -070061 }
62}