diff options
author | Android Dialer <noreply@google.com> | 2017-10-09 16:15:53 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-10-10 07:12:46 -0700 |
commit | 19e6dbd30ae88e68cd68f3d3873440d50d19d902 (patch) | |
tree | 021e5dc48597d7bd47e61e9d5e25f4a5a956d9e4 /java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java | |
parent | 04ac93d3c9d2f3f4c157bfa1d23d225aa34db9df (diff) | |
download | android_packages_apps_Dialer-19e6dbd30ae88e68cd68f3d3873440d50d19d902.tar.gz android_packages_apps_Dialer-19e6dbd30ae88e68cd68f3d3873440d50d19d902.tar.bz2 android_packages_apps_Dialer-19e6dbd30ae88e68cd68f3d3873440d50d19d902.zip |
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
Diffstat (limited to 'java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java')
-rw-r--r-- | java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java | 71 |
1 files changed, 45 insertions, 26 deletions
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); - } } } |