diff options
author | linyuh <linyuh@google.com> | 2018-06-21 10:12:22 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-21 10:13:06 -0700 |
commit | fc90a171c92a1d679927c8c26766b6287f6402f3 (patch) | |
tree | ddf03185fc54eb26345ed1ea598f55e50a56961b | |
parent | a5322c070c2145f8edfd21aea6776569c3f7dd71 (diff) |
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
3 files changed, 45 insertions, 26 deletions
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<CoalescedRow> { 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 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/new_call_log_entry_root" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="72dp"> + android:minHeight="72dp" + android:background="?android:attr/selectableItemBackground"> <com.android.dialer.widget.ContactPhotoView android:id="@+id/contact_photo_view" @@ -40,7 +42,7 @@ android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toEndOf="@+id/contact_photo_view" - android:layout_toStartOf="@+id/menu_button" + android:layout_toStartOf="@+id/call_button" android:orientation="vertical" android:importantForAccessibility="noHideDescendants"> @@ -141,18 +143,17 @@ </LinearLayout> <!-- - The button to expand the bottom sheet for an entry. + The button to make a call. Its content description is set in Java code. --> <ImageView - android:id="@+id/menu_button" + android:id="@+id/call_button" android:layout_width="56dp" android:layout_height="72dp" android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:background="?android:attr/selectableItemBackgroundBorderless" android:scaleType="center" - android:src="@drawable/quantum_ic_more_vert_vd_theme_24" android:tint="?colorIcon" tools:ignore="ContentDescription"/> </RelativeLayout> 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 @@ <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- - A string informing a11y users that activating a call log entry will place a call. - Note: the word "call" here is a verb. + A string informing a11y users that activating a call log entry will expand the menu + (a bottom sheet) for it. [CHAR LIMIT=NONE] --> - <string name="a11y_new_call_log_entry_tap_action">call</string> + <string name="a11y_new_call_log_entry_tap_action">expand menu</string> <!-- - A string describing the menu button of a call log entry for a11y users. - An example will be read as "expand call log menu for Jane Smith". + A string describing the call button of a call log entry for a11y users. + An example will be read as "call Jane Smith". [CHAR LIMIT=NONE] --> - <string name="a11y_new_call_log_entry_expand_menu"> - Expand call log menu for <xliff:g example="Jane Smith" id="primaryTextForEntry">^1</xliff:g> + <string name="a11y_new_call_log_entry_voice_call"> + call <xliff:g example="Jane Smith" id="primaryTextForEntry">^1</xliff:g> + </string> + + <!-- + A string describing the call button of a call log entry for a11y users. + An example will be read as "make a video call to Jane Smith". + [CHAR LIMIT=NONE] + --> + <string name="a11y_new_call_log_entry_video_call"> + make a video call to <xliff:g example="Jane Smith" id="primaryTextForEntry">^1</xliff:g> </string> <!-- Header in call log to group calls from the current day. [CHAR LIMIT=30] --> |