summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2018-06-26 13:39:18 -0700
committerCopybara-Service <copybara-piper@google.com>2018-06-27 11:06:09 -0700
commitd745887310ae896649b11d9044cfbf070b2e5ac9 (patch)
tree39e6c45532daa4a07403314a4ac43da4f986ff70 /java
parentde53e545276c7854de0d2886a6cb8c849b3b1e62 (diff)
Update connection label.
Bug: 79878432 Test: manual PiperOrigin-RevId: 202185676 Change-Id: I53c3896a68f9dbed9316360d7f4ad6dd7cbe17ec
Diffstat (limited to 'java')
-rw-r--r--java/com/android/incallui/CallCardPresenter.java2
-rw-r--r--java/com/android/incallui/contactgrid/TopRow.java23
-rw-r--r--java/com/android/incallui/contactgrid/res/values/strings.xml2
-rw-r--r--java/com/android/incallui/incall/protocol/PrimaryCallState.java8
4 files changed, 31 insertions, 4 deletions
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index b9e6744ea..dd1fc4f37 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -469,6 +469,8 @@ public class CallCardPresenter
.setSessionModificationState(primary.getVideoTech().getSessionModificationState())
.setDisconnectCause(primary.getDisconnectCause())
.setConnectionLabel(getConnectionLabel())
+ .setPrimaryColor(
+ InCallPresenter.getInstance().getThemeColorManager().getPrimaryColor())
.setSimSuggestionReason(getSimSuggestionReason())
.setConnectionIcon(getCallStateIcon())
.setGatewayNumber(getGatewayNumber())
diff --git a/java/com/android/incallui/contactgrid/TopRow.java b/java/com/android/incallui/contactgrid/TopRow.java
index 82a103a61..d242c3a14 100644
--- a/java/com/android/incallui/contactgrid/TopRow.java
+++ b/java/com/android/incallui/contactgrid/TopRow.java
@@ -21,8 +21,12 @@ import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.telephony.PhoneNumberUtils;
import android.text.BidiFormatter;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.Spanned;
import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
+import android.text.style.ForegroundColorSpan;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.incallui.call.state.DialerCallState;
@@ -141,8 +145,7 @@ public class TopRow {
} 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());
+ return getColoredConnectionLabel(context, state);
} else if (state.isWorkCall()) {
return context.getString(R.string.contact_grid_incoming_work_call);
} else {
@@ -150,6 +153,22 @@ public class TopRow {
}
}
+ private static Spannable getColoredConnectionLabel(Context context, PrimaryCallState state) {
+ Assert.isNotNull(state.connectionLabel());
+ String label =
+ context.getString(R.string.contact_grid_incoming_via_template, state.connectionLabel());
+ Spannable spannable = new SpannableString(label);
+
+ int start = label.indexOf(state.connectionLabel());
+ int end = start + state.connectionLabel().length();
+ spannable.setSpan(
+ new ForegroundColorSpan(state.primaryColor()),
+ start,
+ end,
+ Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
+ return spannable;
+ }
+
private static CharSequence getLabelForIncomingVideo(
Context context, @SessionModificationState int sessionModificationState, boolean isWifi) {
if (sessionModificationState == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
diff --git a/java/com/android/incallui/contactgrid/res/values/strings.xml b/java/com/android/incallui/contactgrid/res/values/strings.xml
index 7c0f5a679..9ee10c327 100644
--- a/java/com/android/incallui/contactgrid/res/values/strings.xml
+++ b/java/com/android/incallui/contactgrid/res/values/strings.xml
@@ -89,7 +89,7 @@
<string name="contact_grid_incoming_work_call">Work call from</string>
<!-- Displayed in the answer call screen for incoming calls via a phone account. -->
- <string name="contact_grid_incoming_via_template">Incoming via <xliff:g id="provider_name">%s</xliff:g></string>
+ <string name="contact_grid_incoming_via_template">Call via <xliff:g id="provider_name">%s</xliff:g> from</string>
<!-- Displayed in the answer call screen for incoming spam calls. -->
<string name="contact_grid_incoming_suspected_spam">Suspected spam caller</string>
diff --git a/java/com/android/incallui/incall/protocol/PrimaryCallState.java b/java/com/android/incallui/incall/protocol/PrimaryCallState.java
index 423f86875..e07caf1b6 100644
--- a/java/com/android/incallui/incall/protocol/PrimaryCallState.java
+++ b/java/com/android/incallui/incall/protocol/PrimaryCallState.java
@@ -17,6 +17,7 @@
package com.android.incallui.incall.protocol;
import android.graphics.drawable.Drawable;
+import android.support.annotation.ColorInt;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.telecom.DisconnectCause;
@@ -59,6 +60,8 @@ public abstract class PrimaryCallState {
@Nullable
public abstract String connectionLabel();
+ public abstract @ColorInt int primaryColor();
+
@Nullable
public abstract SuggestionProvider.Reason simSuggestionReason();
@@ -127,7 +130,8 @@ public abstract class PrimaryCallState {
.setIsBusinessNumber(false)
.setSupportsCallOnHold(true)
.setSwapToSecondaryButtonState(ButtonState.NOT_SUPPORT)
- .setIsAssistedDialed(false);
+ .setIsAssistedDialed(false)
+ .setPrimaryColor(0);
}
/** Builder class for primary call state info. */
@@ -148,6 +152,8 @@ public abstract class PrimaryCallState {
public abstract Builder setConnectionIcon(Drawable connectionIcon);
+ public abstract Builder setPrimaryColor(@ColorInt int color);
+
public abstract Builder setGatewayNumber(String gatewayNumber);
public abstract Builder setCallSubject(String callSubject);