summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/contactgrid/ContactGridManager.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/contactgrid/ContactGridManager.java
parentd40d4f09e32ecfc6b95f57bc6d3e3d1703592cd4 (diff)
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/contactgrid/ContactGridManager.java')
-rw-r--r--java/com/android/incallui/contactgrid/ContactGridManager.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java
index 58d318892..6dec7646f 100644
--- a/java/com/android/incallui/contactgrid/ContactGridManager.java
+++ b/java/com/android/incallui/contactgrid/ContactGridManager.java
@@ -85,7 +85,7 @@ public class ContactGridManager {
private final TextView deviceNumberTextView;
private final View deviceNumberDivider;
- private PrimaryInfo primaryInfo = PrimaryInfo.createEmptyPrimaryInfo();
+ private PrimaryInfo primaryInfo = PrimaryInfo.empty();
private PrimaryCallState primaryCallState = PrimaryCallState.createEmptyPrimaryCallState();
private final LetterTileDrawable letterTile;
private boolean isInMultiWindowMode;
@@ -213,7 +213,7 @@ public class ContactGridManager {
}
boolean hasPhoto =
- primaryInfo.photo != null && primaryInfo.photoType == ContactPhotoType.CONTACT;
+ primaryInfo.photo() != null && primaryInfo.photoType() == ContactPhotoType.CONTACT;
if (!hasPhoto && !showAnonymousAvatar) {
avatarImageView.setVisibility(View.GONE);
return false;
@@ -271,17 +271,17 @@ public class ContactGridManager {
* </ul>
*/
private void updatePrimaryNameAndPhoto() {
- if (TextUtils.isEmpty(primaryInfo.name)) {
+ if (TextUtils.isEmpty(primaryInfo.name())) {
contactNameTextView.setText(null);
} else {
contactNameTextView.setText(
- primaryInfo.nameIsNumber
- ? PhoneNumberUtilsCompat.createTtsSpannable(primaryInfo.name)
- : primaryInfo.name);
+ primaryInfo.nameIsNumber()
+ ? PhoneNumberUtilsCompat.createTtsSpannable(primaryInfo.name())
+ : primaryInfo.name());
// Set direction of the name field
int nameDirection = View.TEXT_DIRECTION_INHERIT;
- if (primaryInfo.nameIsNumber) {
+ if (primaryInfo.nameIsNumber()) {
nameDirection = View.TEXT_DIRECTION_LTR;
}
contactNameTextView.setTextDirection(nameDirection);
@@ -292,23 +292,23 @@ public class ContactGridManager {
avatarImageView.setVisibility(View.GONE);
} else if (avatarSize > 0 && updateAvatarVisibility()) {
boolean hasPhoto =
- primaryInfo.photo != null && primaryInfo.photoType == ContactPhotoType.CONTACT;
+ primaryInfo.photo() != null && primaryInfo.photoType() == ContactPhotoType.CONTACT;
// Contact has a photo, don't render a letter tile.
if (hasPhoto) {
avatarImageView.setBackground(
DrawableConverter.getRoundedDrawable(
- context, primaryInfo.photo, avatarSize, avatarSize));
+ context, primaryInfo.photo(), avatarSize, avatarSize));
// Contact has a name, that isn't a number.
} else {
letterTile.setCanonicalDialerLetterTileDetails(
- primaryInfo.name,
- primaryInfo.contactInfoLookupKey,
+ primaryInfo.name(),
+ primaryInfo.contactInfoLookupKey(),
LetterTileDrawable.SHAPE_CIRCLE,
LetterTileDrawable.getContactTypeFromPrimitives(
primaryCallState.isVoiceMailNumber,
- primaryInfo.isSpam,
+ primaryInfo.isSpam(),
primaryCallState.isBusinessNumber,
- primaryInfo.numberPresentation,
+ primaryInfo.numberPresentation(),
primaryCallState.isConference));
// By invalidating the avatarImageView we force a redraw of the letter tile.
// This is required to properly display the updated letter tile iconography based on the
@@ -413,7 +413,7 @@ public class ContactGridManager {
deviceNumberTextView.setText(
context.getString(R.string.contact_grid_callback_number, primaryCallState.callbackNumber));
deviceNumberTextView.setVisibility(View.VISIBLE);
- if (primaryInfo.shouldShowLocation) {
+ if (primaryInfo.shouldShowLocation()) {
deviceNumberDivider.setVisibility(View.VISIBLE);
}
}