summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/contactgrid
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/incallui/contactgrid')
-rw-r--r--java/com/android/incallui/contactgrid/BottomRow.java18
-rw-r--r--java/com/android/incallui/contactgrid/ContactGridManager.java15
-rw-r--r--java/com/android/incallui/contactgrid/TopRow.java65
3 files changed, 50 insertions, 48 deletions
diff --git a/java/com/android/incallui/contactgrid/BottomRow.java b/java/com/android/incallui/contactgrid/BottomRow.java
index 610eeca39..dc86d819b 100644
--- a/java/com/android/incallui/contactgrid/BottomRow.java
+++ b/java/com/android/incallui/contactgrid/BottomRow.java
@@ -74,11 +74,11 @@ public class BottomRow {
public static Info getInfo(Context context, PrimaryCallState state, PrimaryInfo primaryInfo) {
CharSequence label;
- boolean isTimerVisible = state.state == State.ACTIVE;
- boolean isForwardIconVisible = state.isForwardedNumber;
- boolean isWorkIconVisible = state.isWorkCall;
- boolean isHdIconVisible = state.isHdAudioCall && !isForwardIconVisible;
- boolean isHdAttemptingIconVisible = state.isHdAttempting;
+ boolean isTimerVisible = state.state() == State.ACTIVE;
+ boolean isForwardIconVisible = state.isForwardedNumber();
+ boolean isWorkIconVisible = state.isWorkCall();
+ boolean isHdIconVisible = state.isHdAudioCall() && !isForwardIconVisible;
+ boolean isHdAttemptingIconVisible = state.isHdAttempting();
boolean isSpamIconVisible = false;
boolean shouldPopulateAccessibilityEvent = true;
@@ -86,14 +86,14 @@ public class BottomRow {
label = context.getString(R.string.contact_grid_incoming_suspected_spam);
isSpamIconVisible = true;
isHdIconVisible = false;
- } else if (state.state == State.DISCONNECTING) {
+ } else if (state.state() == State.DISCONNECTING) {
// While in the DISCONNECTING state we display a "Hanging up" message in order to make the UI
// feel more responsive. (In GSM it's normal to see a delay of a couple of seconds while
// negotiating the disconnect with the network, so the "Hanging up" state at least lets the
// user know that we're doing something. This state is currently not used with CDMA.)
label = context.getString(R.string.incall_hanging_up);
- } else if (state.state == State.DISCONNECTED) {
- label = state.disconnectCause.getLabel();
+ } else if (state.state() == State.DISCONNECTED) {
+ label = state.disconnectCause().getLabel();
if (TextUtils.isEmpty(label)) {
label = context.getString(R.string.incall_call_ended);
}
@@ -134,6 +134,6 @@ public class BottomRow {
}
private static boolean isIncoming(PrimaryCallState state) {
- return state.state == State.INCOMING || state.state == State.CALL_WAITING;
+ return state.state() == State.INCOMING || state.state() == State.CALL_WAITING;
}
}
diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java
index 6dec7646f..1b76958dc 100644
--- a/java/com/android/incallui/contactgrid/ContactGridManager.java
+++ b/java/com/android/incallui/contactgrid/ContactGridManager.java
@@ -86,7 +86,7 @@ public class ContactGridManager {
private final View deviceNumberDivider;
private PrimaryInfo primaryInfo = PrimaryInfo.empty();
- private PrimaryCallState primaryCallState = PrimaryCallState.createEmptyPrimaryCallState();
+ private PrimaryCallState primaryCallState = PrimaryCallState.empty();
private final LetterTileDrawable letterTile;
private boolean isInMultiWindowMode;
@@ -305,11 +305,11 @@ public class ContactGridManager {
primaryInfo.contactInfoLookupKey(),
LetterTileDrawable.SHAPE_CIRCLE,
LetterTileDrawable.getContactTypeFromPrimitives(
- primaryCallState.isVoiceMailNumber,
+ primaryCallState.isVoiceMailNumber(),
primaryInfo.isSpam(),
- primaryCallState.isBusinessNumber,
+ primaryCallState.isBusinessNumber(),
primaryInfo.numberPresentation(),
- primaryCallState.isConference));
+ 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
@@ -381,7 +381,7 @@ public class ContactGridManager {
if (info.isTimerVisible) {
bottomTextSwitcher.setDisplayedChild(1);
bottomTimerView.setBase(
- primaryCallState.connectTimeMillis
+ primaryCallState.connectTimeMillis()
- System.currentTimeMillis()
+ SystemClock.elapsedRealtime());
if (!isTimerStarted) {
@@ -404,14 +404,15 @@ public class ContactGridManager {
if (deviceNumberTextView == null) {
return;
}
- if (isInMultiWindowMode || TextUtils.isEmpty(primaryCallState.callbackNumber)) {
+ if (isInMultiWindowMode || TextUtils.isEmpty(primaryCallState.callbackNumber())) {
deviceNumberTextView.setVisibility(View.GONE);
deviceNumberDivider.setVisibility(View.GONE);
return;
}
// This is used for carriers like Project Fi to show the callback number for emergency calls.
deviceNumberTextView.setText(
- context.getString(R.string.contact_grid_callback_number, primaryCallState.callbackNumber));
+ context.getString(
+ R.string.contact_grid_callback_number, primaryCallState.callbackNumber()));
deviceNumberTextView.setVisibility(View.VISIBLE);
if (primaryInfo.shouldShowLocation()) {
deviceNumberDivider.setVisibility(View.VISIBLE);
diff --git a/java/com/android/incallui/contactgrid/TopRow.java b/java/com/android/incallui/contactgrid/TopRow.java
index 5eb38f98c..f551092d4 100644
--- a/java/com/android/incallui/contactgrid/TopRow.java
+++ b/java/com/android/incallui/contactgrid/TopRow.java
@@ -62,19 +62,19 @@ public class TopRow {
public static Info getInfo(Context context, PrimaryCallState state, PrimaryInfo primaryInfo) {
CharSequence label = null;
- Drawable icon = state.connectionIcon;
+ Drawable icon = state.connectionIcon();
boolean labelIsSingleLine = true;
- if (state.isWifi && icon == null) {
+ if (state.isWifi() && icon == null) {
icon = context.getDrawable(R.drawable.quantum_ic_network_wifi_vd_theme_24);
}
- if (state.state == State.INCOMING || state.state == State.CALL_WAITING) {
+ if (state.state() == State.INCOMING || state.state() == State.CALL_WAITING) {
// Call from
// [Wi-Fi icon] Video call from
// Hey Jake, pick up!
- if (!TextUtils.isEmpty(state.callSubject)) {
- label = state.callSubject;
+ if (!TextUtils.isEmpty(state.callSubject())) {
+ label = state.callSubject();
labelIsSingleLine = false;
} else {
label = getLabelForIncoming(context, state);
@@ -84,22 +84,22 @@ public class TopRow {
label = TextUtils.concat(label, " ", spanDisplayNumber(primaryInfo.number()));
}
}
- } else if (VideoUtils.hasSentVideoUpgradeRequest(state.sessionModificationState)
- || VideoUtils.hasReceivedVideoUpgradeRequest(state.sessionModificationState)) {
+ } else if (VideoUtils.hasSentVideoUpgradeRequest(state.sessionModificationState())
+ || VideoUtils.hasReceivedVideoUpgradeRequest(state.sessionModificationState())) {
label = getLabelForVideoRequest(context, state);
- } else if (state.state == State.PULLING) {
+ } else if (state.state() == State.PULLING) {
label = context.getString(R.string.incall_transferring);
- } else if (state.state == State.DIALING || state.state == State.CONNECTING) {
+ } else if (state.state() == State.DIALING || state.state() == State.CONNECTING) {
// [Wi-Fi icon] Calling via Google Guest
// Calling...
label = getLabelForDialing(context, state);
- } else if (state.state == State.ACTIVE && state.isRemotelyHeld) {
+ } else if (state.state() == State.ACTIVE && state.isRemotelyHeld()) {
label = context.getString(R.string.incall_remotely_held);
- } else if (state.state == State.ACTIVE
+ } else if (state.state() == State.ACTIVE
&& shouldShowNumber(primaryInfo, false /* isIncoming */)) {
label = spanDisplayNumber(primaryInfo.number());
- } else if (state.state == State.CALL_PENDING && !TextUtils.isEmpty(state.customLabel)) {
- label = state.customLabel;
+ } else if (state.state() == State.CALL_PENDING && !TextUtils.isEmpty(state.customLabel())) {
+ label = state.customLabel();
} else {
// Video calling...
// [Wi-Fi icon] Starbucks Wi-Fi
@@ -133,13 +133,14 @@ public class TopRow {
}
private static CharSequence getLabelForIncoming(Context context, PrimaryCallState state) {
- if (state.isVideoCall) {
- return getLabelForIncomingVideo(context, state.sessionModificationState, state.isWifi);
- } else if (state.isWifi && !TextUtils.isEmpty(state.connectionLabel)) {
- return state.connectionLabel;
+ if (state.isVideoCall()) {
+ return getLabelForIncomingVideo(context, state.sessionModificationState(), state.isWifi());
+ } else if (state.isWifi() && !TextUtils.isEmpty(state.connectionLabel())) {
+ return state.connectionLabel();
} else if (isAccount(state)) {
- return context.getString(R.string.contact_grid_incoming_via_template, state.connectionLabel);
- } else if (state.isWorkCall) {
+ return context.getString(
+ R.string.contact_grid_incoming_via_template, state.connectionLabel());
+ } else if (state.isWorkCall()) {
return context.getString(R.string.contact_grid_incoming_work_call);
} else {
return context.getString(R.string.contact_grid_incoming_voice_call);
@@ -164,43 +165,43 @@ public class TopRow {
}
private static CharSequence getLabelForDialing(Context context, PrimaryCallState state) {
- if (!TextUtils.isEmpty(state.connectionLabel) && !state.isWifi) {
- return context.getString(R.string.incall_calling_via_template, state.connectionLabel);
+ if (!TextUtils.isEmpty(state.connectionLabel()) && !state.isWifi()) {
+ return context.getString(R.string.incall_calling_via_template, state.connectionLabel());
} else {
- if (state.isVideoCall) {
- if (state.isWifi) {
+ if (state.isVideoCall()) {
+ if (state.isWifi()) {
return context.getString(R.string.incall_wifi_video_call_requesting);
} else {
return context.getString(R.string.incall_video_call_requesting);
}
}
- if (state.isAssistedDialed && state.assistedDialingExtras != null) {
+ if (state.isAssistedDialed() && state.assistedDialingExtras() != null) {
LogUtil.i("TopRow.getLabelForDialing", "using assisted dialing label.");
String countryCode =
- String.valueOf(state.assistedDialingExtras.transformedNumberCountryCallingCode());
+ String.valueOf(state.assistedDialingExtras().transformedNumberCountryCallingCode());
return context.getString(
R.string.incall_connecting_assited_dialed,
countryCode,
- state.assistedDialingExtras.userHomeCountryCode());
+ state.assistedDialingExtras().userHomeCountryCode());
}
return context.getString(R.string.incall_connecting);
}
}
private static CharSequence getConnectionLabel(PrimaryCallState state) {
- if (!TextUtils.isEmpty(state.connectionLabel)
- && (isAccount(state) || state.isWifi || state.isConference)) {
+ if (!TextUtils.isEmpty(state.connectionLabel())
+ && (isAccount(state) || state.isWifi() || state.isConference())) {
// We normally don't show a "call state label" at all when active
// (but we can use the call state label to display the provider name).
- return state.connectionLabel;
+ return state.connectionLabel();
} else {
return null;
}
}
private static CharSequence getLabelForVideoRequest(Context context, PrimaryCallState state) {
- switch (state.sessionModificationState) {
+ switch (state.sessionModificationState()) {
case SessionModificationState.WAITING_FOR_UPGRADE_TO_VIDEO_RESPONSE:
return context.getString(R.string.incall_video_call_upgrade_request);
case SessionModificationState.REQUEST_FAILED:
@@ -211,7 +212,7 @@ public class TopRow {
case SessionModificationState.UPGRADE_TO_VIDEO_REQUEST_TIMED_OUT:
return context.getString(R.string.incall_video_call_request_timed_out);
case SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST:
- return getLabelForIncomingVideo(context, state.sessionModificationState, state.isWifi);
+ return getLabelForIncomingVideo(context, state.sessionModificationState(), state.isWifi());
case SessionModificationState.NO_REQUEST:
default:
Assert.fail();
@@ -220,6 +221,6 @@ public class TopRow {
}
private static boolean isAccount(PrimaryCallState state) {
- return !TextUtils.isEmpty(state.connectionLabel) && TextUtils.isEmpty(state.gatewayNumber);
+ return !TextUtils.isEmpty(state.connectionLabel()) && TextUtils.isEmpty(state.gatewayNumber());
}
}