diff options
author | Nancy Chen <nancychen@google.com> | 2014-07-28 17:21:22 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-26 01:02:19 +0000 |
commit | d8e5542a7ddba2e107b7f56b9761db1db942c722 (patch) | |
tree | 226e3dd2461336fb537afd69fd685f1beaf3e974 /src | |
parent | 72d59616b7a491d41c9b127b777c63fe315ecd06 (diff) | |
parent | 1970263aad3e26c0e36dbe3783bef5d9f0ff29f0 (diff) |
Merge "Add account label to call details if appropriate" into lmp-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/CallDetailActivity.java | 13 | ||||
-rw-r--r-- | src/com/android/dialer/PhoneCallDetails.java | 21 | ||||
-rw-r--r-- | src/com/android/dialer/PhoneCallDetailsHelper.java | 2 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 4 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/PhoneAccountUtils.java | 5 |
5 files changed, 29 insertions, 16 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index cd5fb3bc7..e44ff83bc 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -115,6 +115,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware private QuickContactBadge mQuickContactBadge; private TextView mCallerName; private TextView mCallerNumber; + private TextView mAccountLabel; private AsyncTaskExecutor mAsyncTaskExecutor; private ContactInfoHelper mContactInfoHelper; @@ -246,6 +247,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware mQuickContactBadge.setOverlay(null); mCallerName = (TextView) findViewById(R.id.caller_name); mCallerNumber = (TextView) findViewById(R.id.caller_number); + mAccountLabel = (TextView) findViewById(R.id.phone_account_label); mDefaultCountryIso = GeoUtil.getCurrentCountryIso(this); mContactPhotoManager = ContactPhotoManager.getInstance(this); mProximitySensorManager = new ProximitySensorManager(this, mProximitySensorListener); @@ -438,6 +440,13 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware } + if (!TextUtils.isEmpty(firstDetails.accountLabel)) { + mAccountLabel.setText(firstDetails.accountLabel); + mAccountLabel.setVisibility(View.VISIBLE); + } else { + mAccountLabel.setVisibility(View.GONE); + } + mHasEditNumberBeforeCallOption = canPlaceCallsTo && !isSipNumber && !isVoicemailNumber; mHasTrashOption = hasVoicemail(); @@ -520,7 +529,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware final String geocode = callCursor.getString(GEOCODED_LOCATION_COLUMN_INDEX); final String transcription = callCursor.getString(TRANSCRIPTION_COLUMN_INDEX); - final Drawable accountIcon = PhoneAccountUtils.getAccountIcon(this, + final String accountLabel = PhoneAccountUtils.getAccountLabel(this, PhoneAccountUtils.getAccount( callCursor.getString(ACCOUNT_COMPONENT_NAME), callCursor.getString(ACCOUNT_ID))); @@ -571,7 +580,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware formattedNumber, countryIso, geocode, new int[]{ callType }, date, duration, nameText, numberType, numberLabel, lookupUri, photoUri, sourceType, - accountIcon, features, dataUsage, transcription); + accountLabel, null, features, dataUsage, transcription); } finally { if (callCursor != null) { callCursor.close(); diff --git a/src/com/android/dialer/PhoneCallDetails.java b/src/com/android/dialer/PhoneCallDetails.java index 869203638..f6f9edace 100644 --- a/src/com/android/dialer/PhoneCallDetails.java +++ b/src/com/android/dialer/PhoneCallDetails.java @@ -67,7 +67,11 @@ public class PhoneCallDetails { */ public final int sourceType; /** - * The unique identifier for the provider associated with the call. + * The unique identifier for the account associated with the call. + */ + public final String accountLabel; + /** + * The icon for the account associated with the call. */ public final Drawable accountIcon; /** @@ -92,18 +96,18 @@ public class PhoneCallDetails { CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration) { this (number, numberPresentation, formattedNumber, countryIso, geocode, - callTypes, date, duration, "", 0, "", null, null, 0, null, Calls.FEATURES_NONE, + callTypes, date, duration, "", 0, "", null, null, 0, null, null, Calls.FEATURES_NONE, null, null); } /** Create the details for a call with a number not associated with a contact. */ public PhoneCallDetails(CharSequence number, int numberPresentation, CharSequence formattedNumber, String countryIso, String geocode, - int[] callTypes, long date, long duration, Drawable accountIcon, int features, - Long dataUsage, String transcription) { + int[] callTypes, long date, long duration, String accountLabel, Drawable accountIcon, + int features, Long dataUsage, String transcription) { this(number, numberPresentation, formattedNumber, countryIso, geocode, - callTypes, date, duration, "", 0, "", null, null, 0, accountIcon, features, - dataUsage, transcription); + callTypes, date, duration, "", 0, "", null, null, 0, accountLabel, accountIcon, + features, dataUsage, transcription); } /** Create the details for a call with a number associated with a contact. */ @@ -111,8 +115,8 @@ public class PhoneCallDetails { CharSequence formattedNumber, String countryIso, String geocode, int[] callTypes, long date, long duration, CharSequence name, int numberType, CharSequence numberLabel, Uri contactUri, - Uri photoUri, int sourceType, Drawable accountIcon, int features, Long dataUsage, - String transcription) { + Uri photoUri, int sourceType, String accountLabel, Drawable accountIcon, int features, + Long dataUsage, String transcription) { this.number = number; this.numberPresentation = numberPresentation; this.formattedNumber = formattedNumber; @@ -127,6 +131,7 @@ public class PhoneCallDetails { this.contactUri = contactUri; this.photoUri = photoUri; this.sourceType = sourceType; + this.accountLabel = accountLabel; this.accountIcon = accountIcon; this.features = features; this.dataUsage = dataUsage; diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java index 3846b6fb8..a432dafa2 100644 --- a/src/com/android/dialer/PhoneCallDetailsHelper.java +++ b/src/com/android/dialer/PhoneCallDetailsHelper.java @@ -48,7 +48,6 @@ public class PhoneCallDetailsHelper { /** The injected current time in milliseconds since the epoch. Used only by tests. */ private Long mCurrentTimeMillisForTest; // Helper classes. - private final CallTypeHelper mCallTypeHelper; private final PhoneNumberDisplayHelper mPhoneNumberHelper; private final PhoneNumberUtilsWrapper mPhoneNumberUtilsWrapper; @@ -67,7 +66,6 @@ public class PhoneCallDetailsHelper { public PhoneCallDetailsHelper(Resources resources, CallTypeHelper callTypeHelper, PhoneNumberUtilsWrapper phoneUtils) { mResources = resources; - mCallTypeHelper = callTypeHelper; mPhoneNumberUtilsWrapper = phoneUtils; mPhoneNumberHelper = new PhoneNumberDisplayHelper(mPhoneNumberUtilsWrapper, resources); } diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 630cf3f33..a8c20feb0 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -774,12 +774,12 @@ public class CallLogAdapter extends GroupingListAdapter if (TextUtils.isEmpty(name)) { details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, - duration, accountIcon, features, dataUsage, transcription); + duration, null, accountIcon, features, dataUsage, transcription); } else { details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date, duration, name, ntype, label, lookupUri, photoUri, sourceType, - accountIcon, features, dataUsage, transcription); + null, accountIcon, features, dataUsage, transcription); } mCallLogViewsHelper.setPhoneCallDetails(views, details); diff --git a/src/com/android/dialer/calllog/PhoneAccountUtils.java b/src/com/android/dialer/calllog/PhoneAccountUtils.java index 326ffa69d..dc838fb1a 100644 --- a/src/com/android/dialer/calllog/PhoneAccountUtils.java +++ b/src/com/android/dialer/calllog/PhoneAccountUtils.java @@ -54,12 +54,12 @@ public class PhoneAccountUtils { /** * Generate account label from data in Telecomm database */ - public static CharSequence getAccountLabel(Context context, PhoneAccountHandle phoneAccount) { + public static String getAccountLabel(Context context, PhoneAccountHandle phoneAccount) { final PhoneAccount account = getAccountOrNull(context, phoneAccount); if (account == null) { return null; } - return account.getLabel(); + return account.getLabel().toString(); } /** @@ -75,4 +75,5 @@ public class PhoneAccountUtils { } return account; } + } |