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

Commit fa05d924 authored by Sean Midford's avatar Sean Midford Committed by Android (Google) Code Review
Browse files

Merge "Fixed contact button in send to labels" into ub-contactsdialer-h-dev

parents c199b72c a8aa3d87
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.provider.ContactsContract;
import android.view.View;
import android.widget.CheckBox;

import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.group.GroupUtil;

import java.util.TreeSet;
@@ -157,6 +158,24 @@ public abstract class MultiSelectEntryContactListAdapter extends ContactEntryLis
        bindCheckBox(view, cursor, partition == ContactsContract.Directory.DEFAULT);
    }

    /**
      * Loads the photo for the photo view.
      * @param photoIdColumn Index of the photo id column
      * @param lookUpKeyColumn Index of the lookup key column
      * @param displayNameColumn Index of the display name column
      */
    protected void bindPhoto(final ContactListItemView view, final Cursor cursor,
           final int photoIdColumn, final int lookUpKeyColumn, final int displayNameColumn) {
        final long photoId = cursor.isNull(photoIdColumn)
            ? 0 : cursor.getLong(photoIdColumn);
        final ContactPhotoManager.DefaultImageRequest imageRequest = photoId == 0
            ? getDefaultImageRequestFromCursor(cursor, displayNameColumn,
            lookUpKeyColumn)
            : null;
        getPhotoLoader().loadThumbnail(view.getPhotoView(), photoId, false, getCircularPhotos(),
                imageRequest);
    }

    private void bindCheckBox(ContactListItemView view, Cursor cursor, boolean isLocalDirectory) {
        // Disable clicking on all contacts from remote directories when showing check boxes. We do
        // this by telling the view to handle clicking itself.
+2 −12
Original line number Diff line number Diff line
@@ -150,7 +150,8 @@ public class GroupMembersAdapter extends MultiSelectEntryContactListAdapter {
        final ContactListItemView view = (ContactListItemView) v;
        bindSectionHeaderAndDivider(view, position);
        bindName(view, cursor);
        bindPhoto(view, cursor);
        bindPhoto(view, cursor, GroupMembersQuery.CONTACT_PHOTO_ID,
                GroupMembersQuery.CONTACT_LOOKUP_KEY, GroupMembersQuery.CONTACT_DISPLAY_NAME);
        bindDeleteButton(view, position);
    }

@@ -169,17 +170,6 @@ public class GroupMembersAdapter extends MultiSelectEntryContactListAdapter {
                getContactNameDisplayOrder());
    }

    private void bindPhoto(final ContactListItemView view, Cursor cursor) {
        final long photoId = cursor.isNull(GroupMembersQuery.CONTACT_PHOTO_ID)
                ? 0 : cursor.getLong(GroupMembersQuery.CONTACT_PHOTO_ID);
        final DefaultImageRequest imageRequest = photoId == 0
                ? getDefaultImageRequestFromCursor(cursor, GroupMembersQuery.CONTACT_DISPLAY_NAME,
                        GroupMembersQuery.CONTACT_LOOKUP_KEY)
                : null;
        getPhotoLoader().loadThumbnail(view.getPhotoView(), photoId, false, getCircularPhotos(),
                imageRequest);
    }

    private void bindDeleteButton(final ContactListItemView view, int position) {
        if (mDisplayDeleteButtons) {
            view.getDeleteImageButton(getDeleteContactListener(), position);
+3 −3
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.view.ViewGroup;

import android.provider.ContactsContract.CommonDataKinds.Email;

import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.list.ContactListItemView;
import com.android.contacts.common.list.MultiSelectEntryContactListAdapter;
import com.android.contacts.common.preference.ContactsPreferences;
@@ -162,9 +163,8 @@ public class MultiSelectEmailAddressesListAdapter extends MultiSelectEntryContac
        bindViewId(view, cursor, EmailQuery.EMAIL_ID);
        if (isFirstEntry) {
            bindName(view, cursor);
            bindQuickContact(view, partition, cursor, EmailQuery.PHOTO_ID,
                    EmailQuery.PHOTO_URI, EmailQuery.CONTACT_ID,
                    EmailQuery.LOOKUP_KEY, EmailQuery.DISPLAY_NAME);
            bindPhoto(view, cursor, EmailQuery.PHOTO_ID, EmailQuery.LOOKUP_KEY,
                    EmailQuery.DISPLAY_NAME);
        } else {
            unbindName(view);
            view.removePhotoView(true, false);
+3 −3
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.view.ViewGroup;

import android.provider.ContactsContract.CommonDataKinds.Phone;

import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.list.ContactListItemView;
import com.android.contacts.common.list.MultiSelectEntryContactListAdapter;
import com.android.contacts.common.preference.ContactsPreferences;
@@ -162,9 +163,8 @@ public class MultiSelectPhoneNumbersListAdapter extends MultiSelectEntryContactL
        bindViewId(view, cursor, PhoneQuery.PHONE_ID);
        if (isFirstEntry) {
            bindName(view, cursor);
            bindQuickContact(view, partition, cursor, PhoneQuery.PHOTO_ID,
                        PhoneQuery.PHOTO_URI, PhoneQuery.CONTACT_ID,
                        PhoneQuery.LOOKUP_KEY, PhoneQuery.DISPLAY_NAME);
            bindPhoto(view, cursor, PhoneQuery.PHOTO_ID, PhoneQuery.LOOKUP_KEY,
                PhoneQuery.DISPLAY_NAME);
        } else {
            unbindName(view);
            view.removePhotoView(true, false);