summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-01-17 10:26:16 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-17 11:25:01 -0800
commitbb41b26b5d8b438f6d163c56e31f0ff3801c7ed0 (patch)
tree0e4f6cf9c383a6183b056440415187f5eca2bf66
parent349ac6070be667aa73c0df3077f3662e46c26c36 (diff)
Correctly show the contact's photo in CallDetailsActivity when launched from the new call log.
Bug: 70218437,71867391 Test: ModulesTest & Manual PiperOrigin-RevId: 182233967 Change-Id: I6eb4bf236230eee6bbecc99b128fef5afddfd1e9
-rw-r--r--java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java4
-rw-r--r--java/com/android/dialer/calllog/ui/menu/Modules.java20
2 files changed, 10 insertions, 14 deletions
diff --git a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
index 604a5e8dc..647c6edb6 100644
--- a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
+++ b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
@@ -136,9 +136,9 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder
ContactPhotoManager.getInstance(context)
.loadDialerThumbnailOrPhoto(
contactPhoto,
- contact.hasContactUri() ? Uri.parse(contact.getContactUri()) : null,
+ contact.getContactUri().isEmpty() ? null : Uri.parse(contact.getContactUri()),
contact.getPhotoId(),
- contact.hasPhotoUri() ? Uri.parse(contact.getPhotoUri()) : null,
+ contact.getPhotoUri().isEmpty() ? null : Uri.parse(contact.getPhotoUri()),
contact.getNameOrNumber(),
contact.getContactType());
diff --git a/java/com/android/dialer/calllog/ui/menu/Modules.java b/java/com/android/dialer/calllog/ui/menu/Modules.java
index 92dd41163..fd0606ee0 100644
--- a/java/com/android/dialer/calllog/ui/menu/Modules.java
+++ b/java/com/android/dialer/calllog/ui/menu/Modules.java
@@ -23,13 +23,13 @@ import android.text.TextUtils;
import com.android.dialer.calldetails.CallDetailsActivity;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.calllog.model.CoalescedRow;
+import com.android.dialer.calllogutils.CallLogContactTypes;
import com.android.dialer.calllogutils.PhoneAccountUtils;
import com.android.dialer.contactactions.ContactActionModule;
import com.android.dialer.contactactions.DividerModule;
import com.android.dialer.contactactions.IntentModule;
import com.android.dialer.contactactions.SharedModules;
import com.android.dialer.dialercontact.DialerContact;
-import com.android.dialer.lettertile.LetterTileDrawable;
import java.util.ArrayList;
import java.util.List;
@@ -125,23 +125,19 @@ final class Modules {
DialerContact.Builder dialerContactBuilder =
DialerContact.newBuilder()
.setNumber(originalNumber)
- .setContactType(LetterTileDrawable.TYPE_DEFAULT) // TODO(zachh): Use proper type.
+ .setContactType(CallLogContactTypes.getContactType(row))
.setPhotoId(row.numberAttributes().getPhotoId());
- if (!TextUtils.isEmpty(row.numberAttributes().getName())) {
+ if (!row.numberAttributes().getName().isEmpty()) {
dialerContactBuilder.setNameOrNumber(row.numberAttributes().getName());
} else if (!TextUtils.isEmpty(originalNumber)) {
dialerContactBuilder.setNameOrNumber(originalNumber);
}
- if (row.numberAttributes().hasNumberTypeLabel()) {
- dialerContactBuilder.setNumberLabel(row.numberAttributes().getNumberTypeLabel());
- }
- if (row.numberAttributes().hasPhotoUri()) {
- dialerContactBuilder.setPhotoUri(row.numberAttributes().getPhotoUri());
- }
- if (row.numberAttributes().hasLookupUri()) {
- dialerContactBuilder.setContactUri(row.numberAttributes().getLookupUri());
- }
+
+ dialerContactBuilder.setNumberLabel(row.numberAttributes().getNumberTypeLabel());
+ dialerContactBuilder.setPhotoUri(row.numberAttributes().getPhotoUri());
+ dialerContactBuilder.setContactUri(row.numberAttributes().getLookupUri());
+
if (row.formattedNumber() != null) {
dialerContactBuilder.setDisplayNumber(row.formattedNumber());
}