summaryrefslogtreecommitdiffstats
path: root/java/com/android/incallui/CallCardPresenter.java
diff options
context:
space:
mode:
authorAndroid Dialer <noreply@google.com>2018-02-21 08:05:14 -0800
committerEric Erfanian <erfanian@google.com>2018-02-22 21:11:26 +0000
commitf94391034e9d591c18d04c0b796d944938201f6a (patch)
treec8c81409022b07bf62841df8bfc29f65b5e280cf /java/com/android/incallui/CallCardPresenter.java
parentd40d4f09e32ecfc6b95f57bc6d3e3d1703592cd4 (diff)
downloadandroid_packages_apps_Dialer-f94391034e9d591c18d04c0b796d944938201f6a.tar.gz
android_packages_apps_Dialer-f94391034e9d591c18d04c0b796d944938201f6a.tar.bz2
android_packages_apps_Dialer-f94391034e9d591c18d04c0b796d944938201f6a.zip
Updating PrimaryInfo value class to use AutoValue with builder pattern.
Bug: 34502119 Test: BottomRowTest,CallCardPresenterTest,PrimaryInfoTest,TopRowTest PiperOrigin-RevId: 186460178 Change-Id: Ifb90019b6a5568788d51f4a55a07f7693c803eaf
Diffstat (limited to 'java/com/android/incallui/CallCardPresenter.java')
-rw-r--r--java/com/android/incallui/CallCardPresenter.java86
1 files changed, 43 insertions, 43 deletions
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index da5d1a8dd..b945b0810 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -690,7 +690,7 @@ public class CallCardPresenter
if (primary == null) {
// Clear the primary display info.
- inCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo());
+ inCallScreen.setPrimary(PrimaryInfo.empty());
return;
}
@@ -713,26 +713,22 @@ public class CallCardPresenter
"update primary display info for conference call.");
inCallScreen.setPrimary(
- new PrimaryInfo(
- null /* number */,
- CallerInfoUtils.getConferenceString(
- context, primary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)),
- false /* nameIsNumber */,
- null /* location */,
- null /* label */,
- null /* photo */,
- ContactPhotoType.DEFAULT_PLACEHOLDER,
- false /* isSipCall */,
- showContactPhoto,
- hasWorkCallProperty,
- false /* isSpam */,
- false /* isLocalContact */,
- false /* answeringDisconnectsOngoingCall */,
- shouldShowLocation(),
- null /* contactInfoLookupKey */,
- null /* enrichedCallMultimediaData */,
- true /* showInCallButtonGrid */,
- primary.getNumberPresentation()));
+ PrimaryInfo.builder()
+ .setName(
+ CallerInfoUtils.getConferenceString(
+ context, primary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)))
+ .setNameIsNumber(false)
+ .setPhotoType(ContactPhotoType.DEFAULT_PLACEHOLDER)
+ .setIsSipCall(false)
+ .setIsContactPhotoShown(showContactPhoto)
+ .setIsWorkCall(hasWorkCallProperty)
+ .setIsSpam(false)
+ .setIsLocalContact(false)
+ .setAnsweringDisconnectsOngoingCall(false)
+ .setShouldShowLocation(shouldShowLocation())
+ .setShowInCallButtonGrid(true)
+ .setNumberPresentation(primary.getNumberPresentation())
+ .build());
} else if (primaryContactInfo != null) {
LogUtil.v(
"CallCardPresenter.updatePrimaryDisplayInfo",
@@ -761,30 +757,33 @@ public class CallCardPresenter
// DialerCall with caller that is a work contact.
boolean isWorkContact = (primaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK);
inCallScreen.setPrimary(
- new PrimaryInfo(
- number,
- primary.updateNameIfRestricted(name),
- nameIsNumber,
- shouldShowLocationAsLabel(nameIsNumber, primaryContactInfo.shouldShowLocation)
- ? primaryContactInfo.location
- : null,
- isChildNumberShown || isCallSubjectShown ? null : primaryContactInfo.label,
- primaryContactInfo.photo,
- primaryContactInfo.photoType,
- primaryContactInfo.isSipCall,
- showContactPhoto,
- hasWorkCallProperty || isWorkContact,
- primary.isSpam(),
- primaryContactInfo.isLocalContact(),
- primary.answeringDisconnectsForegroundVideoCall(),
- shouldShowLocation(),
- primaryContactInfo.lookupKey,
- multimediaData,
- true /* showInCallButtonGrid */,
- primary.getNumberPresentation()));
+ PrimaryInfo.builder()
+ .setNumber(number)
+ .setName(primary.updateNameIfRestricted(name))
+ .setNameIsNumber(nameIsNumber)
+ .setLabel(
+ shouldShowLocationAsLabel(nameIsNumber, primaryContactInfo.shouldShowLocation)
+ ? primaryContactInfo.location
+ : null)
+ .setLocation(
+ isChildNumberShown || isCallSubjectShown ? null : primaryContactInfo.label)
+ .setPhoto(primaryContactInfo.photo)
+ .setPhotoType(primaryContactInfo.photoType)
+ .setIsSipCall(primaryContactInfo.isSipCall)
+ .setIsContactPhotoShown(showContactPhoto)
+ .setIsWorkCall(hasWorkCallProperty || isWorkContact)
+ .setIsSpam(primary.isSpam())
+ .setIsLocalContact(primaryContactInfo.isLocalContact())
+ .setAnsweringDisconnectsOngoingCall(primary.answeringDisconnectsForegroundVideoCall())
+ .setShouldShowLocation(shouldShowLocation())
+ .setContactInfoLookupKey(primaryContactInfo.lookupKey)
+ .setMultimediaData(multimediaData)
+ .setShowInCallButtonGrid(true)
+ .setNumberPresentation(primary.getNumberPresentation())
+ .build());
} else {
// Clear the primary display info.
- inCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo());
+ inCallScreen.setPrimary(PrimaryInfo.empty());
}
if (isInCallScreenReady) {
@@ -1192,6 +1191,7 @@ public class CallCardPresenter
return inCallScreen;
}
+ /** Callback for contact lookup. */
public static class ContactLookupCallback implements ContactInfoCacheCallback {
private final WeakReference<CallCardPresenter> callCardPresenter;