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

Commit a8aa3d87 authored by Sean Midford's avatar Sean Midford
Browse files

Fixed contact button in send to labels

Removed the quick contact photo badge on left side
of items in send to group picker fragment. Now entire
row triggers the checkbox.

Test: Verified that change is working as intended in both
send email and send phone number to groups

Bug: 32945249

Change-Id: I29575f9f8e00969376866032fb469d036c8c3272
parent 03b86310
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);