Redlines for call history screen, as well as most recent call log

* Add and change background and layout for CallLogListItem
* Create wrapper view for most recent call log item
* Change actionbar background in Call History activity
* Hide phone number in call log items
* Add tab indicator drawables

Change-Id: Ic86c3fac857971aba58ba3ac1d79ddebaf663da6
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e66733c..c576cd7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -175,7 +175,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.TAB" />
             </intent-filter>
-             -->
+            -->
         </activity>
 
         <activity android:name="com.android.dialer.calllog.NewCallLogActivity"
diff --git a/res/drawable-hdpi/dialer_recent_card_bg.9.png b/res/drawable-hdpi/dialer_recent_card_bg.9.png
new file mode 100644
index 0000000..e581943
--- /dev/null
+++ b/res/drawable-hdpi/dialer_recent_card_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/dialer_recent_card_bg.9.png b/res/drawable-mdpi/dialer_recent_card_bg.9.png
new file mode 100644
index 0000000..cb1d26f
--- /dev/null
+++ b/res/drawable-mdpi/dialer_recent_card_bg.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/dialer_recent_card_bg.9.png b/res/drawable-xhdpi/dialer_recent_card_bg.9.png
new file mode 100644
index 0000000..e1a4b67
--- /dev/null
+++ b/res/drawable-xhdpi/dialer_recent_card_bg.9.png
Binary files differ
diff --git a/res/drawable/action_bar_tab.xml b/res/drawable/action_bar_tab.xml
new file mode 100644
index 0000000..35df053
--- /dev/null
+++ b/res/drawable/action_bar_tab.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:drawable="@drawable/tab_selected_pressed" android:state_pressed="true" android:state_selected="true"/>
+    <item android:drawable="@drawable/tab_selected_focused" android:state_focused="true" android:state_selected="true"/>
+    <item android:drawable="@drawable/tab_selected" android:state_selected="true"/>
+    <item android:drawable="@drawable/tab_unselected_pressed" android:state_pressed="true"/>
+    <item android:drawable="@drawable/tab_unselected_focused" android:state_focused="true"/>
+
+</selector>
\ No newline at end of file
diff --git a/res/drawable/bottom_border_background.xml b/res/drawable/bottom_border_background.xml
index 9a35e8a..7dad5a4 100644
--- a/res/drawable/bottom_border_background.xml
+++ b/res/drawable/bottom_border_background.xml
@@ -23,7 +23,7 @@
 </item>
 <item>
     <shape android:shape="rectangle" >
-        <solid android:color="@color/background_dial_holo_light" />
+        <solid android:color="@color/background_dialer_list_items" />
     </shape>
 </item>
 </layer-list>
\ No newline at end of file
diff --git a/res/drawable/call_history_actionbar_background.xml b/res/drawable/call_history_actionbar_background.xml
new file mode 100644
index 0000000..f781f27
--- /dev/null
+++ b/res/drawable/call_history_actionbar_background.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item>
+        <shape android:shape="rectangle">
+            <solid android:color="#c6c6c6" />
+        </shape>
+    </item>
+    <item android:bottom="1dip">
+        <shape android:shape="rectangle">
+            <solid android:color="@color/actionbar_background_color" />
+        </shape>
+    </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/tab_selected.xml b/res/drawable/tab_selected.xml
new file mode 100644
index 0000000..25d76fc
--- /dev/null
+++ b/res/drawable/tab_selected.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="#7d7d7d" />
+        </shape>
+    </item>
+    <item android:bottom="6dp">
+        <shape android:shape="rectangle" >
+            <solid android:color="@color/actionbar_background_color" />
+        </shape>
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/tab_selected_focused.xml b/res/drawable/tab_selected_focused.xml
new file mode 100644
index 0000000..8efd7b3
--- /dev/null
+++ b/res/drawable/tab_selected_focused.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="#7d7d7d" />
+        </shape>
+    </item>
+    <item android:bottom="6dp">
+        <shape android:shape="rectangle" >
+            <solid android:color="@color/actionbar_background_color" />
+        </shape>
+    </item>
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="#27ffffff" />
+        </shape>
+    </item>
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="#00000000" />
+
+            <stroke
+                android:width="2dp"
+                android:color="#27ffffff" />
+        </shape>
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/tab_selected_pressed.xml b/res/drawable/tab_selected_pressed.xml
new file mode 100644
index 0000000..a38344e
--- /dev/null
+++ b/res/drawable/tab_selected_pressed.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="#7d7d7d" />
+        </shape>
+    </item>
+    <item android:bottom="6dp">
+        <shape android:shape="rectangle" >
+            <solid android:color="@color/actionbar_background_color" />
+        </shape>
+    </item>
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="#4dffffff" />
+        </shape>
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/tab_unselected_focused.xml b/res/drawable/tab_unselected_focused.xml
new file mode 100644
index 0000000..2aceb63
--- /dev/null
+++ b/res/drawable/tab_unselected_focused.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="#27ffffff" />
+        </shape>
+    </item>
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="#00000000" />
+
+            <stroke
+                android:width="2dp"
+                android:color="#27ffffff" />
+        </shape>
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/tab_unselected_pressed.xml b/res/drawable/tab_unselected_pressed.xml
new file mode 100644
index 0000000..2362b65
--- /dev/null
+++ b/res/drawable/tab_unselected_pressed.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="#4dffffff" />
+        </shape>
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/res/layout/new_call_log_list_item.xml b/res/layout/new_call_log_list_item.xml
index c674f2e..5a6c446 100644
--- a/res/layout/new_call_log_list_item.xml
+++ b/res/layout/new_call_log_list_item.xml
@@ -20,6 +20,7 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
+    android:background="@drawable/bottom_border_background"
 >
     <!--
         This layout may represent either a call log item or one of the
