summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/PhoneCallDetailsHelper.java22
-rw-r--r--src/com/android/dialer/PhoneCallDetailsViews.java14
-rw-r--r--src/com/android/dialer/calllog/PhoneAccountUtils.java29
3 files changed, 35 insertions, 30 deletions
diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java
index e8884319c..2e1651a70 100644
--- a/src/com/android/dialer/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/PhoneCallDetailsHelper.java
@@ -22,6 +22,7 @@ import android.graphics.drawable.Drawable;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.telecom.PhoneAccount;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.view.View;
@@ -35,6 +36,7 @@ import com.android.dialer.calllog.PhoneAccountUtils;
import com.android.dialer.calllog.PhoneNumberDisplayHelper;
import com.android.dialer.calllog.PhoneNumberUtilsWrapper;
import com.android.dialer.util.DialerUtils;
+
import com.google.common.collect.Lists;
import java.util.ArrayList;
@@ -106,13 +108,21 @@ public class PhoneCallDetailsHelper {
// Set the call count, location and date.
setCallCountAndDate(views, callCount, callLocationAndDate);
- // set the account icon if it exists
- Drawable accountIcon = PhoneAccountUtils.getAccountIcon(mContext, details.accountHandle);
- if (accountIcon != null) {
- views.callAccountIcon.setVisibility(View.VISIBLE);
- views.callAccountIcon.setImageDrawable(accountIcon);
+ // Set the account label if it exists.
+ String accountLabel = PhoneAccountUtils.getAccountLabel(mContext, details.accountHandle);
+
+ if (accountLabel != null) {
+ views.callAccountLabel.setVisibility(View.VISIBLE);
+ views.callAccountLabel.setText(accountLabel);
+ int color = PhoneAccountUtils.getAccountColor(mContext, details.accountHandle);
+ if (color == PhoneAccount.NO_COLOR) {
+ int defaultColor = R.color.dialtacts_secondary_text_color;
+ views.callAccountLabel.setTextColor(mContext.getResources().getColor(defaultColor));
+ } else {
+ views.callAccountLabel.setTextColor(color);
+ }
} else {
- views.callAccountIcon.setVisibility(View.GONE);
+ views.callAccountLabel.setVisibility(View.GONE);
}
final CharSequence nameText;
diff --git a/src/com/android/dialer/PhoneCallDetailsViews.java b/src/com/android/dialer/PhoneCallDetailsViews.java
index 67babc1f7..05026d6ee 100644
--- a/src/com/android/dialer/PhoneCallDetailsViews.java
+++ b/src/com/android/dialer/PhoneCallDetailsViews.java
@@ -30,19 +30,19 @@ public final class PhoneCallDetailsViews {
public final TextView nameView;
public final View callTypeView;
public final CallTypeIconsView callTypeIcons;
- public final ImageView callAccountIcon;
public final TextView callLocationAndDate;
public final TextView voicemailTranscriptionView;
+ public final TextView callAccountLabel;
private PhoneCallDetailsViews(TextView nameView, View callTypeView,
- CallTypeIconsView callTypeIcons, ImageView callAccountIcon,
- TextView callLocationAndDate, TextView voicemailTranscriptionView) {
+ CallTypeIconsView callTypeIcons, TextView callLocationAndDate,
+ TextView voicemailTranscriptionView, TextView callAccountLabel) {
this.nameView = nameView;
this.callTypeView = callTypeView;
this.callTypeIcons = callTypeIcons;
- this.callAccountIcon = callAccountIcon;
this.callLocationAndDate = callLocationAndDate;
this.voicemailTranscriptionView = voicemailTranscriptionView;
+ this.callAccountLabel = callAccountLabel;
}
/**
@@ -56,9 +56,9 @@ public final class PhoneCallDetailsViews {
return new PhoneCallDetailsViews((TextView) view.findViewById(R.id.name),
view.findViewById(R.id.call_type),
(CallTypeIconsView) view.findViewById(R.id.call_type_icons),
- (ImageView) view.findViewById(R.id.call_account_icon),
(TextView) view.findViewById(R.id.call_location_and_date),
- (TextView) view.findViewById(R.id.voicemail_transcription));
+ (TextView) view.findViewById(R.id.voicemail_transcription),
+ (TextView) view.findViewById(R.id.call_account_label));
}
public static PhoneCallDetailsViews createForTest(Context context) {
@@ -66,7 +66,7 @@ public final class PhoneCallDetailsViews {
new TextView(context),
new View(context),
new CallTypeIconsView(context),
- new ImageView(context),
+ new TextView(context),
new TextView(context),
new TextView(context));
}
diff --git a/src/com/android/dialer/calllog/PhoneAccountUtils.java b/src/com/android/dialer/calllog/PhoneAccountUtils.java
index eb9e433bf..7ab212fdd 100644
--- a/src/com/android/dialer/calllog/PhoneAccountUtils.java
+++ b/src/com/android/dialer/calllog/PhoneAccountUtils.java
@@ -61,35 +61,30 @@ public class PhoneAccountUtils {
}
/**
- * Extract account icon from PhoneAccount object.
+ * Extract account label from PhoneAccount object.
*/
- public static Drawable getAccountIcon(Context context, PhoneAccountHandle phoneAccount) {
- final PhoneAccount account = getAccountOrNull(context, phoneAccount);
- if (account == null) {
- return null;
- }
- return account.getIcon(context);
+ public static String getAccountLabel(Context context, PhoneAccountHandle accountHandle) {
+ PhoneAccount account = getAccountOrNull(context, accountHandle);
+ return account == null ? null : account.getLabel().toString();
}
/**
- * Extract account label from PhoneAccount object.
+ * Extract account color from PhoneAccount object.
*/
- public static String getAccountLabel(Context context, PhoneAccountHandle phoneAccount) {
- final PhoneAccount account = getAccountOrNull(context, phoneAccount);
- if (account == null) {
- return null;
- }
- return account.getLabel().toString();
+ public static int getAccountColor(Context context, PhoneAccountHandle accountHandle) {
+ PhoneAccount account = getAccountOrNull(context, accountHandle);
+ return account == null ? PhoneAccount.NO_COLOR : account.getColor();
}
/**
* Retrieve the account metadata, but if the account does not exist or the device has only a
* single registered and enabled account, return null.
*/
- private static PhoneAccount getAccountOrNull(Context context, PhoneAccountHandle phoneAccount) {
- final TelecomManager telecomManager =
+ private static PhoneAccount getAccountOrNull(Context context,
+ PhoneAccountHandle accountHandle) {
+ TelecomManager telecomManager =
(TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
- final PhoneAccount account = telecomManager.getPhoneAccount(phoneAccount);
+ final PhoneAccount account = telecomManager.getPhoneAccount(accountHandle);
if (account == null || !telecomManager.hasMultipleCallCapableAccounts()) {
return null;
}