Merge "Use photo ids in aggregation suggestions" into ub-contactsdialer-h-dev
diff --git a/src/com/android/contacts/editor/AggregationSuggestionEngine.java b/src/com/android/contacts/editor/AggregationSuggestionEngine.java
index d7d3016..4c45db8 100644
--- a/src/com/android/contacts/editor/AggregationSuggestionEngine.java
+++ b/src/com/android/contacts/editor/AggregationSuggestionEngine.java
@@ -61,6 +61,7 @@
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 @@
.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 @@
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 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 @@
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);
diff --git a/src/com/android/contacts/editor/AggregationSuggestionView.java b/src/com/android/contacts/editor/AggregationSuggestionView.java
index b89f06a..42db014 100644
--- a/src/com/android/contacts/editor/AggregationSuggestionView.java
+++ b/src/com/android/contacts/editor/AggregationSuggestionView.java
@@ -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 @@
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;