From f3170880408642ca4389cd6c85b71eeecee4bced Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 10 Apr 2015 17:28:26 -0700 Subject: Cardify the call log list items! + Added card view dependencies to makefile. + Convert call log list items to use card views. + Cleaned up code style and unused views in fragment xml. - Removed deprecated expand code (more work to be done here). - Removed now-unused constants. Bug: 19372817 Change-Id: I237cf214f8f052de5fb1f41908d6012f52de994e --- Android.mk | 5 +- res/layout/call_log_fragment.xml | 34 ++---------- res/layout/call_log_list_item.xml | 62 ++++++++++++---------- res/values/colors.xml | 3 +- res/values/dimens.xml | 2 - .../dialer/calllog/CallLogListItemViews.java | 22 ++------ 6 files changed, 50 insertions(+), 78 deletions(-) diff --git a/Android.mk b/Android.mk index b029189e8..baf71ad22 100644 --- a/Android.mk +++ b/Android.mk @@ -18,10 +18,12 @@ res_dirs := res \ $(phone_common_dir)/res LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs)) -LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs)) +LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs)) \ + frameworks/support/v7/cardview/res LOCAL_AAPT_FLAGS := \ --auto-add-overlay \ + --extra-packages android.support.v7.cardview \ --extra-packages android.support.v7.recyclerview \ --extra-packages com.android.incallui \ --extra-packages com.android.contacts.common \ @@ -33,6 +35,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ android-ex-variablespeed \ android-support-v13 \ android-support-v4 \ + android-support-v7-cardview \ android-support-v7-recyclerview \ com.android.services.telephony.common \ com.android.vcard \ diff --git a/res/layout/call_log_fragment.xml b/res/layout/call_log_fragment.xml index c126b778b..ff0d58e00 100644 --- a/res/layout/call_log_fragment.xml +++ b/res/layout/call_log_fragment.xml @@ -28,36 +28,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="gone"> - - - - - + + + @@ -65,7 +40,8 @@ + android:background="@color/background_dialer_list_items" + android:padding="8dp" /> - + android:gravity="center_vertical" + card_view:cardCornerRadius="4dp" + card_view:cardBackgroundColor="@color/background_dialer_list_items"> + + android:focusable="true" /> + + android:layout_marginStart="@dimen/call_log_start_margin"> + + android:singleLine="true" /> + + android:visibility="gone" /> + + android:orientation="horizontal"> + + android:layout_gravity="center_vertical" /> + + android:singleLine="true" /> + + + android:singleLine="true" /> + + + android:visibility="gone" /> + + + + - - - + diff --git a/res/values/colors.xml b/res/values/colors.xml index f697cc8cc..2954d75ba 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -58,7 +58,7 @@ #f9f9f9 - @color/background_dialer_light + @color/background_dialer_white @color/background_dialer_results @@ -84,7 +84,6 @@ #16000000 - #ffffff @color/dialer_theme_color diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 9de20f310..0902cb70d 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -111,8 +111,6 @@ 12sp 44dp - - 2dp 15dp 9dp diff --git a/src/com/android/dialer/calllog/CallLogListItemViews.java b/src/com/android/dialer/calllog/CallLogListItemViews.java index f2bed531f..4d4343692 100644 --- a/src/com/android/dialer/calllog/CallLogListItemViews.java +++ b/src/com/android/dialer/calllog/CallLogListItemViews.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.res.Resources; import android.net.Uri; import android.provider.CallLog.Calls; +import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; @@ -57,7 +58,7 @@ public final class CallLogListItemViews extends RecyclerView.ViewHolder { /** The text of the header for a day grouping. */ public final TextView dayGroupHeader; /** The view containing the details for the call log row, including the action buttons. */ - public final View callLogEntryView; + public final CardView callLogEntryView; /** The view containing call log item actions. Null until the ViewStub is inflated. */ public View actionsView; /** The "call back" action button - assigned only when the action section is expanded. */ @@ -136,9 +137,6 @@ public final class CallLogListItemViews extends RecyclerView.ViewHolder { private Context mContext; private int mPhotoSize; - private int mCallLogBackgroundColor; - private int mExpandedBackgroundColor; - private float mExpandedTranslationZ; private CallLogListItemViews( Context context, @@ -146,7 +144,7 @@ public final class CallLogListItemViews extends RecyclerView.ViewHolder { QuickContactBadge quickContactView, View primaryActionView, PhoneCallDetailsViews phoneCallDetailsViews, - View callLogEntryView, + CardView callLogEntryView, TextView dayGroupHeader) { super(rootView); mContext = context; @@ -159,9 +157,6 @@ public final class CallLogListItemViews extends RecyclerView.ViewHolder { this.dayGroupHeader = dayGroupHeader; Resources resources = mContext.getResources(); - mCallLogBackgroundColor = resources.getColor(R.color.background_dialer_list_items); - mExpandedBackgroundColor = resources.getColor(R.color.call_log_expanded_background_color); - mExpandedTranslationZ = resources.getDimension(R.dimen.call_log_expanded_translation_z); mPhotoSize = mContext.getResources().getDimensionPixelSize(R.dimen.contact_photo_size); } @@ -172,7 +167,7 @@ public final class CallLogListItemViews extends RecyclerView.ViewHolder { (QuickContactBadge) view.findViewById(R.id.quick_contact_photo), view.findViewById(R.id.primary_action_view), PhoneCallDetailsViews.fromView(view), - view.findViewById(R.id.call_log_row), + (CardView) view.findViewById(R.id.call_log_row), (TextView) view.findViewById(R.id.call_log_day_group_label)); } @@ -324,19 +319,12 @@ public final class CallLogListItemViews extends RecyclerView.ViewHolder { actionsView.setVisibility(View.VISIBLE); actionsView.setAlpha(1.0f); - callLogEntryView.setBackgroundColor(mExpandedBackgroundColor); - callLogEntryView.setTranslationZ(mExpandedTranslationZ); - rootView.setTranslationZ(mExpandedTranslationZ); // WAR } 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); } - - callLogEntryView.setBackgroundColor(mCallLogBackgroundColor); - callLogEntryView.setTranslationZ(0); - rootView.setTranslationZ(0); // WAR } } @@ -390,7 +378,7 @@ public final class CallLogListItemViews extends RecyclerView.ViewHolder { new QuickContactBadge(context), new View(context), PhoneCallDetailsViews.createForTest(context), - new View(context), + new CardView(context), new TextView(context)); views.callBackButtonView = new TextView(context); views.voicemailButtonView = new TextView(context); -- cgit v1.2.3