Merge "Add touch feedback to QC header"
diff --git a/res/drawable/item_background_material_borderless_dark.xml b/res/drawable/item_background_material_borderless_dark.xml
new file mode 100644
index 0000000..693bcaf
--- /dev/null
+++ b/res/drawable/item_background_material_borderless_dark.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<!-- Based on the Theme.Material's default selectableItemBackgroundBorderless -->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+    android:color="@color/ripple_material_dark" />
\ No newline at end of file
diff --git a/res/drawable/item_background_material_dark.xml b/res/drawable/item_background_material_dark.xml
new file mode 100644
index 0000000..87b1e17
--- /dev/null
+++ b/res/drawable/item_background_material_dark.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<!-- Based on the Theme.Material's default selectableItemBackground -->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+    android:color="@color/ripple_material_dark" >
+    <item android:id="@android:id/mask">
+        <color android:color="@android:color/white" />
+    </item>
+</ripple>
\ No newline at end of file
diff --git a/res/layout/quickcontact_header.xml b/res/layout/quickcontact_header.xml
index 0c51746..50c4af0 100644
--- a/res/layout/quickcontact_header.xml
+++ b/res/layout/quickcontact_header.xml
@@ -28,7 +28,14 @@
         android:id="@+id/photo"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:scaleType="centerCrop"
+        android:clickable="false"
+        android:scaleType="centerCrop" />
+
+    <View
+        android:id="@+id/photo_touch_intercept_overlay"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@drawable/item_background_material_dark"
         android:contentDescription="@string/description_contact_photo" />
 
     <!-- Need to set a non null background on Toolbar in order for MenuItem ripples to be drawn on
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 89f39b8..76de472 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -52,4 +52,7 @@
 
     <color name="call_arrow_green">#2aad6f</color>
     <color name="call_arrow_red">#ff2e58</color>
+
+    <!-- Color of ripples use by Theme.Material. Taken from res/values/colors_material.xml -->
+    <color name="ripple_material_dark">#20ffffff</color>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ef66126..d29074b 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -43,6 +43,9 @@
         <item name="android:windowIsTranslucent">true</item>
         <item name="android:windowNoTitle">true</item>
         <item name="android:listViewStyle">@style/ListViewStyle</item>
+        <!-- We need to use a light ripple behind ActionBar items in order for them to
+             be visible when using some of the darker ActionBar tints -->
+        <item name="android:actionBarItemBackground">@drawable/item_background_material_borderless_dark</item>
     </style>
 
     <style name="PeopleTheme" parent="@android:style/Theme.Material.Light">
diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java
index 18f032a..156c4bd 100644
--- a/src/com/android/contacts/widget/MultiShrinkScroller.java
+++ b/src/com/android/contacts/widget/MultiShrinkScroller.java
@@ -79,6 +79,7 @@
     private View mTransparentView;
     private MultiShrinkScrollerListener mListener;
     private TextView mLargeTextView;
+    private View mPhotoTouchInterceptOverlay;
     /** Contains desired location/size of the title, once the header is fully compressed */
     private TextView mInvisiblePlaceholderTextView;
     private int mHeaderTintColor;
@@ -134,7 +135,7 @@
     private final AnimatorListener mHeaderExpandAnimationListener = new AnimatorListenerAdapter() {
         @Override
         public void onAnimationEnd(Animator animation) {
-            mPhotoView.setClickable(true);
+            mPhotoTouchInterceptOverlay.setClickable(true);
         }
     };
 
@@ -219,12 +220,16 @@
         mListener = listener;
 
         mPhotoView = (QuickContactImageView) findViewById(R.id.photo);
-        mPhotoView.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                expandCollapseHeader();
-            }
-        });
+
+        if (!mIsTwoPanel) {
+            mPhotoTouchInterceptOverlay = findViewById(R.id.photo_touch_intercept_overlay);
+            mPhotoTouchInterceptOverlay.setOnClickListener(new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    expandCollapseHeader();
+                }
+            });
+        }
 
         final WindowManager windowManager = (WindowManager) getContext().getSystemService(
                 Context.WINDOW_SERVICE);
@@ -375,7 +380,7 @@
      * complete.
      */
     private void expandCollapseHeader() {
-        mPhotoView.setClickable(false);
+        mPhotoTouchInterceptOverlay.setClickable(false);
         if (getHeaderHeight() != mMaximumHeaderHeight) {
             // Expand header
             final ObjectAnimator animator = ObjectAnimator.ofInt(this, "headerHeight",