From 7b96fb1690255f13591edba01770d2d82c197194 Mon Sep 17 00:00:00 2001 From: linyuh Date: Tue, 10 Oct 2017 11:03:33 -0700 Subject: Set an appropriate icon for the call detail UI's callback button. cl/170943038 groups calls in the call log according to their corresponding actions (Lightbringer, IMS, and voice). This way calls in the call detail UI are in the same category and an appropriate icon can be set. Bug: 66026167 Test: CallDetailsActivityTest.callbackButtonLoggedForLightbringerCall, CallDetailsActivityTest.callbackButtonLoggedForVideoCall, CallDetailsActivityTest.callbackButtonLoggedForVoiceCall PiperOrigin-RevId: 171703514 Change-Id: I534e1d22f1355f261105a6bde74285403fc9ed87 --- .../android/dialer/app/calllog/CallLogListItemViewHolder.java | 10 +++++++--- java/com/android/dialer/app/calllog/IntentProvider.java | 9 +++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'java/com/android/dialer/app') diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index adf7f1b4e..6067c4239 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -551,7 +551,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder if (mCallLogCache.isVoicemailNumber(accountHandle, number)) { // Call to generic voicemail number, in case there are multiple accounts primaryActionButtonView.setTag(IntentProvider.getReturnVoicemailCallIntentProvider()); - } else if (this.info != null && this.info.lookupKey != null) { + } else if (canSupportAssistedDialing()) { primaryActionButtonView.setTag( IntentProvider.getAssistedDialIntentProvider( number + postDialDigits, @@ -618,7 +618,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder ((TextView) callButtonView.findViewById(R.id.call_type_or_location_text)); if (canPlaceCallToNumber) { - if (this.info != null && this.info.lookupKey != null) { + if (canSupportAssistedDialing()) { callButtonView.setTag( IntentProvider.getAssistedDialIntentProvider( number, mContext, mContext.getSystemService(TelephonyManager.class))); @@ -685,7 +685,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder && mCachedNumberLookupService.canReportAsInvalid(info.sourceType, info.objectId); detailsButtonView.setTag( IntentProvider.getCallDetailIntentProvider( - callDetailsEntries, buildContact(), canReportCallerId)); + callDetailsEntries, buildContact(), canReportCallerId, canSupportAssistedDialing())); } boolean isBlockedOrSpam = blockId != null || (isSpamFeatureEnabled && isSpam); @@ -764,6 +764,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder return accountHandle.getComponentName().equals(mDefaultPhoneAccountHandle.getComponentName()); } + private boolean canSupportAssistedDialing() { + return info != null && info.lookupKey != null; + } + private boolean canSupportCarrierVideoCall() { return mCallLogCache.canRelyOnVideoPresence() && info != null diff --git a/java/com/android/dialer/app/calllog/IntentProvider.java b/java/com/android/dialer/app/calllog/IntentProvider.java index 52a7b0faf..5030de5f5 100644 --- a/java/com/android/dialer/app/calllog/IntentProvider.java +++ b/java/com/android/dialer/app/calllog/IntentProvider.java @@ -124,15 +124,20 @@ public abstract class IntentProvider { * * @param callDetailsEntries The call details of the other calls grouped together with the call. * @param contact The contact with which this call details intent pertains to. + * @param canReportCallerId Whether reporting a caller ID is supported. + * @param canSupportAssistedDialing Whether assisted dialing is supported. * @return The call details intent provider. */ public static IntentProvider getCallDetailIntentProvider( - CallDetailsEntries callDetailsEntries, DialerContact contact, boolean canReportCallerId) { + CallDetailsEntries callDetailsEntries, + DialerContact contact, + boolean canReportCallerId, + boolean canSupportAssistedDialing) { return new IntentProvider() { @Override public Intent getIntent(Context context) { return CallDetailsActivity.newInstance( - context, callDetailsEntries, contact, canReportCallerId); + context, callDetailsEntries, contact, canReportCallerId, canSupportAssistedDialing); } }; } -- cgit v1.2.3