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

Commit d89f89c8 authored by Walter Jang's avatar Walter Jang
Browse files

Bind list item group member section headers

Bug 29159876
Bug 18641067

Change-Id: I695f56740c4f0e662216fe1f9b6b0ffcabf51933
parent 8a8884bd
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ public class GroupMembersListAdapter extends MultiSelectEntryContactListAdapter
    public GroupMembersListAdapter(Context context) {
        super(context, GroupMembersQuery.RAW_CONTACT_ID);
        mUnknownNameText = context.getText(R.string.missing_name);
        setSectionHeaderDisplayEnabled(true);
    }

    /** Sets the ID of the group whose members will be displayed. */
@@ -94,7 +95,6 @@ public class GroupMembersListAdapter extends MultiSelectEntryContactListAdapter
                .appendQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY,
                        String.valueOf(Directory.DEFAULT))
                .appendQueryParameter(Contacts.EXTRA_ADDRESS_BOOK_INDEX, "true")
                .appendQueryParameter(Contacts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS, "true")
                .build());

        loader.setSelection(Data.MIMETYPE + "=?" + " AND " + GroupMembership.GROUP_ROW_ID + "=?");
@@ -132,7 +132,6 @@ public class GroupMembersListAdapter extends MultiSelectEntryContactListAdapter
        final ContactListItemView view =
                super.newView(context, partition, cursor, position, parent);
        view.setUnknownNameText(mUnknownNameText);
        view.setQuickContactEnabled(isQuickContactEnabled());
        return view;
    }

@@ -141,10 +140,21 @@ public class GroupMembersListAdapter extends MultiSelectEntryContactListAdapter
        super.bindView(v, partition, cursor, position);
        final ContactListItemView view = (ContactListItemView) v;
        bindViewId(view, cursor, GroupMembersQuery.CONTACT_ID);
        bindSectionHeaderAndDivider(view, position);
        bindName(view, cursor);
        bindPhoto(view, cursor);
    }

    protected void bindSectionHeaderAndDivider(ContactListItemView view, int position) {
        view.setIsSectionHeaderEnabled(isSectionHeaderDisplayEnabled());
        if (isSectionHeaderDisplayEnabled()) {
            final Placement placement = getItemPlacementInSection(position);
            view.setSectionHeader(placement.sectionHeader);
        } else {
            view.setSectionHeader(null);
        }
    }

    private void bindName(ContactListItemView view, Cursor cursor) {
        view.showDisplayName(cursor, GroupMembersQuery.CONTACT_DISPLAY_NAME,
                getContactNameDisplayOrder());