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

Commit 9afaddec authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Sort group metadata in a localized way

Bug 28936603
Bug 28946142

Change-Id: I1aa5a3bbcc9e53cfa67f5c12497eb95ff2114436
parent bb229241
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