@@ -52,11 +53,10 @@
                 android:layout_height="@dimen/call_log_list_contact_photo_size"
                 android:nextFocusRight="@id/primary_action_view"
                 android:layout_alignParentStart="true"
-                android:layout_centerVertical="true"
                 android:focusable="true"
             />
             <LinearLayout
-                android:layout_width="wrap_content"
+                android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
                 android:paddingTop="@dimen/call_log_inner_margin"
@@ -80,16 +80,6 @@
                     android:orientation="horizontal"
                 >
                     <TextView
-                        android:id="@+id/number"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_marginEnd="@dimen/call_log_icon_margin"
-                        android:textColor="?attr/call_log_secondary_text_color"
-                        android:textSize="14sp"
-                        android:singleLine="true"
-                        android:ellipsize="marquee"
-                        />
-                    <TextView
                         android:id="@+id/label"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 2534cb5..df4b2f4 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -44,7 +44,10 @@
     <color name="item_selected">#660099cc</color>
 
     <!-- Background color of new dialer activity -->
-    <color name="background_dial_holo_light">#f5f5f5</color>
+    <color name="background_dialer_light">#cecece</color>
+
+    <!-- Background color of dialer list items (contacts, call log entries) -->
+    <color name="background_dialer_list_items">#f5f5f5</color>
 
     <!-- Background color of new dialpad -->
     <color name="background_dialpad">#ee020709</color>
@@ -55,7 +58,7 @@
         -->
     <color name="dialpad_secondary_text_color">#888888</color>
 
-    <!-- Background color of fake action bar in the favorites fragment -->
+    <!-- Background color of action bars -->
     <color name="actionbar_background_color">#e6e6e6</color>
 
     <!-- Color of the 1dp divider that separates favorites -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 0c5d22e..0ab27c3 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -57,10 +57,11 @@
     <dimen name="smartdial_suggestions_extra_padding">2dp</dimen>
     <dimen name="smartdial_confidence_hint_text_size">27dp</dimen>
 
-    <!--  Favorites tile padding -->
+    <!--  Favorites tile and recent call log padding -->
     <dimen name="phone_contact_tile_divider_padding">3dp</dimen>
     <dimen name="favorites_row_top_padding">8dp</dimen>
     <dimen name="favorites_row_bottom_padding">8dp</dimen>
     <dimen name="favorites_row_start_padding">8dp</dimen>
     <dimen name="favorites_row_end_padding">8dp</dimen>
+    <dimen name="recent_call_log_item_padding">8dp</dimen>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 5932294..0cdf223 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -71,8 +71,9 @@
         <item name="android:textColorSecondary">@color/dialtacts_secondary_text_color</item>
         <item name="android:windowActionBarOverlay">true</item>
         <item name="android:actionBarStyle">@style/DialtactsActionBarStyleNew</item>
+        <item name="android:actionBarTabStyle">@style/DialtactsActionBarTabStyle</item>
         <item name="android:windowContentOverlay">@null</item>
-        <item name="android:windowBackground">@color/background_dial_holo_light</item>
+        <item name="android:windowBackground">@color/background_dialer_light</item>
         <!--  Searchbox Style -->
         <item name="android:editTextStyle">@style/DialtactsSearchboxStyle</item>
         <item name="android:listViewStyle">@style/ListViewStyle</item>
@@ -168,8 +169,8 @@
     </style>
 
     <style name="DialtactsActionBarStyleNew" parent="android:Widget.Holo.ActionBar">
