Katherine Kuan | ea1c3a5 | 2011-07-23 15:28:29 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package com.android.contacts; |
| 17 | |
| 18 | import android.content.Context; |
| 19 | import android.content.CursorLoader; |
Katherine Kuan | 1866a07 | 2011-07-25 15:24:56 -0700 | [diff] [blame] | 20 | import android.net.Uri; |
Katherine Kuan | ea1c3a5 | 2011-07-23 15:28:29 -0700 | [diff] [blame] | 21 | import android.provider.ContactsContract.Groups; |
| 22 | |
Wenyi Wang | 9afadde | 2016-06-16 15:10:59 -0700 | [diff] [blame] | 23 | import com.android.contacts.group.GroupUtil; |
| 24 | |
Katherine Kuan | ea1c3a5 | 2011-07-23 15:28:29 -0700 | [diff] [blame] | 25 | /** |
Katherine Kuan | 1866a07 | 2011-07-25 15:24:56 -0700 | [diff] [blame] | 26 | * 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 Kuan | ea1c3a5 | 2011-07-23 15:28:29 -0700 | [diff] [blame] | 30 | */ |
| 31 | public final class GroupListLoader extends CursorLoader { |
Katherine Kuan | ea1c3a5 | 2011-07-23 15:28:29 -0700 | [diff] [blame] | 32 | private final static String[] COLUMNS = new String[] { |
| 33 | Groups.ACCOUNT_NAME, |
| 34 | Groups.ACCOUNT_TYPE, |
Dave Santoro | 2b3f3c5 | 2011-07-26 17:35:42 -0700 | [diff] [blame] | 35 | Groups.DATA_SET, |
Katherine Kuan | ea1c3a5 | 2011-07-23 15:28:29 -0700 | [diff] [blame] | 36 | Groups._ID, |
| 37 | Groups.TITLE, |
Katherine Kuan | ea1c3a5 | 2011-07-23 15:28:29 -0700 | [diff] [blame] | 38 | Groups.SUMMARY_COUNT, |
Wenyi Wang | 3fafbb2 | 2016-06-02 16:56:53 -0700 | [diff] [blame] | 39 | Groups.GROUP_IS_READ_ONLY, |
| 40 | Groups.SYSTEM_ID, |
Katherine Kuan | ea1c3a5 | 2011-07-23 15:28:29 -0700 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | public final static int ACCOUNT_NAME = 0; |
| 44 | public final static int ACCOUNT_TYPE = 1; |
Dave Santoro | 2b3f3c5 | 2011-07-26 17:35:42 -0700 | [diff] [blame] | 45 | public final static int DATA_SET = 2; |
| 46 | public final static int GROUP_ID = 3; |
| 47 | public final static int TITLE = 4; |
Daniel Lehmann | d78ee90 | 2011-08-14 15:28:39 -0700 | [diff] [blame] | 48 | public final static int MEMBER_COUNT = 5; |
Wenyi Wang | 3fafbb2 | 2016-06-02 16:56:53 -0700 | [diff] [blame] | 49 | public final static int IS_READ_ONLY = 6; |
| 50 | public final static int SYSTEM_ID = 7; |
Katherine Kuan | 1866a07 | 2011-07-25 15:24:56 -0700 | [diff] [blame] | 51 | |
Daisuke Miyakawa | 08c8746 | 2011-08-09 16:41:37 -0700 | [diff] [blame] | 52 | private static final Uri GROUP_LIST_URI = Groups.CONTENT_SUMMARY_URI; |
Katherine Kuan | ea1c3a5 | 2011-07-23 15:28:29 -0700 | [diff] [blame] | 53 | |
| 54 | public GroupListLoader(Context context) { |
Walter Jang | 46f9006 | 2016-04-14 14:49:12 -0700 | [diff] [blame] | 55 | super(context, |
| 56 | GROUP_LIST_URI, |
| 57 | COLUMNS, |
Gary Mai | 5c1bff2 | 2016-09-30 15:10:25 -0700 | [diff] [blame] | 58 | GroupUtil.DEFAULT_SELECTION, |
Walter Jang | 46f9006 | 2016-04-14 14:49:12 -0700 | [diff] [blame] | 59 | null, |
Wenyi Wang | 9afadde | 2016-06-16 15:10:59 -0700 | [diff] [blame] | 60 | GroupUtil.getGroupsSortOrder()); |
Katherine Kuan | ea1c3a5 | 2011-07-23 15:28:29 -0700 | [diff] [blame] | 61 | } |
| 62 | } |