Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ae9f162 authored by Wenyi Wang's avatar Wenyi Wang Committed by Android (Google) Code Review
Browse files

Merge "Sort group metadata in a localized way"

parents 76563069 9afaddec
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.content.CursorLoader;
import android.net.Uri;
import android.provider.ContactsContract.Groups;

import com.android.contacts.group.GroupUtil;

/**
 * Group loader for the group list that includes details such as the number of contacts per group
 * and number of groups per account. This list is sorted by account type, account name, where the
@@ -56,12 +58,11 @@ public final class GroupListLoader extends CursorLoader {
    private static final Uri GROUP_LIST_URI = Groups.CONTENT_SUMMARY_URI;

    public GroupListLoader(Context context) {
        // Sort groups from all accounts alphabettically and in a localized way.
        super(context,
                GROUP_LIST_URI,
                COLUMNS,
                DEFAULT_SELECTION,
                null,
                Groups.TITLE + " COLLATE LOCALIZED ASC");
                GroupUtil.getGroupsSortOrder());
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.content.CursorLoader;
import android.net.Uri;
import android.provider.ContactsContract.Groups;

import com.android.contacts.group.GroupUtil;

/**
 * Group meta-data loader. Loads all groups or just a single group from the
 * database (if given a {@link Uri}).
@@ -52,7 +54,7 @@ public final class GroupMetaDataLoader extends CursorLoader {
        super(context, ensureIsGroupUri(groupUri), COLUMNS,
                Groups.ACCOUNT_TYPE + " NOT NULL AND " + Groups.ACCOUNT_NAME + " NOT NULL AND "
                        + Groups.DELETED + "=0",
                null, Groups.TITLE + " COLLATE NOCASE ASC");
                null, GroupUtil.getGroupsSortOrder());
    }

    /**
+7 −0
Original line number Diff line number Diff line
@@ -149,4 +149,11 @@ public final class GroupUtil {
    private static boolean isSystemIdFFC(String systemId) {
        return !TextUtils.isEmpty(systemId) && FFC_GROUPS.contains(systemId);
    }

    /**
     * Sort groups alphabetically and in a localized way.
     */
    public static String getGroupsSortOrder() {
        return Groups.TITLE + " COLLATE LOCALIZED ASC";
    }
}
 No newline at end of file