summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-02-21 10:02:18 -0800
committerYorke Lee <yorkelee@google.com>2014-02-28 16:30:47 -0800
commit56cb0efa5eda1670077e66fc0e8c79478d0c1c67 (patch)
treeda64925c0d47acb56889f3226859b4843bf0dcfe
parent8b58491588d5128f23e5a6eee37baad77839b2ca (diff)
downloadandroid_packages_apps_Dialer-56cb0efa5eda1670077e66fc0e8c79478d0c1c67.tar.gz
android_packages_apps_Dialer-56cb0efa5eda1670077e66fc0e8c79478d0c1c67.tar.bz2
android_packages_apps_Dialer-56cb0efa5eda1670077e66fc0e8c79478d0c1c67.zip
Use new ContactPhotoManager APIs for letter tile avatars
*Modify the following uses of ContactPhotoManager.loadPhoto in the following classes to include a DefaultImageRequest, populated with the contact's display name, lookupkey, and contact type as necessary CallDetailActivity CallLogAdapter PhoneFavoriteTileView *Add utility methods to ContactInfoHelper, to parse a lookupUri for a lookup key, as well as determine whether or not a contact is a business contact, from its sourceType field. *Add a sourceType field to PhoneCallDetails which can be used to track whether or not PhoneCallDetails belongs to a business contact *Add a lookupKey field to ContactInfo Bug: 13101785 Change-Id: If339a9c038f92a0212f8f8b45b5e3cc5f6442562
-rw-r--r--src/com/android/dialer/CallDetailActivity.java41
-rw-r--r--src/com/android/dialer/PhoneCallDetails.java9
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java52
-rw-r--r--src/com/android/dialer/calllog/ContactInfo.java1
-rw-r--r--src/com/android/dialer/calllog/ContactInfoHelper.java85
-rw-r--r--src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java2
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteTileView.java14
-rw-r--r--src/com/android/dialer/list/PhoneFavoritesTileAdapter.java7
-rw-r--r--src/com/android/dialer/service/CachedNumberLookupService.java2
-rw-r--r--tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java2
10 files changed, 159 insertions, 56 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index 2b6566fa5..e09e6f302 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -32,6 +32,7 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.CallLog;
+import android.provider.ContactsContract;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Contacts;
@@ -56,6 +57,7 @@ import android.widget.Toast;
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.CallUtil;
import com.android.contacts.common.ClipboardUtils;
+import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.model.Contact;
import com.android.contacts.common.model.ContactLoader;
@@ -545,14 +547,14 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
mainActionDescription);
}
+ final CharSequence displayNumber =
+ mPhoneNumberHelper.getDisplayNumber(
+ firstDetails.number,
+ firstDetails.numberPresentation,
+ firstDetails.formattedNumber);
+
// This action allows to call the number that places the call.
if (canPlaceCallsTo) {
- final CharSequence displayNumber =
- mPhoneNumberHelper.getDisplayNumber(
- firstDetails.number,
- firstDetails.numberPresentation,
- firstDetails.formattedNumber);
-
ViewEntry entry = new ViewEntry(
getString(R.string.menu_callNumber,
forceLeftToRight(displayNumber)),
@@ -623,7 +625,20 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
}
},
historyList);
- loadContactPhotos(photoUri);
+
+ final String displayNameForDefaultImage = TextUtils.isEmpty(firstDetails.name) ?
+ displayNumber.toString() : firstDetails.name.toString();
+
+ final String lookupKey = ContactInfoHelper.getLookupKeyFromUri(contactUri);
+
+ final boolean isBusiness = mContactInfoHelper.isBusiness(firstDetails.sourceType);
+
+ final int contactType =
+ isVoicemailNumber? ContactPhotoManager.TYPE_VOICEMAIL :
+ isBusiness ? ContactPhotoManager.TYPE_BUSINESS :
+ ContactPhotoManager.TYPE_DEFAULT;
+
+ loadContactPhotos(photoUri, displayNameForDefaultImage, lookupKey, contactType);
findViewById(R.id.call_detail).setVisibility(View.VISIBLE);
}
}
@@ -690,6 +705,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
final CharSequence numberLabel;
final Uri photoUri;
final Uri lookupUri;
+ int sourceType;
// If this is not a regular number, there is no point in looking it up in the contacts.
ContactInfo info =
PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)
@@ -704,6 +720,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
numberLabel = "";
photoUri = null;
lookupUri = null;
+ sourceType = 0;
} else {
formattedNumber = info.formattedNumber;
nameText = info.name;
@@ -711,11 +728,12 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
numberLabel = info.label;
photoUri = info.photoUri;
lookupUri = info.lookupUri;
+ sourceType = info.sourceType;
}
return new PhoneCallDetails(number, numberPresentation,
formattedNumber, countryIso, geocode,
new int[]{ callType }, date, duration,
- nameText, numberType, numberLabel, lookupUri, photoUri);
+ nameText, numberType, numberLabel, lookupUri, photoUri, sourceType);
} finally {
if (callCursor != null) {
callCursor.close();
@@ -724,9 +742,12 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
}
/** Load the contact photos and places them in the corresponding views. */
- private void loadContactPhotos(Uri photoUri) {
+ private void loadContactPhotos(Uri photoUri, String displayName, String lookupKey,
+ int contactType) {
+ final DefaultImageRequest request = new DefaultImageRequest(displayName, lookupKey,
+ contactType);
mContactPhotoManager.loadPhoto(mContactBackgroundView, photoUri,
- mContactBackgroundView.getWidth(), true);
+ mContactBackgroundView.getWidth(), true, request);
}
static final class ViewEntry {
diff --git a/src/com/android/dialer/PhoneCallDetails.java b/src/com/android/dialer/PhoneCallDetails.java
index c380b6554..4e01ab5a4 100644
--- a/src/com/android/dialer/PhoneCallDetails.java
+++ b/src/com/android/dialer/PhoneCallDetails.java
@@ -59,13 +59,17 @@ public class PhoneCallDetails {
* This is meant to store the high-res photo only.
*/
public final Uri photoUri;
+ /**
+ * The source type of the contact associated with this call.
+ */
+ public final int sourceType;
/** Create the details for a call with a number not associated with a contact. */
public PhoneCallDetails(CharSequence number, int numberPresentation,
CharSequence formattedNumber, String countryIso, String geocode,
int[] callTypes, long date, long duration) {
this(number, numberPresentation, formattedNumber, countryIso, geocode,
- callTypes, date, duration, "", 0, "", null, null);
+ callTypes, date, duration, "", 0, "", null, null, 0);
}
/** Create the details for a call with a number associated with a contact. */
@@ -73,7 +77,7 @@ public class PhoneCallDetails {
CharSequence formattedNumber, String countryIso, String geocode,
int[] callTypes, long date, long duration, CharSequence name,
int numberType, CharSequence numberLabel, Uri contactUri,
- Uri photoUri) {
+ Uri photoUri, int sourceType) {
this.number = number;
this.numberPresentation = numberPresentation;
this.formattedNumber = formattedNumber;
@@ -87,5 +91,6 @@ public class PhoneCallDetails {
this.numberLabel = numberLabel;
this.contactUri = contactUri;
this.photoUri = photoUri;
+ this.sourceType = sourceType;
}
}
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 32699e654..175a7331d 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -27,6 +27,7 @@ import android.os.Message;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.PhoneLookup;
import android.text.TextUtils;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -37,11 +38,13 @@ import android.widget.TextView;
import com.android.common.widget.GroupingListAdapter;
import com.android.contacts.common.ContactPhotoManager;
+import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.util.UriUtils;
import com.android.dialer.PhoneCallDetails;
import com.android.dialer.PhoneCallDetailsHelper;
import com.android.dialer.R;
import com.android.dialer.util.ExpirableCache;
+
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
@@ -537,6 +540,9 @@ public class CallLogAdapter extends GroupingListAdapter
final ContactInfo cachedContactInfo = getContactInfoFromCallLog(c);
+ final boolean isVoicemailNumber =
+ PhoneNumberUtilsWrapper.INSTANCE.isVoicemailNumber(number);
+
// Primary action is always to call, if possible.
if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)) {
// Sets the primary action to call the number.
@@ -569,7 +575,7 @@ public class CallLogAdapter extends GroupingListAdapter
mContactInfoCache.getCachedValue(numberCountryIso);
ContactInfo info = cachedInfo == null ? null : cachedInfo.getValue();
if (!PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)
- || new PhoneNumberUtilsWrapper().isVoicemailNumber(number)) {
+ || isVoicemailNumber) {
// If this is a number that cannot be dialed, there is no point in looking up a contact
// for it.
info = ContactInfo.EMPTY;
@@ -609,6 +615,7 @@ public class CallLogAdapter extends GroupingListAdapter
CharSequence formattedNumber = info.formattedNumber;
final int[] callTypes = getCallTypes(c, count);
final String geocode = c.getString(CallLogQuery.GEOCODED_LOCATION);
+ final int sourceType = info.sourceType;
final PhoneCallDetails details;
if (TextUtils.isEmpty(name)) {
@@ -618,7 +625,7 @@ public class CallLogAdapter extends GroupingListAdapter
} else {
details = new PhoneCallDetails(number, numberPresentation,
formattedNumber, countryIso, geocode, callTypes, date,
- duration, name, ntype, label, lookupUri, photoUri);
+ duration, name, ntype, label, lookupUri, photoUri, sourceType);
}
final boolean isNew = c.getInt(CallLogQuery.IS_READ) == 0;
@@ -627,10 +634,32 @@ public class CallLogAdapter extends GroupingListAdapter
mCallLogViewsHelper.setPhoneCallDetails(views, details, isHighlighted,
mShowSecondaryActionButton);
+ int contactType = ContactPhotoManager.TYPE_DEFAULT;
+
+ if (isVoicemailNumber) {
+ contactType = ContactPhotoManager.TYPE_VOICEMAIL;
+ } else if (mContactInfoHelper.isBusiness(info.sourceType)) {
+ contactType = ContactPhotoManager.TYPE_BUSINESS;
+ }
+
+ String lookupKey = info.lookupKey;
+ if (lookupUri != null) {
+ //lookupKey = ContactInfoHelper.getLookupKeyFromUri(lookupUri);
+
+ }
+
+ String nameForDefaultImage = null;
+ if (TextUtils.isEmpty(name)) {
+ nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(details.number,
+ details.numberPresentation, details.formattedNumber).toString();
+ } else {
+ nameForDefaultImage = name;
+ }
+
if (photoId == 0 && photoUri != null) {
- setPhoto(views, photoUri, lookupUri);
+ setPhoto(views, photoUri, lookupUri, nameForDefaultImage, lookupKey, contactType);
} else {
- setPhoto(views, photoId, lookupUri);
+ setPhoto(views, photoId, lookupUri, nameForDefaultImage, lookupKey, contactType);
}
// Listen for the first draw
@@ -853,15 +882,22 @@ public class CallLogAdapter extends GroupingListAdapter
return callTypes;
}
- private void setPhoto(CallLogListItemViews views, long photoId, Uri contactUri) {
+ private void setPhoto(CallLogListItemViews views, long photoId, Uri contactUri,
+ String displayName, String identifier, int contactType) {
views.quickContactView.assignContactUri(contactUri);
- mContactPhotoManager.loadThumbnail(views.quickContactView, photoId, false /* darkTheme */);
+ DefaultImageRequest request = new DefaultImageRequest(displayName, identifier,
+ contactType);
+ mContactPhotoManager.loadThumbnail(views.quickContactView, photoId, false /* darkTheme */,
+ request);
}
- private void setPhoto(CallLogListItemViews views, Uri photoUri, Uri contactUri) {
+ private void setPhoto(CallLogListItemViews views, Uri photoUri, Uri contactUri,
+ String displayName, String identifier, int contactType) {
views.quickContactView.assignContactUri(contactUri);
+ DefaultImageRequest request = new DefaultImageRequest(displayName, identifier,
+ contactType);
mContactPhotoManager.loadDirectoryPhoto(views.quickContactView, photoUri,
- false /* darkTheme */);
+ false /* darkTheme */, request);
}
diff --git a/src/com/android/dialer/calllog/ContactInfo.java b/src/com/android/dialer/calllog/ContactInfo.java
index 601f55289..41afa5a77 100644
--- a/src/com/android/dialer/calllog/ContactInfo.java
+++ b/src/com/android/dialer/calllog/ContactInfo.java
@@ -27,6 +27,7 @@ import com.google.common.base.Objects;
*/
public class ContactInfo {
public Uri lookupUri;
+ public String lookupKey;
public String name;
public int type;
public String label;
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index d248c70c8..84ce27e49 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -1,17 +1,15 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package com.android.dialer.calllog;
@@ -37,6 +35,8 @@ import com.android.dialerbind.ObjectFactory;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.List;
+
/**
* Utility class to look up the contact information for a given number.
*/
@@ -101,7 +101,7 @@ public class ContactInfoHelper {
updatedInfo = new ContactInfo();
updatedInfo.number = number;
updatedInfo.formattedNumber = formatPhoneNumber(number, null, countryIso);
- updatedInfo.lookupUri = createTemporaryContactUri(number);
+ updatedInfo.lookupUri = createTemporaryContactUri(updatedInfo.formattedNumber);
} else {
updatedInfo = info;
}
@@ -113,23 +113,20 @@ public class ContactInfoHelper {
* Creates a JSON-encoded lookup uri for a unknown number without an associated contact
*
* @param number - Unknown phone number
- * @return JSON-encoded URI that can be used to perform a lookup when clicking
- * on the quick contact card.
+ * @return JSON-encoded URI that can be used to perform a lookup when clicking on the quick
+ * contact card.
*/
private static Uri createTemporaryContactUri(String number) {
try {
- final JSONObject contactRows = new JSONObject()
- .put(Phone.CONTENT_ITEM_TYPE, new JSONObject()
- .put(Phone.NUMBER, number)
- .put(Phone.TYPE, Phone.TYPE_CUSTOM));
+ final JSONObject contactRows = new JSONObject().put(Phone.CONTENT_ITEM_TYPE,
+ new JSONObject().put(Phone.NUMBER, number).put(Phone.TYPE, Phone.TYPE_CUSTOM));
- final String jsonString = new JSONObject()
- .put(Contacts.DISPLAY_NAME, number)
- .put(Contacts.DISPLAY_NAME_SOURCE, DisplayNameSources.PHONE)
- .put(Contacts.CONTENT_ITEM_TYPE, contactRows)
- .toString();
+ final String jsonString = new JSONObject().put(Contacts.DISPLAY_NAME, number)
+ .put(Contacts.DISPLAY_NAME_SOURCE, DisplayNameSources.PHONE)
+ .put(Contacts.CONTENT_ITEM_TYPE, contactRows).toString();
- return Contacts.CONTENT_LOOKUP_URI.buildUpon()
+ return Contacts.CONTENT_LOOKUP_URI
+ .buildUpon()
.appendPath(Constants.LOOKUP_URI_ENCODED)
.appendQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY,
String.valueOf(Long.MAX_VALUE))
@@ -152,8 +149,7 @@ public class ContactInfoHelper {
private ContactInfo lookupContactFromUri(Uri uri) {
final ContactInfo info;
Cursor phonesCursor =
- mContext.getContentResolver().query(
- uri, PhoneQuery._PROJECTION, null, null, null);
+ mContext.getContentResolver().query(uri, PhoneQuery._PROJECTION, null, null, null);
if (phonesCursor != null) {
try {
@@ -161,6 +157,7 @@ public class ContactInfoHelper {
info = new ContactInfo();
long contactId = phonesCursor.getLong(PhoneQuery.PERSON_ID);
String lookupKey = phonesCursor.getString(PhoneQuery.LOOKUP_KEY);
+ info.lookupKey = lookupKey;
info.lookupUri = Contacts.getLookupUri(contactId, lookupKey);
info.name = phonesCursor.getString(PhoneQuery.NAME);
info.type = phonesCursor.getInt(PhoneQuery.PHONE_TYPE);
@@ -230,8 +227,8 @@ public class ContactInfoHelper {
if (info != null && info != ContactInfo.EMPTY) {
info.formattedNumber = formatPhoneNumber(number, null, countryIso);
} else if (mCachedNumberLookupService != null) {
- CachedContactInfo cacheInfo = mCachedNumberLookupService
- .lookupCachedContactFromNumber(mContext, number);
+ CachedContactInfo cacheInfo =
+ mCachedNumberLookupService.lookupCachedContactFromNumber(mContext, number);
info = cacheInfo != null ? cacheInfo.getContactInfo() : null;
}
return info;
@@ -242,14 +239,12 @@ public class ContactInfoHelper {
*
* @param number the number to be formatted.
* @param normalizedNumber the normalized number of the given number.
- * @param countryIso the ISO 3166-1 two letters country code, the country's
- * convention will be used to format the number if the normalized
- * phone is null.
+ * @param countryIso the ISO 3166-1 two letters country code, the country's convention will be
+ * used to format the number if the normalized phone is null.
*
* @return the formatted number, or the given number if it was formatted.
*/
- private String formatPhoneNumber(String number, String normalizedNumber,
- String countryIso) {
+ private String formatPhoneNumber(String number, String normalizedNumber, String countryIso) {
if (TextUtils.isEmpty(number)) {
return "";
}
@@ -262,4 +257,32 @@ public class ContactInfoHelper {
}
return PhoneNumberUtils.formatNumber(number, normalizedNumber, countryIso);
}
+
+ /**
+ * Parses the given URI to determine the original lookup key of the contact.
+ */
+ public static String getLookupKeyFromUri(Uri lookupUri) {
+ // Would be nice to be able to persist the lookup key somehow to avoid having to parse
+ // the uri entirely just to retrieve the lookup key, but every uri is already parsed
+ // once anyway to check if it is an encoded JSON uri, so this has negligible effect
+ // on performance.
+ if (lookupUri != null && !UriUtils.isEncodedContactUri(lookupUri)) {
+ final List<String> segments = lookupUri.getPathSegments();
+ // This returns the third path segment of the uri, where the lookup key is located.
+ // See {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}.
+ return (segments.size() < 3) ? null : segments.get(2);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Given a contact's sourceType, return true if the contact is a business
+ *
+ * @param sourceType sourceType of the contact. This is usually populated by
+ * {@link #mCachedNumberLookupService}.
+ */
+ public boolean isBusiness(int sourceType) {
+ return mCachedNumberLookupService.isBusiness(sourceType);
+ }
}
diff --git a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
index 9c8376853..00a260a25 100644
--- a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
+++ b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
@@ -30,7 +30,7 @@ import java.util.Set;
*
*/
public class PhoneNumberUtilsWrapper {
- private static final PhoneNumberUtilsWrapper INSTANCE = new PhoneNumberUtilsWrapper();
+ public static final PhoneNumberUtilsWrapper INSTANCE = new PhoneNumberUtilsWrapper();
private static final Set<String> LEGACY_UNKNOWN_NUMBERS = Sets.newHashSet("-1", "-2", "-3");
/** Returns true if it is possible to place a call to the given number. */
diff --git a/src/com/android/dialer/list/PhoneFavoriteTileView.java b/src/com/android/dialer/list/PhoneFavoriteTileView.java
index 9d7dd5e93..697a48113 100644
--- a/src/com/android/dialer/list/PhoneFavoriteTileView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteTileView.java
@@ -30,7 +30,9 @@ import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
+import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.MoreContactUtils;
+import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.list.ContactEntry;
import com.android.contacts.common.list.ContactTileView;
import com.android.dialer.R;
@@ -49,6 +51,12 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
private static final String TAG = PhoneFavoriteTileView.class.getSimpleName();
private static final boolean DEBUG = false;
+ // These parameters instruct the photo manager to display the default image/letter at 80% of
+ // its normal size, and vertically offset upwards 20% towards the top of the letter tile, to
+ // make room for the contact name and number label at the bottom of the image.
+ private static final float DEFAULT_IMAGE_LETTER_OFFSET = -0.2f;
+ private static final float DEFAULT_IMAGE_LETTER_SCALE = 0.8f;
+
/** Length of all animations in miniseconds. */
private int mAnimationDuration;
@@ -236,4 +244,10 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
}
};
}
+
+ @Override
+ protected DefaultImageRequest getDefaultImageRequest(String displayName, String lookupKey) {
+ return new DefaultImageRequest(displayName, lookupKey, ContactPhotoManager.TYPE_DEFAULT,
+ DEFAULT_IMAGE_LETTER_SCALE, DEFAULT_IMAGE_LETTER_OFFSET);
+ }
}
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 45cc5a371..d1ac9557c 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -298,7 +298,8 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
contact.name = (!TextUtils.isEmpty(name)) ? name :
mResources.getString(R.string.missing_name);
contact.photoUri = (photoUri != null ? Uri.parse(photoUri) : null);
- contact.lookupKey = ContentUris.withAppendedId(
+ contact.lookupKey = lookupKey;
+ contact.lookupUri = ContentUris.withAppendedId(
Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), id);
contact.isFavorite = isStarred;
contact.isDefaultNumber = isDefaultNumber;
@@ -667,7 +668,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
boolean removed = false;
if (isIndexInBound(mPotentialRemoveEntryIndex)) {
final ContactEntry entry = mContactEntries.get(mPotentialRemoveEntryIndex);
- unstarAndUnpinContact(entry.lookupKey);
+ unstarAndUnpinContact(entry.lookupUri);
removed = true;
mAwaitingRemove = true;
}
@@ -1234,7 +1235,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
@Override
public void onDroppedOnRemove() {
if (mDraggedEntry != null) {
- unstarAndUnpinContact(mDraggedEntry.lookupKey);
+ unstarAndUnpinContact(mDraggedEntry.lookupUri);
mAwaitingRemove = true;
}
}
diff --git a/src/com/android/dialer/service/CachedNumberLookupService.java b/src/com/android/dialer/service/CachedNumberLookupService.java
index 5745c9ded..73fd8950e 100644
--- a/src/com/android/dialer/service/CachedNumberLookupService.java
+++ b/src/com/android/dialer/service/CachedNumberLookupService.java
@@ -33,6 +33,8 @@ public interface CachedNumberLookupService {
public boolean isCacheUri(String uri);
+ public boolean isBusiness(int sourceType);
+
public boolean addPhoto(Context context, String number, byte[] photo);
/**
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
index 6f5a98658..9b7d9de13 100644
--- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
@@ -335,6 +335,6 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION,
- name, 0, "", null, null));
+ name, 0, "", null, null, 0));
}
}