From fc90a171c92a1d679927c8c26766b6287f6402f3 Mon Sep 17 00:00:00 2001 From: linyuh Date: Thu, 21 Jun 2018 10:12:22 -0700 Subject: Keep actions on new call log entries consistent with those in the old call log. Bug: 110412130 Test: NewCallLogViewHolderTest, NewCallLogIntegrationTest PiperOrigin-RevId: 201543827 Change-Id: I301aaf686b729086776ab3bcc677bacd2450fea0 --- .../dialer/calllog/ui/NewCallLogViewHolder.java | 37 ++++++++++++++-------- .../calllog/ui/res/layout/new_call_log_entry.xml | 11 ++++--- .../dialer/calllog/ui/res/values/strings.xml | 23 ++++++++++---- 3 files changed, 45 insertions(+), 26 deletions(-) (limited to 'java') diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java index 812e7b915..a6e3c991b 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java @@ -63,7 +63,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private final ImageView wifiIcon; private final ImageView assistedDialIcon; private final TextView phoneAccountView; - private final ImageView menuButton; + private final ImageView callButton; private final View callLogEntryRootView; private final Clock clock; @@ -91,7 +91,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { wifiIcon = view.findViewById(R.id.wifi_icon); assistedDialIcon = view.findViewById(R.id.assisted_dial_icon); phoneAccountView = view.findViewById(R.id.phone_account); - menuButton = view.findViewById(R.id.menu_button); + callButton = view.findViewById(R.id.call_button); this.clock = clock; this.realtimeRowProcessor = realtimeRowProcessor; @@ -139,8 +139,9 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { setFeatureIcons(row); setCallTypeIcon(row); setPhoneAccounts(row); - setOnClickListenerForRow(row); - setOnClickListenerForMenuButon(row); + setCallButon(row); + + itemView.setOnClickListener(NewCallLogMenu.createOnClickListener(activity, row)); } private void configA11yForRow(CoalescedRow row) { @@ -286,21 +287,29 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { phoneAccountView.setVisibility(View.VISIBLE); } - private void setOnClickListenerForRow(CoalescedRow row) { + private void setCallButon(CoalescedRow row) { if (!PhoneNumberHelper.canPlaceCallsTo( row.getNumber().getNormalizedNumber(), row.getNumberPresentation())) { - itemView.setOnClickListener(null); + callButton.setVisibility(View.GONE); return; } - itemView.setOnClickListener(view -> CallLogRowActions.startCallForRow(activity, row)); - } - private void setOnClickListenerForMenuButon(CoalescedRow row) { - menuButton.setOnClickListener(NewCallLogMenu.createOnClickListener(activity, row)); - menuButton.setContentDescription( - TextUtils.expandTemplate( - activity.getResources().getText(R.string.a11y_new_call_log_entry_expand_menu), - CallLogEntryText.buildPrimaryText(activity, row))); + callButton.setVisibility(View.VISIBLE); + if ((row.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) { + callButton.setImageResource(R.drawable.quantum_ic_videocam_vd_theme_24); + callButton.setContentDescription( + TextUtils.expandTemplate( + activity.getResources().getText(R.string.a11y_new_call_log_entry_video_call), + CallLogEntryText.buildPrimaryText(activity, row))); + } else { + callButton.setImageResource(R.drawable.quantum_ic_call_vd_theme_24); + callButton.setContentDescription( + TextUtils.expandTemplate( + activity.getResources().getText(R.string.a11y_new_call_log_entry_voice_call), + CallLogEntryText.buildPrimaryText(activity, row))); + } + + callButton.setOnClickListener(view -> CallLogRowActions.startCallForRow(activity, row)); } private class RealtimeRowFutureCallback implements FutureCallback { diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml index 5ce87cecf..dba859f64 100644 --- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml +++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml @@ -18,9 +18,11 @@ + android:minHeight="72dp" + android:background="?android:attr/selectableItemBackground"> @@ -141,18 +143,17 @@ diff --git a/java/com/android/dialer/calllog/ui/res/values/strings.xml b/java/com/android/dialer/calllog/ui/res/values/strings.xml index b97a10625..87d6a19fc 100644 --- a/java/com/android/dialer/calllog/ui/res/values/strings.xml +++ b/java/com/android/dialer/calllog/ui/res/values/strings.xml @@ -18,19 +18,28 @@ - call + expand menu - - Expand call log menu for ^1 + + call ^1 + + + + + make a video call to ^1 -- cgit v1.2.3