summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/contactgrid/ContactGridManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/incallui/contactgrid/ContactGridManager.java')
-rw-r--r--java/com/android/incallui/contactgrid/ContactGridManager.java53
1 files changed, 25 insertions, 28 deletions
diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java
index 1322d58ea..ddf16e340 100644
--- a/java/com/android/incallui/contactgrid/ContactGridManager.java
+++ b/java/com/android/incallui/contactgrid/ContactGridManager.java
@@ -20,10 +20,8 @@ import android.content.Context;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.os.SystemClock;
-import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewCompat;
-import android.telecom.TelecomManager;
import android.text.TextUtils;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
@@ -32,8 +30,9 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.ViewAnimator;
import com.android.contacts.common.compat.PhoneNumberUtilsCompat;
-import com.android.contacts.common.lettertiles.LetterTileDrawable;
import com.android.dialer.common.Assert;
+import com.android.dialer.common.LogUtil;
+import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.util.DrawableConverter;
import com.android.incallui.incall.protocol.ContactPhotoType;
import com.android.incallui.incall.protocol.PrimaryCallState;
@@ -61,7 +60,7 @@ public class ContactGridManager {
@Nullable private ImageView avatarImageView;
// Row 2: Mobile +1 (650) 253-0000
- // Row 2: [HD attempting icon]/[HD icon] 00:15
+ // Row 2: [HD attempting icon]/[HD icon] [Assisted Dialing Icon] 00:15
// Row 2: Call ended
// Row 2: Hanging up
// Row 2: [Alert sign] Suspected spam caller
@@ -69,6 +68,7 @@ public class ContactGridManager {
private final ImageView workIconImageView;
private final ImageView hdIconImageView;
private final ImageView forwardIconImageView;
+ private final ImageView assistedDialingImageView;
private final TextView forwardedNumberView;
private final ImageView spamIconImageView;
private final ViewAnimator bottomTextSwitcher;
@@ -78,6 +78,7 @@ public class ContactGridManager {
private boolean hideAvatar;
private boolean showAnonymousAvatar;
private boolean middleRowVisible = true;
+ private boolean isTimerStarted;
private PrimaryInfo primaryInfo = PrimaryInfo.createEmptyPrimaryInfo();
private PrimaryCallState primaryCallState = PrimaryCallState.createEmptyPrimaryCallState();
@@ -98,6 +99,7 @@ public class ContactGridManager {
hdIconImageView = view.findViewById(R.id.contactgrid_hdIcon);
forwardIconImageView = view.findViewById(R.id.contactgrid_forwardIcon);
forwardedNumberView = view.findViewById(R.id.contactgrid_forwardNumber);
+ assistedDialingImageView = view.findViewById(R.id.contactgrid_assistedDialingIcon);
spamIconImageView = view.findViewById(R.id.contactgrid_spamIcon);
bottomTextSwitcher = view.findViewById(R.id.contactgrid_bottom_text_switcher);
bottomTextView = view.findViewById(R.id.contactgrid_bottom_text);
@@ -105,6 +107,7 @@ public class ContactGridManager {
contactGridLayout = (View) contactNameTextView.getParent();
letterTile = new LetterTileDrawable(context.getResources());
+ isTimerStarted = false;
}
public void show() {
@@ -213,7 +216,7 @@ public class ContactGridManager {
* </ul>
*/
private void updateTopRow() {
- TopRow.Info info = TopRow.getInfo(context, primaryCallState);
+ TopRow.Info info = TopRow.getInfo(context, primaryCallState, primaryInfo);
if (TextUtils.isEmpty(info.label)) {
// Use INVISIBLE here to prevent the rows below this one from moving up and down.
statusTextView.setVisibility(View.INVISIBLE);
@@ -233,26 +236,6 @@ public class ContactGridManager {
}
/**
- * Returns the appropriate LetterTileDrawable.TYPE_ based on a given call state.
- *
- * <p>If no special state is detected, yields TYPE_DEFAULT.
- */
- private static @LetterTileDrawable.ContactType int getContactTypeForPrimaryCallState(
- @NonNull PrimaryCallState callState, @NonNull PrimaryInfo primaryInfo) {
- if (callState.isVoiceMailNumber) {
- return LetterTileDrawable.TYPE_VOICEMAIL;
- } else if (callState.isBusinessNumber) {
- return LetterTileDrawable.TYPE_BUSINESS;
- } else if (primaryInfo.numberPresentation == TelecomManager.PRESENTATION_RESTRICTED) {
- return LetterTileDrawable.TYPE_GENERIC_AVATAR;
- } else if (callState.isConference) {
- return LetterTileDrawable.TYPE_CONFERENCE;
- } else {
- return LetterTileDrawable.TYPE_DEFAULT;
- }
- }
-
- /**
* Updates row 1. For example:
*
* <ul>
@@ -295,8 +278,12 @@ public class ContactGridManager {
primaryInfo.name,
primaryInfo.contactInfoLookupKey,
LetterTileDrawable.SHAPE_CIRCLE,
- getContactTypeForPrimaryCallState(primaryCallState, primaryInfo));
-
+ LetterTileDrawable.getContactTypeFromPrimitives(
+ primaryCallState.isVoiceMailNumber,
+ primaryInfo.isSpam,
+ primaryCallState.isBusinessNumber,
+ 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
// contact type, because the background drawable reference cached in the view, and the
@@ -324,6 +311,8 @@ public class ContactGridManager {
bottomTextView.setText(info.label);
bottomTextView.setAllCaps(info.isSpamIconVisible);
workIconImageView.setVisibility(info.isWorkIconVisible ? View.VISIBLE : View.GONE);
+ assistedDialingImageView.setVisibility(
+ info.isAssistedDialedVisisble ? View.VISIBLE : View.GONE);
if (hdIconImageView.getVisibility() == View.GONE) {
if (info.isHdAttemptingIconVisible) {
hdIconImageView.setVisibility(View.VISIBLE);
@@ -368,10 +357,18 @@ public class ContactGridManager {
primaryCallState.connectTimeMillis
- System.currentTimeMillis()
+ SystemClock.elapsedRealtime());
- bottomTimerView.start();
+ if (!isTimerStarted) {
+ LogUtil.i(
+ "ContactGridManager.updateBottomRow",
+ "starting timer with base: %d",
+ bottomTimerView.getBase());
+ bottomTimerView.start();
+ isTimerStarted = true;
+ }
} else {
bottomTextSwitcher.setDisplayedChild(0);
bottomTimerView.stop();
+ isTimerStarted = false;
}
}
}