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

Commit b1115629 authored by Gary Mai's avatar Gary Mai Committed by android-build-merger
Browse files

Use photo ids in aggregation suggestions

am: 04926c01

Change-Id: I1a00e409496642fa535db29e645549ecb6db9c6b
parents 6837417f 04926c01
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ public class AggregationSuggestionEngine extends HandlerThread {
        public long contactId;
        public String contactLookupKey;
        public long rawContactId;
        public long photoId;
        public String name;
        public String phoneNumber;
        public String emailAddress;
@@ -72,6 +73,7 @@ public class AggregationSuggestionEngine extends HandlerThread {
                    .add("contactId", contactId)
                    .add("contactLookupKey", contactLookupKey)
                    .add("rawContactId", rawContactId)
                    .add("photoId", photoId)
                    .add("name", name)
                    .add("phoneNumber", phoneNumber)
                    .add("emailAddress", emailAddress)
@@ -284,7 +286,8 @@ public class AggregationSuggestionEngine extends HandlerThread {
                Data.IS_SUPER_PRIMARY,
                RawContacts.ACCOUNT_TYPE,
                RawContacts.ACCOUNT_NAME,
                RawContacts.DATA_SET
                RawContacts.DATA_SET,
                Contacts.PHOTO_ID
        };

        public static final int CONTACT_ID = 0;
@@ -296,6 +299,7 @@ public class AggregationSuggestionEngine extends HandlerThread {
        public static final int ACCOUNT_TYPE = 6;
        public static final int ACCOUNT_NAME = 7;
        public static final int DATA_SET = 8;
        public static final int PHOTO_ID = 9;
    }

    private void loadAggregationSuggestions(Uri uri) {
@@ -386,6 +390,7 @@ public class AggregationSuggestionEngine extends HandlerThread {
                if (rawContactId != currentRawContactId) {
                    suggestion = new Suggestion();
                    suggestion.rawContactId = rawContactId;
                    suggestion.photoId = mDataCursor.getLong(DataQuery.PHOTO_ID);
                    suggestion.contactId = mDataCursor.getLong(DataQuery.CONTACT_ID);
                    suggestion.contactLookupKey = mDataCursor.getString(DataQuery.LOOKUP_KEY);
                    final String accountName = mDataCursor.getString(DataQuery.ACCOUNT_NAME);
+4 −9
Original line number Diff line number Diff line
@@ -16,10 +16,8 @@

package com.android.contacts.editor;

import android.content.ContentUris;
import android.content.Context;
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Contacts;
import android.text.TextUtils;
import android.util.AttributeSet;
@@ -65,21 +63,18 @@ public class AggregationSuggestionView extends LinearLayout {
        final ContactPhotoManager.DefaultImageRequest
                request = new ContactPhotoManager.DefaultImageRequest(
                suggestion.name, String.valueOf(suggestion.rawContactId), /* isCircular = */ false);
        final Uri photoUri = Uri.withAppendedPath(ContentUris.withAppendedId(
                ContactsContract.RawContacts.CONTENT_URI, suggestion.rawContactId),
                ContactsContract.RawContacts.DisplayPhoto.CONTENT_DIRECTORY);
        final ImageView photoView = (ImageView) findViewById(
                R.id.aggregation_suggestion_photo);
        ContactPhotoManager.getInstance(getContext()).loadDirectoryPhoto(photoView,
                photoUri,
        ContactPhotoManager.getInstance(getContext()).loadThumbnail(photoView,
                suggestion.photoId,
                /* darkTheme = */ false,
                /* isCircular = */ false,
                request);

        TextView name = (TextView) findViewById(R.id.aggregation_suggestion_name);
        final TextView name = (TextView) findViewById(R.id.aggregation_suggestion_name);
        name.setText(suggestion.name);

        TextView data = (TextView) findViewById(R.id.aggregation_suggestion_data);
        final TextView data = (TextView) findViewById(R.id.aggregation_suggestion_data);
        String dataText = null;
        if (suggestion.nickname != null) {
            dataText = suggestion.nickname;