Java 类android.provider.Contacts.Groups 实例源码

项目:CSipSimple    文件:ContactsUtils3.java   
@Override
public Cursor getGroups(Context context) {
    Uri searchUri = Groups.CONTENT_URI;
    String[] projection = new String[] {
            Groups._ID,
            Groups.NAME + " AS '"+FIELD_GROUP_NAME+"'"
    };

    return context.getContentResolver().query(searchUri, projection, null, null,
            Groups.NAME + " ASC");
}
项目:flingtap-done    文件:ContactsListActivity.java   
private void setEmptyText() {
        TextView empty = (TextView) findViewById(R.id.emptyText);
        // Center the text by default
        int gravity = Gravity.CENTER;
        switch (mMode) {
            case MODE_GROUP:
                if (Groups.GROUP_MY_CONTACTS.equals(mDisplayInfo)) {
                    if (mSyncEnabled) {
                        empty.setText(getText(R.string.noContactsHelpTextWithSync));
                    } else {
                        empty.setText(getText(R.string.noContactsHelpText));
                    }
                    gravity = Gravity.NO_GRAVITY;
                } else {
//                    empty.setText(getString(R.string.groupEmpty, mDisplayInfo));
                }
                break;

            case MODE_STARRED:
            case MODE_STREQUENT:
            case MODE_FREQUENT:
                empty.setText(getText(R.string.noFavorites));
                break;

            case MODE_WITH_PHONES:
                empty.setText(getText(R.string.noContactsWithPhoneNumbers));
                break;

            default:
                empty.setText(getText(R.string.noContacts));
                break;
        }
        empty.setGravity(gravity);
    }
项目:flingtap-done    文件:ContactsListActivity.java   
/**
 * Sets the mode when the request is for "default"
 */
private void setMyContactsMode() {
    // Just display My Contacts
    //mMode = MODE_GROUP;
    mDisplayType = DISPLAY_TYPE_SYSTEM_GROUP;
    buildSystemGroupUris(Groups.GROUP_MY_CONTACTS);
    mDisplayInfo = Groups.GROUP_MY_CONTACTS;

    // Update the empty text view with the proper string, as the group may have changed
    setEmptyText();
}
项目:flingtap-done    文件:ContactsListActivity.java   
/**
 * Sets the mode when the request is for "default"
 */
private void setDefaultMode() {
    // Load the preferences
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    // Lookup the group to display
    mDisplayType = prefs.getInt(PREF_DISPLAY_TYPE, DISPLAY_TYPE_UNKNOWN);
    switch (mDisplayType) {
        case DISPLAY_TYPE_ALL_WITH_PHONES: {
            mMode = MODE_WITH_PHONES;
            mDisplayInfo = null;
            break;
        }

        case DISPLAY_TYPE_SYSTEM_GROUP: {
            String systemId = prefs.getString(
                    PREF_DISPLAY_INFO, null);
            if (!TextUtils.isEmpty(systemId)) {
                // Display the selected system group
                mMode = MODE_GROUP;
                buildSystemGroupUris(systemId);
                mDisplayInfo = systemId;
            } else {
                // No valid group is present, display everything
                mMode = MODE_WITH_PHONES;
                mDisplayInfo = null;
                mDisplayType = DISPLAY_TYPE_ALL;
            }
            break;
        }

        case DISPLAY_TYPE_USER_GROUP: {
            String displayGroup = prefs.getString(
                    PREF_DISPLAY_INFO, null);
            if (!TextUtils.isEmpty(displayGroup)) {
                // Display the selected user group
                mMode = MODE_GROUP;
                buildUserGroupUris(displayGroup);
                mDisplayInfo = displayGroup;
            } else {
                // No valid group is present, display everything
                mMode = MODE_WITH_PHONES;
                mDisplayInfo = null;
                mDisplayType = DISPLAY_TYPE_ALL;
            }
            break;
        }

        case DISPLAY_TYPE_ALL: {
            mMode = MODE_ALL_CONTACTS;
            mDisplayInfo = null;
            break;
        }

        default: {
            // We don't know what to display, default to My Contacts
            mMode = MODE_GROUP;
            mDisplayType = DISPLAY_TYPE_SYSTEM_GROUP;
            buildSystemGroupUris(Groups.GROUP_MY_CONTACTS);
            mDisplayInfo = Groups.GROUP_MY_CONTACTS;
            break;
        }
    }

    // Update the empty text view with the proper string, as the group may have changed
    setEmptyText();
}