From 9c952d8f2688350f06d65df7852756ab05b6fdab Mon Sep 17 00:00:00 2001 From: wangqi Date: Fri, 29 Jun 2018 12:33:45 -0700 Subject: UI refresh for call log items. Bug: 79877518 Test: manual PiperOrigin-RevId: 202690405 Change-Id: Ibb2c5e81cb244aad25d75dc005bfc92ef775ffe1 --- .../app/calllog/CallLogListItemViewHolder.java | 23 +- .../dialer/app/res/layout/call_log_fragment.xml | 2 - .../dialer/app/res/layout/call_log_list_item.xml | 240 ++++++++++----------- java/com/android/dialer/app/res/values/dimens.xml | 9 +- .../dialer/calllogutils/CallTypeIconsView.java | 20 +- .../dialer/theme/common/res/values/dimens.xml | 2 - .../dialer/theme/common/res/values/styles.xml | 11 +- 7 files changed, 165 insertions(+), 142 deletions(-) diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index e044460c5..c95334695 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -46,6 +46,7 @@ import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; +import android.view.ViewGroup; import android.view.ViewStub; import android.widget.ImageButton; import android.widget.ImageView; @@ -364,6 +365,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper(context, resources, callLogCache); + CardView cardView = new CardView(context); + cardView.setLayoutParams(new ViewGroup.MarginLayoutParams(0, 0)); CallLogListItemViewHolder viewHolder = new CallLogListItemViewHolder( context, @@ -378,7 +381,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder new DialerQuickContactBadge(context), new View(context), PhoneCallDetailsViews.createForTest(context), - new CardView(context), + cardView, new TextView(context), new ImageView(context)); viewHolder.detailsButtonView = new TextView(context); @@ -889,12 +892,30 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder bindActionButtons(); actionsView.setVisibility(View.VISIBLE); actionsView.setAlpha(1.0f); + ViewGroup.MarginLayoutParams layoutParams = + (ViewGroup.MarginLayoutParams) callLogEntryView.getLayoutParams(); + layoutParams.bottomMargin = + context + .getResources() + .getDimensionPixelSize(R.dimen.call_log_card_margin_bottom_expanded); + callLogEntryView.setLayoutParams(layoutParams); + callLogEntryView.setCardElevation( + context.getResources().getDimension(R.dimen.call_log_card_elevation_expanded)); } else { // When recycling a view, it is possible the actionsView ViewStub was previously // inflated so we should hide it in this case. if (actionsView != null) { actionsView.setVisibility(View.GONE); } + ViewGroup.MarginLayoutParams layoutParams = + (ViewGroup.MarginLayoutParams) callLogEntryView.getLayoutParams(); + layoutParams.bottomMargin = + context + .getResources() + .getDimensionPixelSize(R.dimen.call_log_card_margin_bottom_collapsed); + callLogEntryView.setLayoutParams(layoutParams); + callLogEntryView.setCardElevation( + context.getResources().getDimension(R.dimen.call_log_card_elevation_collapsed)); } updatePrimaryActionButton(show); diff --git a/java/com/android/dialer/app/res/layout/call_log_fragment.xml b/java/com/android/dialer/app/res/layout/call_log_fragment.xml index bf91a3a07..5ceff2eba 100644 --- a/java/com/android/dialer/app/res/layout/call_log_fragment.xml +++ b/java/com/android/dialer/app/res/layout/call_log_fragment.xml @@ -62,8 +62,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="@dimen/floating_action_button_list_bottom_padding" - android:paddingStart="@dimen/call_log_horizontal_margin" - android:paddingEnd="@dimen/call_log_horizontal_margin" android:clipToPadding="false"/> + android:id="@+id/call_log_list_item" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + android:id="@+id/call_log_day_group_label" + style="@style/Dialer.TextAppearance.OVERLINE.Ellipsize" + android:layout_width="wrap_content" + android:layout_height="48dp" + android:layout_marginStart="@dimen/call_log_start_margin" + android:layout_marginEnd="@dimen/call_log_outer_margin" + android:layout_gravity="start" + android:gravity="center_vertical"/> + android:id="@+id/call_log_row" + style="@style/CallLogCardStyle"> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + android:id="@+id/primary_action_view" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="@dimen/call_log_vertical_padding" + android:paddingBottom="@dimen/call_log_vertical_padding" + android:paddingStart="@dimen/call_log_start_margin" + android:paddingEnd="@dimen/call_log_outer_margin" + android:background="?android:attr/selectableItemBackground" + android:focusable="true" + android:gravity="center_vertical" + android:nextFocusLeft="@+id/quick_contact_photo" + android:nextFocusRight="@+id/call_back_action" + android:orientation="horizontal"> + android:focusable="true" + android:nextFocusRight="@id/primary_action_view"/> + android:scaleType="fitCenter" + android:src="@drawable/ic_check_mark_48dp" + android:visibility="gone"/> + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_marginStart="@dimen/call_log_list_item_info_margin_start" + android:gravity="center_vertical" + android:orientation="vertical"> + android:id="@+id/name" + style="@style/Dialer.TextAppearance.Primary.Ellipsize" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/call_log_name_margin_bottom" + android:layout_marginEnd="@dimen/call_log_icon_margin"/> - - + android:orientation="horizontal"> + + + android:id="@+id/work_profile_icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/call_log_icon_margin" + android:scaleType="center" + android:src="@drawable/ic_work_profile" + android:visibility="gone"/> + android:id="@+id/call_location_and_date" + style="Dialer.TextAppearance.Secondary.Ellipsize" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/call_log_icon_margin" + android:layout_gravity="center_vertical"/> + android:id="@+id/call_account_label" + style="Dialer.TextAppearance.Secondary2.Ellipsize" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/call_log_call_account_margin_bottom" + android:layout_marginEnd="@dimen/call_log_icon_margin" + android:visibility="gone"/> + android:id="@+id/transcription" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/call_log_icon_margin" + android:orientation="vertical" + android:visibility="gone"> + android:id="@+id/voicemail_transcription" + style="Dialer.TextAppearance.Secondary2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:focusable="true" + android:nextFocusDown="@+id/voicemail_transcription_branding" + android:textIsSelectable="true"/> + android:id="@+id/voicemail_transcription_branding" + style="Dialer.TextAppearance.Secondary2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingTop="2dp" + android:focusable="true" + android:nextFocusDown="@+id/voicemail_transcription_rating" + android:nextFocusUp="@id/voicemail_transcription"/> + android:orientation="horizontal" + android:visibility="gone"> @@ -214,25 +212,25 @@ + android:id="@+id/primary_action_button" + android:layout_width="@dimen/call_log_list_item_primary_action_dimen" + android:layout_height="@dimen/call_log_list_item_primary_action_dimen" + android:layout_gravity="center_vertical" + android:background="?android:attr/selectableItemBackgroundBorderless" + android:scaleType="center" + android:tint="?colorIcon" + android:visibility="gone"/> + android:id="@+id/call_log_entry_actions_stub" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:inflatedId="@+id/call_log_entry_actions" + android:layout="@layout/call_log_list_item_actions"/> diff --git a/java/com/android/dialer/app/res/values/dimens.xml b/java/com/android/dialer/app/res/values/dimens.xml index fdbcac93a..7a1f574ae 100644 --- a/java/com/android/dialer/app/res/values/dimens.xml +++ b/java/com/android/dialer/app/res/values/dimens.xml @@ -29,9 +29,12 @@ 18dp - 8dp - 8dp - 8dp + 16dp + 16dp + 6dp + 0dp + 10dp + 4dp 2dp 2dp 8dp diff --git a/java/com/android/dialer/calllogutils/CallTypeIconsView.java b/java/com/android/dialer/calllogutils/CallTypeIconsView.java index 19c30c575..e268bb896 100644 --- a/java/com/android/dialer/calllogutils/CallTypeIconsView.java +++ b/java/com/android/dialer/calllogutils/CallTypeIconsView.java @@ -290,56 +290,56 @@ public class CallTypeIconsView extends View { int iconId = R.drawable.quantum_ic_call_received_white_24; Drawable drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); incoming = drawable.mutate(); - incoming.setColorFilter(r.getColor(R.color.dialer_call_green), PorterDuff.Mode.MULTIPLY); + incoming.setColorFilter(r.getColor(R.color.dialer_call_green), PorterDuff.Mode.SRC_IN); // Create a rotated instance of the call arrow for outgoing calls. iconId = R.drawable.quantum_ic_call_made_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); outgoing = drawable.mutate(); - outgoing.setColorFilter(r.getColor(R.color.dialer_call_green), PorterDuff.Mode.MULTIPLY); + outgoing.setColorFilter(r.getColor(R.color.dialer_call_green), PorterDuff.Mode.SRC_IN); // Need to make a copy of the arrow drawable, otherwise the same instance colored // above will be recolored here. iconId = R.drawable.quantum_ic_call_missed_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); missed = drawable.mutate(); - missed.setColorFilter(r.getColor(R.color.dialer_red), PorterDuff.Mode.MULTIPLY); + missed.setColorFilter(r.getColor(R.color.dialer_red), PorterDuff.Mode.SRC_IN); Theme theme = ThemeComponent.get(context).theme(); iconId = R.drawable.quantum_ic_voicemail_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); voicemail = drawable.mutate(); - voicemail.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); + voicemail.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.SRC_IN); iconId = R.drawable.quantum_ic_block_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); blocked = drawable.mutate(); - blocked.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); + blocked.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.SRC_IN); iconId = R.drawable.quantum_ic_videocam_vd_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); videoCall = drawable.mutate(); - videoCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); + videoCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.SRC_IN); iconId = R.drawable.quantum_ic_hd_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); hdCall = drawable.mutate(); - hdCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); + hdCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.SRC_IN); iconId = R.drawable.quantum_ic_signal_wifi_4_bar_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); wifiCall = drawable.mutate(); - wifiCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); + wifiCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.SRC_IN); iconId = R.drawable.quantum_ic_language_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); assistedDialedCall = drawable.mutate(); - assistedDialedCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); + assistedDialedCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.SRC_IN); iconId = R.drawable.quantum_ic_rtt_vd_theme_24; drawable = largeIcons ? r.getDrawable(iconId, null) : getScaledBitmap(context, iconId); rttCall = drawable.mutate(); - rttCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY); + rttCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.SRC_IN); iconMargin = largeIcons ? 0 : r.getDimensionPixelSize(R.dimen.call_log_icon_margin); } diff --git a/java/com/android/dialer/theme/common/res/values/dimens.xml b/java/com/android/dialer/theme/common/res/values/dimens.xml index 88b8a0423..fbc386ce3 100644 --- a/java/com/android/dialer/theme/common/res/values/dimens.xml +++ b/java/com/android/dialer/theme/common/res/values/dimens.xml @@ -25,8 +25,6 @@ 14sp 48dp - 15dp - 9dp diff --git a/java/com/android/dialer/theme/common/res/values/styles.xml b/java/com/android/dialer/theme/common/res/values/styles.xml index ac23bdf98..5db08f49a 100644 --- a/java/com/android/dialer/theme/common/res/values/styles.xml +++ b/java/com/android/dialer/theme/common/res/values/styles.xml @@ -20,9 +20,14 @@ @@ -40,4 +45,4 @@ - \ No newline at end of file + -- cgit v1.2.3