-        <item name="android:backgroundSplit">@null</item>
-        <item name="android:background">@color/actionbar_background_color</item>
+        <item name="android:background">@drawable/call_history_actionbar_background</item>
+        <item name="android:backgroundStacked">@color/actionbar_background_color</item>
         <!-- Empty icon -->
         <item name="android:icon">@android:color/transparent</item>
         <item name="android:displayOptions"></item>
@@ -181,6 +182,10 @@
         <item name="android:displayOptions"></item>
     </style>
 
+    <style name="DialtactsActionBarTabStyle" parent="@android:style/Widget.Holo.ActionBar.TabView">
+        <item name="android:background">@drawable/action_bar_tab</item>
+    </style>
+
     <style name="ListViewStyle" parent="@android:style/Widget.Holo.Light.ListView">
         <item name="android:overScrollMode">always</item>
     </style>
diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java
index 37394c3..0da0d0c 100644
--- a/src/com/android/dialer/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/PhoneCallDetailsHelper.java
@@ -115,19 +115,25 @@
             } else {
                 numberText = details.geocode;
             }
-            labelText = null;
+            labelText = numberText;
             // We have a real phone number as "nameView" so make it always LTR
             views.nameView.setTextDirection(View.TEXT_DIRECTION_LTR);
         } else {
             nameText = details.name;
             numberText = displayNumber;
-            labelText = numberFormattedLabel;
+            labelText = TextUtils.isEmpty(numberFormattedLabel) ? numberText :
+                    numberFormattedLabel;
             // We have a real phone number as "numberView" so make it always LTR
-            views.numberView.setTextDirection(View.TEXT_DIRECTION_LTR);
+            if (views.numberView != null) {
+                views.numberView.setTextDirection(View.TEXT_DIRECTION_LTR);
+            }
         }
 
         views.nameView.setText(nameText);
-        views.numberView.setText(numberText);
+        if (views.numberView != null) {
+            views.numberView.setText(numberText);
+        }
+
         views.labelView.setText(labelText);
         views.labelView.setVisibility(TextUtils.isEmpty(labelText) ? View.GONE : View.VISIBLE);
     }
diff --git a/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java
index fff5c9f..742892b 100644
--- a/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java
+++ b/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java
@@ -23,6 +23,7 @@
 import android.view.ViewGroup;
 import android.widget.BaseAdapter;
 import android.widget.FrameLayout;
+import android.widget.LinearLayout;
 import android.widget.SectionIndexer;
 
 import com.android.contacts.common.list.ContactEntryListAdapter;
@@ -60,6 +61,9 @@
 
     private final int mItemPaddingLeft;
     private final int mItemPaddingRight;
+    private final int mCallLogPadding;
+
+    private final Context mContext;
 
     private final DataSetObserver mObserver;
 
@@ -70,8 +74,10 @@
             NewCallLogAdapter callLogAdapter,
             View loadingView) {
         final Resources resources = context.getResources();
+        mContext = context;
         mItemPaddingLeft = resources.getDimensionPixelSize(R.dimen.detail_item_side_margin);
         mItemPaddingRight = resources.getDimensionPixelSize(R.dimen.list_visible_scrollbar_padding);
+        mCallLogPadding = resources.getDimensionPixelSize(R.dimen.recent_call_log_item_padding);
         mContactTileAdapter = contactTileAdapter;
         mContactEntryListAdapter = contactEntryListAdapter;
         mCallLogAdapter = callLogAdapter;
@@ -237,8 +243,32 @@
         // TODO krelease: Handle the new callLogAdapterCount and position offsets properly
         if (callLogAdapterCount > 0) {
             if (position == 0) {
-                final View view = mCallLogAdapter.getView(position, convertView, parent);
-                return view;
+                final FrameLayout wrapper;
+                if (convertView == null) {
+                    wrapper = new FrameLayout(mContext);
+                } else {
+                    wrapper = (FrameLayout) convertView;
+                }
+
+                // Special case wrapper view for the most recent call log item. This allows
+                // us to create a card-like effect for the more recent call log item in
+                // the PhoneFavoriteMergedAdapter, but keep the original look of the item in
+                // the CallLogAdapter.
+                final View view = mCallLogAdapter.getView(position, convertView == null ?
+                        null : wrapper.getChildAt(0), parent);
+                wrapper.removeAllViews();
+                view.setBackgroundResource(R.drawable.dialer_recent_card_bg);
+
+                final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
+                        FrameLayout.LayoutParams.WRAP_CONTENT,
+                        FrameLayout.LayoutParams.WRAP_CONTENT);
+
+                params.setMarginsRelative(mCallLogPadding, mCallLogPadding, mCallLogPadding,
+                        mCallLogPadding);
+                view.setLayoutParams(params);
+                wrapper.addView(view);
+
+                return wrapper;
             }
             position -= callLogAdapterCount;
         }