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
diff --git a/Android.mk b/Android.mk
index b029189..baf71ad 100644
--- a/Android.mk
+++ b/Android.mk
@@ -18,10 +18,12 @@
     $(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 @@
     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 c126b77..ff0d58e 100644
--- a/res/layout/call_log_fragment.xml
+++ b/res/layout/call_log_fragment.xml
@@ -28,44 +28,20 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:visibility="gone">
-        <include layout="@layout/call_log_voicemail_status"
-    />
+
+        <include layout="@layout/call_log_voicemail_status" />
+
     </FrameLayout>
 
     <FrameLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-        <TextView
-            android:id="@+id/filter_status"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            style="@style/ContactListSeparatorTextViewStyle"
-            android:layout_marginStart="@dimen/call_log_outer_margin"
-            android:layout_marginEnd="@dimen/call_log_outer_margin"
-            android:paddingTop="@dimen/call_log_inner_margin"
-            android:paddingBottom="@dimen/call_log_inner_margin"
-            android:layout_alignParentStart="true"
-            android:layout_alignParentBottom="true"
-            android:visibility="gone"
-            />
-        <View
-            android:id="@+id/call_log_divider"
-            android:layout_width="match_parent"
-            android:layout_height="1px"
-            android:layout_marginStart="@dimen/call_log_outer_margin"
-            android:layout_marginEnd="@dimen/call_log_outer_margin"
-            android:layout_gravity="bottom"
-            android:background="#55ffffff"
-            />
-    </FrameLayout>
-    <FrameLayout
-        android:layout_width="match_parent"
         android:layout_height="match_parent">
 
         <android.support.v7.widget.RecyclerView android:id="@+id/recycler_view"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:background="@color/background_dialer_list_items" />
+            android:background="@color/background_dialer_list_items"
+            android:padding="8dp" />
 
         <include
             android:id="@+id/empty_list_view"
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 910e78f..1fbc579 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -37,13 +37,17 @@
 
     <!-- Linear layout to separate the primary area containing the contact badge and caller
          information and the secondary action (call details / play voicemail). -->
-    <LinearLayout
+    <android.support.v7.widget.CardView
+        xmlns:card_view="http://schemas.android.com/apk/res-auto"
         android:id="@+id/call_log_row"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:layout_margin="4dp"
         android:baselineAligned="false"
         android:orientation="vertical"
-        android:gravity="center_vertical" >
+        android:gravity="center_vertical"
+        card_view:cardCornerRadius="4dp"
+        card_view:cardBackgroundColor="@color/background_dialer_list_items">
 
         <!-- Primary area containing the contact badge and caller information -->
         <LinearLayout
@@ -60,6 +64,7 @@
             android:focusable="true"
             android:nextFocusRight="@+id/call_back_action"
             android:nextFocusLeft="@+id/quick_contact_photo" >
+
             <QuickContactBadge
                 android:id="@+id/quick_contact_photo"
                 android:layout_width="@dimen/contact_photo_size"
@@ -67,16 +72,16 @@
                 android:paddingTop="2dp"
                 android:nextFocusRight="@id/primary_action_view"
                 android:layout_gravity="top"
-                android:focusable="true"
-                />
+                android:focusable="true" />
+
             <LinearLayout
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
                 android:orientation="vertical"
                 android:gravity="center_vertical"
-                android:layout_marginStart="@dimen/call_log_start_margin"
-                >
+                android:layout_marginStart="@dimen/call_log_start_margin">
+
                 <TextView
                     android:id="@+id/name"
                     android:layout_width="wrap_content"
@@ -85,8 +90,8 @@
                     android:layout_marginEnd="@dimen/call_log_icon_margin"
                     android:textColor="?attr/call_log_primary_text_color"
                     android:textSize="@dimen/call_log_primary_text_size"
-                    android:singleLine="true"
-                    />
+                    android:singleLine="true" />
+
                 <TextView
                     android:id="@+id/voicemail_transcription"
                     android:layout_width="wrap_content"
@@ -96,22 +101,22 @@
                     android:textSize="@dimen/call_log_secondary_text_size"
                     android:singleLine="true"
                     android:ellipsize="marquee"
-                    android:visibility="gone"
-                    />
+                    android:visibility="gone" />
+
                 <LinearLayout
                     android:id="@+id/call_type"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:orientation="horizontal"
-                    >
+                    android:orientation="horizontal">
+
                     <view
                         class="com.android.dialer.calllog.CallTypeIconsView"
                         android:id="@+id/call_type_icons"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:layout_marginEnd="@dimen/call_log_icon_margin"
-                        android:layout_gravity="center_vertical"
-                        />
+                        android:layout_gravity="center_vertical" />
+
                     <TextView
                         android:id="@+id/call_location_and_date"
                         android:layout_width="wrap_content"
@@ -120,9 +125,10 @@
                         android:layout_gravity="center_vertical"
                         android:textColor="?attr/call_log_secondary_text_color"
                         android:textSize="@dimen/call_log_secondary_text_size"
-                        android:singleLine="true"
-                        />
+                        android:singleLine="true" />
+
                 </LinearLayout>
+
                 <TextView
                     android:id="@+id/call_account_label"
                     android:layout_width="wrap_content"
@@ -131,9 +137,10 @@
                     android:textColor="?attr/call_log_secondary_text_color"
                     android:textSize="@dimen/call_log_secondary_text_size"
                     android:visibility="gone"
-                    android:singleLine="true"
-                    />
+                    android:singleLine="true" />
+
             </LinearLayout>
+
             <ImageView
                 android:id="@+id/call_indicator_icon"
                 android:layout_width="wrap_content"
@@ -144,16 +151,17 @@
                 android:tint="@color/recent_call_log_item_phone_icon_tint"
                 android:alpha="0.3"
                 android:importantForAccessibility="no"
-                android:visibility="gone"
-                />
+                android:visibility="gone" />
+
+            <!-- Viewstub with additional expandable actions for a call log entry -->
+            <ViewStub android:id="@+id/call_log_entry_actions_stub"
+                      android:inflatedId="@+id/call_log_entry_actions"
+                      android:layout="@layout/call_log_list_item_actions"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"/>
+
         </LinearLayout>
 
-        <!-- Viewstub with additional expandable actions for a call log entry -->
-        <ViewStub android:id="@+id/call_log_entry_actions_stub"
-                  android:inflatedId="@+id/call_log_entry_actions"
-                  android:layout="@layout/call_log_list_item_actions"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"/>
-    </LinearLayout>
+    </android.support.v7.widget.CardView>
 
 </LinearLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index f697cc8..2954d75 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -58,7 +58,7 @@
     <!-- Background color for search results and call details -->
     <color name="background_dialer_results">#f9f9f9</color>
     <!-- Background color of dialer list items (contacts, call log entries) -->
-    <color name="background_dialer_list_items">@color/background_dialer_light</color>
+    <color name="background_dialer_list_items">@color/background_dialer_white</color>
     <color name="background_dialer_details_list_items">@color/background_dialer_results</color>
 
     <!-- Color of the 1dp divider that separates favorites -->
@@ -84,7 +84,6 @@
     <!-- Color of the bottom border below the contacts grid on the main dialer screen. -->
     <color name="contacts_grid_bottom_border_color">#16000000</color>
 
-    <color name="call_log_expanded_background_color">#ffffff</color>
     <!-- Color of actions in expanded call log entries.  This text color represents actions such
          as call back, play voicemail, etc. -->
     <color name="call_log_action_text">@color/dialer_theme_color</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 9de20f3..0902cb7 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -111,8 +111,6 @@
     <dimen name="call_log_list_item_actions_text_size">12sp</dimen>
     <!-- Height of the call log actions section for each call log entry -->
     <dimen name="call_log_action_height">44dp</dimen>
-    <!-- Z Translation of expanded call log items. -->
-    <dimen name="call_log_expanded_translation_z">2dp</dimen>
     <dimen name="call_log_day_group_padding_top">15dp</dimen>
     <dimen name="call_log_day_group_padding_bottom">9dp</dimen>
 
diff --git a/src/com/android/dialer/calllog/CallLogListItemViews.java b/src/com/android/dialer/calllog/CallLogListItemViews.java
index f2bed53..4d43436 100644
--- a/src/com/android/dialer/calllog/CallLogListItemViews.java
+++ b/src/com/android/dialer/calllog/CallLogListItemViews.java
@@ -20,6 +20,7 @@
 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 @@
     /** 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 @@
     private Context mContext;
     private int mPhotoSize;
 
-    private int mCallLogBackgroundColor;
-    private int mExpandedBackgroundColor;
-    private float mExpandedTranslationZ;
 
     private CallLogListItemViews(
             Context context,
@@ -146,7 +144,7 @@
             QuickContactBadge quickContactView,
             View primaryActionView,
             PhoneCallDetailsViews phoneCallDetailsViews,
-            View callLogEntryView,
+            CardView callLogEntryView,
             TextView dayGroupHeader) {
         super(rootView);
         mContext = context;
@@ -159,9 +157,6 @@
         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 @@
                 (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 @@
 
             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 @@
                 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);