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

Commit 59903ba1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use photo ids in aggregation suggestions" into ub-contactsdialer-h-dev

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


        public static final int CONTACT_ID = 0;
        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_TYPE = 6;
        public static final int ACCOUNT_NAME = 7;
        public static final int ACCOUNT_NAME = 7;
        public static final int DATA_SET = 8;
        public static final int DATA_SET = 8;
        public static final int PHOTO_ID = 9;
    }
    }


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


package com.android.contacts.editor;
package com.android.contacts.editor;


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


        TextView name = (TextView) findViewById(R.id.aggregation_suggestion_name);
        final TextView name = (TextView) findViewById(R.id.aggregation_suggestion_name);
        name.setText(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;
        String dataText = null;
        if (suggestion.nickname != null) {
        if (suggestion.nickname != null) {
            dataText = suggestion.nickname;
            dataText = suggestion.nickname;