From 19e6dbd30ae88e68cd68f3d3873440d50d19d902 Mon Sep 17 00:00:00 2001 From: Android Dialer Date: Mon, 9 Oct 2017 16:15:53 -0700 Subject: Group calls in the call log according to their corresponding actions. Currently different types of calls can be grouped together (e.g., 1 voice call and 1 IMS call to/from the same number), which makes it difficult to choose the icon for the call detail UI's call back button. This CL adds an extra constraint that separates different call types (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: CallLogGroupBuilderTest.addGroups_MixedEntries_PartiallyGroupedByAction PiperOrigin-RevId: 171602617 Change-Id: Id8170206009ba836a40c38a86914c71d5c7701dc --- .../app/calllog/CallLogListItemViewHolder.java | 71 ++++++++++++++-------- 1 file changed, 45 insertions(+), 26 deletions(-) (limited to 'java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java') diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index f0eee112b..225b6527e 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -66,6 +66,7 @@ import com.android.dialer.callcomposer.CallComposerActivity; import com.android.dialer.calldetails.CallDetailsActivity; import com.android.dialer.calldetails.CallDetailsEntries; import com.android.dialer.callintent.CallIntentBuilder; +import com.android.dialer.calllogutils.CallbackActionHelper.CallbackAction; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.CompatUtils; @@ -228,6 +229,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder private final View.OnLongClickListener longPressListener; private boolean mVoicemailPrimaryActionButtonClicked; + public int callbackAction; public int dayGroupHeaderVisibility; public CharSequence dayGroupHeaderText; public boolean isAttachedToWindow; @@ -511,36 +513,53 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } else { primaryActionButtonView.setVisibility(View.GONE); } - } else { - // Treat as normal list item; show call button, if possible. - if (PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation)) { - boolean isVoicemailNumber = mCallLogCache.isVoicemailNumber(accountHandle, number); + return; + } + + // Treat as normal list item; show call button, if possible. + if (!PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation)) { + primaryActionButtonView.setTag(null); + primaryActionButtonView.setVisibility(View.GONE); + return; + } - if (!isVoicemailNumber && showLightbringerPrimaryButton()) { + switch (callbackAction) { + case CallbackAction.IMS_VIDEO: + primaryActionButtonView.setTag( + IntentProvider.getReturnVideoCallIntentProvider(number, accountHandle)); + primaryActionButtonView.setContentDescription( + TextUtils.expandTemplate( + mContext.getString(R.string.description_video_call_action), validNameOrNumber)); + primaryActionButtonView.setImageResource(R.drawable.quantum_ic_videocam_vd_theme_24); + primaryActionButtonView.setVisibility(View.VISIBLE); + break; + case CallbackAction.LIGHTBRINGER: + if (showLightbringerPrimaryButton()) { CallIntentBuilder.increaseLightbringerCallButtonAppearInCollapsedCallLogItemCount(); primaryActionButtonView.setTag(IntentProvider.getLightbringerIntentProvider(number)); - primaryActionButtonView.setContentDescription( - TextUtils.expandTemplate( - mContext.getString(R.string.description_video_call_action), validNameOrNumber)); - primaryActionButtonView.setImageResource(R.drawable.quantum_ic_videocam_vd_theme_24); - primaryActionButtonView.setVisibility(View.VISIBLE); - return; + } else { + primaryActionButtonView.setTag( + IntentProvider.getReturnVideoCallIntentProvider(number, accountHandle)); } - - if (isVoicemailNumber) { - // Call to generic voicemail number, in case there are multiple accounts. + primaryActionButtonView.setContentDescription( + TextUtils.expandTemplate( + mContext.getString(R.string.description_video_call_action), validNameOrNumber)); + primaryActionButtonView.setImageResource(R.drawable.quantum_ic_videocam_vd_theme_24); + primaryActionButtonView.setVisibility(View.VISIBLE); + break; + case CallbackAction.VOICE: + 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) { + primaryActionButtonView.setTag( + IntentProvider.getAssistedDialIntentProvider( + number + postDialDigits, + mContext, + mContext.getSystemService(TelephonyManager.class))); } else { - if (this.info != null && this.info.lookupKey != null) { - primaryActionButtonView.setTag( - IntentProvider.getAssistedDialIntentProvider( - number + postDialDigits, - mContext, - mContext.getSystemService(TelephonyManager.class))); - } else { - primaryActionButtonView.setTag( - IntentProvider.getReturnCallIntentProvider(number + postDialDigits)); - } + primaryActionButtonView.setTag( + IntentProvider.getReturnCallIntentProvider(number + postDialDigits)); } primaryActionButtonView.setContentDescription( @@ -548,10 +567,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder mContext.getString(R.string.description_call_action), validNameOrNumber)); primaryActionButtonView.setImageResource(R.drawable.quantum_ic_call_vd_theme_24); primaryActionButtonView.setVisibility(View.VISIBLE); - } else { + break; + default: primaryActionButtonView.setTag(null); primaryActionButtonView.setVisibility(View.GONE); - } } } -- cgit v1.2.3