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

Commit 4d4b82bc authored by Isaac Katzenelson's avatar Isaac Katzenelson
Browse files

Show local profile with account filter on

Bug: 5155996 Set up my profile is displayed for each account
     selected,even if the profile has been set

Fixed the query.
Also fixed a bug with number of contacts not shown correctly that
I discovered during the testing.

Change-Id: Ib493fc3ba626d1607e235b1c20ee0a811b03dd85
parent 8e61edc6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -140,11 +140,12 @@ public class DefaultContactBrowseListFragment extends ContactBrowseListFragment
        if (!isSearchMode() && data != null) {
            int count = data.getCount();
            if (count != 0) {
                count -= (mUserProfileExists ? 1: 0);
                String format = getResources().getQuantityText(
                        R.plurals.listTotalAllContacts, count).toString();
                // Do not count the user profile in the contacts count
                if (mUserProfileExists) {
                    getAdapter().setContactsCount(String.format(format, count - 1));
                    getAdapter().setContactsCount(String.format(format, count));
                } else {
                    mCounterHeaderView.setText(String.format(format, count));
                }
+4 −4
Original line number Diff line number Diff line
@@ -192,16 +192,16 @@ public class DefaultContactListAdapter extends ContactListAdapter {
                                + "SELECT DISTINCT " + RawContacts.CONTACT_ID
                                + " FROM raw_contacts"
                                + " WHERE " + RawContacts.ACCOUNT_TYPE + "=?"
                                + " AND " + RawContacts.ACCOUNT_NAME + "=?"
                                + " OR " + Contacts.IS_USER_PROFILE + "=1");
                                + " AND " + RawContacts.ACCOUNT_NAME + "=?");
                selectionArgs.add(filter.accountType);
                selectionArgs.add(filter.accountName);
                if (filter.dataSet != null) {
                    selection.append(" AND " + RawContacts.DATA_SET + "=?)");
                    selection.append(" AND " + RawContacts.DATA_SET + "=?");
                    selectionArgs.add(filter.dataSet);
                } else {
                    selection.append(" AND " + RawContacts.DATA_SET + " IS NULL)");
                    selection.append(" AND " + RawContacts.DATA_SET + " IS NULL");
                }
                selection.append(" OR " + Contacts.IS_USER_PROFILE + "=1)");
                break;
            }
            case ContactListFilter.FILTER_TYPE_GROUP: {