summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/contactgrid/ContactGridManager.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-06-05 13:35:02 -0700
committerEric Erfanian <erfanian@google.com>2017-06-07 20:44:54 +0000
commit91ce7d2a476bd04fe525049a37a2f8b2824e9724 (patch)
treeb9bbc285430ffb5363a70eb27e382c38f5a85b7a /java/com/android/incallui/contactgrid/ContactGridManager.java
parent75233ff03785f24789b32039ac2c208805b7e506 (diff)
Update AOSP Dialer source from internal google3 repository at
cl/158012278. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/152373142 (4/06/2017) to cl/158012278 (6/05/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Change-Id: I4d3f14b5140e2e51bead9497bc118a205b3ebe76
Diffstat (limited to 'java/com/android/incallui/contactgrid/ContactGridManager.java')
-rw-r--r--java/com/android/incallui/contactgrid/ContactGridManager.java50
1 files changed, 19 insertions, 31 deletions
diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java
index 1322d58ea..502cc52b8 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;
@@ -78,6 +76,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();
@@ -105,6 +104,7 @@ public class ContactGridManager {
contactGridLayout = (View) contactNameTextView.getParent();
letterTile = new LetterTileDrawable(context.getResources());
+ isTimerStarted = false;
}
public void show() {
@@ -213,7 +213,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 +233,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 +275,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
@@ -363,15 +347,19 @@ public class ContactGridManager {
}
if (info.isTimerVisible) {
- bottomTextSwitcher.setDisplayedChild(1);
- bottomTimerView.setBase(
- primaryCallState.connectTimeMillis
- - System.currentTimeMillis()
- + SystemClock.elapsedRealtime());
- bottomTimerView.start();
+ if (!isTimerStarted) {
+ bottomTextSwitcher.setDisplayedChild(1);
+ bottomTimerView.setBase(
+ primaryCallState.connectTimeMillis
+ - System.currentTimeMillis()
+ + SystemClock.elapsedRealtime());
+ bottomTimerView.start();
+ isTimerStarted = true;
+ }
} else {
bottomTextSwitcher.setDisplayedChild(0);
bottomTimerView.stop();
+ isTimerStarted = false;
}
}
}