From 4c185f69903230a32d5166e3e56f5246449d71d7 Mon Sep 17 00:00:00 2001 From: zachh Date: Mon, 5 Feb 2018 16:32:14 -0800 Subject: Match redlines in new call log. This includes: -Moved call count to after icons -Bold PhoneAccount for new calls -Fixed recycling issues in call type icons and phone account -Fixed cropping at bottom of "y" character (see b/67913060) -Reduced nesting in layout -Removed dimens.xml as it shouldn't be shared by voicemail -Set the alpha for Wifi/HD icons depending on read/unread status -Don't color call type icons, except for missed -Call type icons scale with display size -Call type icons are larger (18dp) in new UI Note that FrameLayout is used to ensure that icons/callCount view is not clipped, and instead contact name is ellipsized when the content is too wide to fit. Bug: 67913060,70989593,70989611 Test: unit and manual PiperOrigin-RevId: 184605728 Change-Id: Ie36c89354cbe4444ad2b42b6b0040430e396691c --- .../drawable/quantum_ic_call_made_vd_theme_24.xml | 25 +++++ .../quantum_ic_call_missed_vd_theme_24.xml | 25 +++++ .../quantum_ic_call_received_vd_theme_24.xml | 25 +++++ .../quantum_ic_signal_wifi_4_bar_vd_theme_24.xml | 25 +++++ .../dialer/calllog/ui/NewCallLogViewHolder.java | 114 +++++++++++++++---- .../calllog/ui/res/layout/new_call_log_entry.xml | 124 +++++++++++++-------- .../calllog/ui/res/layout/new_call_log_header.xml | 12 +- .../dialer/calllog/ui/res/values/colors.xml | 24 ++++ .../dialer/calllog/ui/res/values/dimens.xml | 28 ----- .../dialer/calllog/ui/res/values/styles.xml | 8 ++ java/com/android/dialer/oem/MotorolaUtils.java | 9 +- .../com/android/dialer/theme/res/values/themes.xml | 7 ++ 12 files changed, 325 insertions(+), 101 deletions(-) create mode 100644 assets/quantum/res/drawable/quantum_ic_call_made_vd_theme_24.xml create mode 100644 assets/quantum/res/drawable/quantum_ic_call_missed_vd_theme_24.xml create mode 100644 assets/quantum/res/drawable/quantum_ic_call_received_vd_theme_24.xml create mode 100644 assets/quantum/res/drawable/quantum_ic_signal_wifi_4_bar_vd_theme_24.xml create mode 100644 java/com/android/dialer/calllog/ui/res/values/colors.xml delete mode 100644 java/com/android/dialer/calllog/ui/res/values/dimens.xml diff --git a/assets/quantum/res/drawable/quantum_ic_call_made_vd_theme_24.xml b/assets/quantum/res/drawable/quantum_ic_call_made_vd_theme_24.xml new file mode 100644 index 000000000..60692272b --- /dev/null +++ b/assets/quantum/res/drawable/quantum_ic_call_made_vd_theme_24.xml @@ -0,0 +1,25 @@ + + + + diff --git a/assets/quantum/res/drawable/quantum_ic_call_missed_vd_theme_24.xml b/assets/quantum/res/drawable/quantum_ic_call_missed_vd_theme_24.xml new file mode 100644 index 000000000..657dbf56a --- /dev/null +++ b/assets/quantum/res/drawable/quantum_ic_call_missed_vd_theme_24.xml @@ -0,0 +1,25 @@ + + + + diff --git a/assets/quantum/res/drawable/quantum_ic_call_received_vd_theme_24.xml b/assets/quantum/res/drawable/quantum_ic_call_received_vd_theme_24.xml new file mode 100644 index 000000000..a4895325a --- /dev/null +++ b/assets/quantum/res/drawable/quantum_ic_call_received_vd_theme_24.xml @@ -0,0 +1,25 @@ + + + + diff --git a/assets/quantum/res/drawable/quantum_ic_signal_wifi_4_bar_vd_theme_24.xml b/assets/quantum/res/drawable/quantum_ic_signal_wifi_4_bar_vd_theme_24.xml new file mode 100644 index 000000000..8f0b0d213 --- /dev/null +++ b/assets/quantum/res/drawable/quantum_ic_signal_wifi_4_bar_vd_theme_24.xml @@ -0,0 +1,25 @@ + + + + diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java index ab9429951..ee114b5f9 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java @@ -17,9 +17,11 @@ package com.android.dialer.calllog.ui; import android.content.Context; import android.content.Intent; +import android.content.res.ColorStateList; import android.database.Cursor; import android.net.Uri; import android.provider.CallLog.Calls; +import android.support.annotation.DrawableRes; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; @@ -32,8 +34,8 @@ import com.android.dialer.calllog.ui.menu.NewCallLogMenu; import com.android.dialer.calllogutils.CallLogContactTypes; import com.android.dialer.calllogutils.CallLogEntryText; import com.android.dialer.calllogutils.CallLogIntents; -import com.android.dialer.calllogutils.CallTypeIconsView; import com.android.dialer.common.concurrent.DialerExecutorComponent; +import com.android.dialer.compat.AppCompatConstants; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.contactphoto.ContactPhotoManager; import com.android.dialer.contactphoto.NumberAttributeConverter; @@ -49,10 +51,13 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private final Context context; private final TextView primaryTextView; + private final TextView callCountTextView; private final TextView secondaryTextView; private final QuickContactBadge quickContactBadge; - private final CallTypeIconsView primaryCallTypeIconsView; // Used for Wifi, HD icons - private final CallTypeIconsView secondaryCallTypeIconsView; // Used for call types + private final ImageView callTypeIcon; + private final ImageView hdIcon; + private final ImageView wifiIcon; + private final ImageView assistedDialIcon; private final TextView phoneAccountView; private final ImageView menuButton; @@ -66,10 +71,13 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { super(view); this.context = view.getContext(); primaryTextView = view.findViewById(R.id.primary_text); + callCountTextView = view.findViewById(R.id.call_count); secondaryTextView = view.findViewById(R.id.secondary_text); quickContactBadge = view.findViewById(R.id.quick_contact_photo); - primaryCallTypeIconsView = view.findViewById(R.id.primary_call_type_icons); - secondaryCallTypeIconsView = view.findViewById(R.id.secondary_call_type_icons); + callTypeIcon = view.findViewById(R.id.call_type_icon); + hdIcon = view.findViewById(R.id.hd_icon); + 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); @@ -103,27 +111,32 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { if (isNewMissedCall(row)) { primaryTextView.setTextAppearance(R.style.primary_textview_new_call); - // TODO(zachh): Styling for call type icons when the call is new. + callCountTextView.setTextAppearance(R.style.primary_textview_new_call); secondaryTextView.setTextAppearance(R.style.secondary_textview_new_call); + phoneAccountView.setTextAppearance(R.style.phoneaccount_textview_new_call); } else { primaryTextView.setTextAppearance(R.style.primary_textview); + callCountTextView.setTextAppearance(R.style.primary_textview); secondaryTextView.setTextAppearance(R.style.secondary_textview); + phoneAccountView.setTextAppearance(R.style.phoneaccount_textview); } setNumberCalls(row); setPhoto(row); - setPrimaryCallTypes(row); - setSecondaryCallTypes(row); + setFeatureIcons(row); + setCallTypeIcon(row); setPhoneAccounts(row); setOnClickListenerForRow(row); setOnClickListenerForMenuButon(row); } private void setNumberCalls(CoalescedRow row) { - // TODO(zachh): Number of calls shouldn't be text, but a circle with a number inside. int numberCalls = row.coalescedIds().getCoalescedIdCount(); if (numberCalls > 1) { - primaryTextView.append(String.format(Locale.getDefault(), " (%d)", numberCalls)); + callCountTextView.setText(String.format(Locale.getDefault(), "(%d)", numberCalls)); + callCountTextView.setVisibility(View.VISIBLE); + } else { + callCountTextView.setVisibility(View.GONE); } } @@ -149,22 +162,75 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { return TextUtils.isEmpty(uri) ? null : Uri.parse(uri); } - private void setPrimaryCallTypes(CoalescedRow row) { - primaryCallTypeIconsView.setShowHd( - (row.features() & Calls.FEATURES_HD_CALL) == Calls.FEATURES_HD_CALL); - primaryCallTypeIconsView.setShowWifi( - MotorolaUtils.shouldShowWifiIconInCallLog(context, row.features())); - primaryCallTypeIconsView.setShowAssistedDialed( - (row.features() & TelephonyManagerCompat.FEATURES_ASSISTED_DIALING) - == TelephonyManagerCompat.FEATURES_ASSISTED_DIALING); + private void setFeatureIcons(CoalescedRow row) { + ColorStateList colorStateList = + ColorStateList.valueOf( + context.getColor( + isNewMissedCall(row) + ? R.color.feature_icon_unread_color + : R.color.feature_icon_read_color)); + + // Handle HD Icon + if ((row.features() & Calls.FEATURES_HD_CALL) == Calls.FEATURES_HD_CALL) { + hdIcon.setVisibility(View.VISIBLE); + hdIcon.setImageTintList(colorStateList); + } else { + hdIcon.setVisibility(View.GONE); + } + + // Handle Wifi Icon + if (MotorolaUtils.shouldShowWifiIconInCallLog(context, row.features())) { + wifiIcon.setVisibility(View.VISIBLE); + wifiIcon.setImageTintList(colorStateList); + } else { + wifiIcon.setVisibility(View.GONE); + } + + // Handle Assisted Dialing Icon + if ((row.features() & TelephonyManagerCompat.FEATURES_ASSISTED_DIALING) + == TelephonyManagerCompat.FEATURES_ASSISTED_DIALING) { + assistedDialIcon.setVisibility(View.VISIBLE); + assistedDialIcon.setImageTintList(colorStateList); + } else { + assistedDialIcon.setVisibility(View.GONE); + } } - private void setSecondaryCallTypes(CoalescedRow row) { - // Only call type icon is shown before the secondary text. - secondaryCallTypeIconsView.clear(); - secondaryCallTypeIconsView.add(row.callType()); + private void setCallTypeIcon(CoalescedRow row) { + @DrawableRes int resId; + switch (row.callType()) { + case AppCompatConstants.CALLS_INCOMING_TYPE: + case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE: + resId = R.drawable.quantum_ic_call_received_vd_theme_24; + break; + case AppCompatConstants.CALLS_OUTGOING_TYPE: + resId = R.drawable.quantum_ic_call_made_vd_theme_24; + break; + case AppCompatConstants.CALLS_MISSED_TYPE: + resId = R.drawable.quantum_ic_call_missed_vd_theme_24; + break; + case AppCompatConstants.CALLS_VOICEMAIL_TYPE: + throw new IllegalStateException("Voicemails not expected in call log"); + case AppCompatConstants.CALLS_BLOCKED_TYPE: + resId = R.drawable.quantum_ic_block_vd_theme_24; + break; + default: + // It is possible for users to end up with calls with unknown call types in their + // call history, possibly due to 3rd party call log implementations (e.g. to + // distinguish between rejected and missed calls). Instead of crashing, just + // assume that all unknown call types are missed calls. + resId = R.drawable.quantum_ic_call_missed_vd_theme_24; + break; + } + callTypeIcon.setImageResource(resId); - // TODO(zachh): Per new mocks, may need to add method to CallTypeIconsView to disable coloring. + if (isNewMissedCall(row)) { + callTypeIcon.setImageTintList( + ColorStateList.valueOf(context.getColor(R.color.call_type_icon_unread_color))); + } else { + callTypeIcon.setImageTintList( + ColorStateList.valueOf(context.getColor(R.color.call_type_icon_read_color))); + } } private void setPhoneAccounts(CoalescedRow row) { @@ -172,6 +238,8 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { phoneAccountView.setText(row.phoneAccountLabel()); phoneAccountView.setTextColor(row.phoneAccountColor()); phoneAccountView.setVisibility(View.VISIBLE); + } else { + phoneAccountView.setVisibility(View.GONE); } } 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 77ba68124..093f866fc 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 @@ -19,33 +19,31 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/call_log_entry_top_margin" - android:paddingTop="@dimen/call_log_entry_padding_top_start" - android:paddingBottom="@dimen/call_log_entry_padding_bottom_end" - android:paddingStart="@dimen/call_log_entry_padding_top_start" - android:paddingEnd="@dimen/call_log_entry_padding_bottom_end" - android:gravity="center_vertical"> + android:minHeight="72dp"> - + + android:layout_toStartOf="@+id/menu_button"> - + android:layout_weight="1" + android:layout_marginEnd="6dp" + android:ellipsize="end" + android:lineSpacingMultiplier="1.5" + android:singleLine="true"/> - - - + - - + - - + android:layout_height="18dp" + android:layout_gravity="center_vertical" + android:src="@drawable/quantum_ic_language_vd_theme_24" + /> + android:layout_marginEnd="6dp" + android:lineSpacingMultiplier="1.5"/> + + + + + + + android:ellipsize="end" + android:lineSpacingMultiplier="1.4" + android:singleLine="true"/> + + + android:layout_height="wrap_content"> + android:layout_marginStart="16dp" + android:layout_marginTop="8dp" + android:layout_centerVertical="true" + android:layout_gravity="center_vertical"/> diff --git a/java/com/android/dialer/calllog/ui/res/values/colors.xml b/java/com/android/dialer/calllog/ui/res/values/colors.xml new file mode 100644 index 000000000..0a6d512ef --- /dev/null +++ b/java/com/android/dialer/calllog/ui/res/values/colors.xml @@ -0,0 +1,24 @@ + + + + + #9E9E9E + #474747 + + #757575 + #D32F2F + \ No newline at end of file diff --git a/java/com/android/dialer/calllog/ui/res/values/dimens.xml b/java/com/android/dialer/calllog/ui/res/values/dimens.xml deleted file mode 100644 index bfb4c99d7..000000000 --- a/java/com/android/dialer/calllog/ui/res/values/dimens.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - 6dp - 16dp - 12dp - 48dp - 4dp - 8dp - 48dp - - diff --git a/java/com/android/dialer/calllog/ui/res/values/styles.xml b/java/com/android/dialer/calllog/ui/res/values/styles.xml index f8502370a..d521feed4 100644 --- a/java/com/android/dialer/calllog/ui/res/values/styles.xml +++ b/java/com/android/dialer/calllog/ui/res/values/styles.xml @@ -31,9 +31,17 @@ sans-serif + + + + \ No newline at end of file diff --git a/java/com/android/dialer/oem/MotorolaUtils.java b/java/com/android/dialer/oem/MotorolaUtils.java index 5a0800eeb..c1e2da256 100644 --- a/java/com/android/dialer/oem/MotorolaUtils.java +++ b/java/com/android/dialer/oem/MotorolaUtils.java @@ -18,6 +18,7 @@ package com.android.dialer.oem; import android.content.Context; import android.content.res.Resources; import android.provider.CallLog.Calls; +import android.support.annotation.VisibleForTesting; import android.telephony.TelephonyManager; import com.android.dialer.common.LogUtil; import com.android.dialer.common.PackageUtils; @@ -40,7 +41,7 @@ public class MotorolaUtils { private static final String HD_CALL_FEATRURE = "com.motorola.software.sprint.hd_call"; // This is used to check if a Motorola device supports WiFi call feature, by checking if a certain // package is enabled. - private static final String WIFI_CALL_PACKAGE_NAME = "com.motorola.sprintwfc"; + @VisibleForTesting public static final String WIFI_CALL_PACKAGE_NAME = "com.motorola.sprintwfc"; // Thi is used to check if a Motorola device supports hidden menu feature. private static final String HIDDEN_MENU_FEATURE = "com.motorola.software.sprint.hidden_menu"; @@ -126,4 +127,10 @@ public class MotorolaUtils { } return supportSprintWifiCall; } + + @VisibleForTesting + public static void resetForTest() { + hasCheckedSprintWifiCall = false; + supportSprintWifiCall = false; + } } diff --git a/java/com/android/dialer/theme/res/values/themes.xml b/java/com/android/dialer/theme/res/values/themes.xml index 0c07f3794..1c5706623 100644 --- a/java/com/android/dialer/theme/res/values/themes.xml +++ b/java/com/android/dialer/theme/res/values/themes.xml @@ -69,4 +69,11 @@ end 1 + + + -- cgit v1.2.3