Merge "Setting call log item elevation and background color when items are expanded/shrunk per redlines."
diff --git a/res/anim/slide_out.xml b/res/anim/slide_out.xml
index e037009..6b180c5 100644
--- a/res/anim/slide_out.xml
+++ b/res/anim/slide_out.xml
@@ -17,7 +17,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:interpolator="@android:anim/decelerate_interpolator"
     android:valueFrom="0"
-    android:valueTo="0.67"
+    android:valueTo="0.8"
     android:valueType="floatType"
     android:propertyName="yFraction"
-    android:duration="200" />
\ No newline at end of file
+    android:duration="429" />
\ No newline at end of file
diff --git a/res/layout/dialpad_digits.xml b/res/layout/dialpad_digits.xml
deleted file mode 100644
index 55fd27e..0000000
--- a/res/layout/dialpad_digits.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?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.
--->
-
-<!-- Text field and possibly soft menu button above the keypad where
-     the digits are displayed. -->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/digits_container"
-    android:layout_width="match_parent"
-    android:layout_height="@dimen/dialpad_digits_height"
-    android:orientation="horizontal">
-
-    <view class="com.android.dialer.dialpad.DigitsEditText"
-        android:id="@+id/digits"
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:paddingLeft="@dimen/dialpad_digits_padding"
-        android:scrollHorizontally="true"
-        android:singleLine="true"
-        android:layout_weight="1"
-        android:gravity="center"
-        android:background="@android:color/transparent"
-        android:maxLines="1"
-        android:textSize="@dimen/dialpad_digits_text_size"
-        android:freezesText="true"
-        android:focusableInTouchMode="true"
-        android:cursorVisible="false"
-        android:textColor="@color/dialpad_digits_text_color"
-        android:textCursorDrawable="@null"
-        android:fontFamily="sans-serif-light"
-        android:textStyle="normal" />
-
-    <ImageButton
-        android:id="@+id/deleteButton"
-        android:paddingLeft="@dimen/dialpad_digits_padding"
-        android:paddingRight="@dimen/dialpad_digits_padding"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:state_enabled="false"
-        android:background="@drawable/dialpad_key_colors"
-        android:contentDescription="@string/description_delete_button"
-        android:src="@drawable/ic_dial_action_delete" />
-</LinearLayout>
diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml
index e4e2a23..8301659 100644
--- a/res/layout/dialtacts_activity.xml
+++ b/res/layout/dialtacts_activity.xml
@@ -59,7 +59,8 @@
             android:layout_height="match_parent"
             android:layout_width="match_parent"
             android:gravity="center"
-            android:orientation="horizontal">
+            android:orientation="horizontal"
+            android:visibility="gone" >
             <ImageView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
@@ -102,4 +103,15 @@
             android:src="@drawable/ic_dial_action_call"
             android:visibility="gone" />
     </FrameLayout>
+    <!-- Host container for the contact tile drag shadow -->
+    <FrameLayout
+        android:layout_height="match_parent"
+        android:layout_width="match_parent">
+        <ImageView
+            android:id="@+id/contact_tile_drag_shadow_overlay"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:visibility="gone"
+            android:importantForAccessibility="no" />
+    </FrameLayout>
 </RelativeLayout>
diff --git a/res/layout/phone_favorites_fragment.xml b/res/layout/phone_favorites_fragment.xml
index 89a9f73..76e5e98 100644
--- a/res/layout/phone_favorites_fragment.xml
+++ b/res/layout/phone_favorites_fragment.xml
@@ -40,13 +40,6 @@
             android:clipToPadding="false"
             android:fadingEdge="none"
             android:divider="@null" />
-
-        <ImageView
-            android:id="@+id/contact_tile_drag_shadow_overlay"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:visibility="gone"
-            android:importantForAccessibility="no" />
     </FrameLayout>
 
     <include
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 2456294..ba4ae7b 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -1608,12 +1608,15 @@
     public void onHiddenChanged(boolean hidden) {
         super.onHiddenChanged(hidden);
         final DialtactsActivity activity = (DialtactsActivity) getActivity();
+        final DialpadView dialpadView = (DialpadView) getView().findViewById(R.id.dialpad_view);
         if (activity == null) return;
         if (hidden) {
+            if (mAnimate) {
+                dialpadView.animateHide();
+            }
             activity.onDialpadHidden();
         } else {
             if (mAnimate) {
-                DialpadView dialpadView = (DialpadView) getView().findViewById(R.id.dialpad_view);
                 dialpadView.animateShow();
             }
             activity.onDialpadShown();
diff --git a/src/com/android/dialer/list/PhoneFavoriteListView.java b/src/com/android/dialer/list/PhoneFavoriteListView.java
index 074cc07..4ecc1cd 100644
--- a/src/com/android/dialer/list/PhoneFavoriteListView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteListView.java
@@ -59,6 +59,7 @@
 
     private Bitmap mDragShadowBitmap;
     private ImageView mDragShadowOverlay;
+    private View mDragShadowParent;
     private int mAnimationDuration;
 
     final int[] mLocationOnScreen = new int[2];
@@ -190,6 +191,7 @@
 
     public void setDragShadowOverlay(ImageView overlay) {
         mDragShadowOverlay = overlay;
+        mDragShadowParent = (View) mDragShadowOverlay.getParent();
     }
 
     /**
@@ -230,10 +232,21 @@
             return;
         }
 
-        // Square tile is relative to the contact tile,
-        // and contact tile is relative to this list view.
-        mDragShadowLeft = tileView.getLeft();
-        mDragShadowTop = tileView.getTop();
+        tileView.getLocationOnScreen(mLocationOnScreen);
+        mDragShadowLeft = mLocationOnScreen[0];
+        mDragShadowTop = mLocationOnScreen[1];
+
+        // x and y are the coordinates of the on-screen touch event. Using these
+        // and the on-screen location of the tileView, calculate the difference between
+        // the position of the user's finger and the position of the tileView. These will
+        // be used to offset the location of the drag shadow so that it appears that the
+        // tileView is positioned directly under the user's finger.
+        mTouchOffsetToChildLeft = x - mDragShadowLeft;
+        mTouchOffsetToChildTop = y - mDragShadowTop;
+
+        mDragShadowParent.getLocationOnScreen(mLocationOnScreen);
+        mDragShadowLeft -= mLocationOnScreen[0];
+        mDragShadowTop -= mLocationOnScreen[1];
 
         mDragShadowOverlay.setImageBitmap(mDragShadowBitmap);
         mDragShadowOverlay.setVisibility(VISIBLE);
@@ -241,19 +254,14 @@
 
         mDragShadowOverlay.setX(mDragShadowLeft);
         mDragShadowOverlay.setY(mDragShadowTop);
-
-        // x and y passed in are the coordinates of where the user has touched down,
-        // calculate the offset to the top left coordinate of the dragged child.  This
-        // will be used for drawing the drag shadow.
-        mTouchOffsetToChildLeft = x - mDragShadowLeft;
-        mTouchOffsetToChildTop = y - mDragShadowTop;
     }
 
     @Override
     public void onDragHovered(int x, int y, PhoneFavoriteSquareTileView tileView) {
         // Update the drag shadow location.
-        mDragShadowLeft = x - mTouchOffsetToChildLeft;
-        mDragShadowTop = y - mTouchOffsetToChildTop;
+        mDragShadowParent.getLocationOnScreen(mLocationOnScreen);
+        mDragShadowLeft = x - mTouchOffsetToChildLeft - mLocationOnScreen[0];
+        mDragShadowTop = y - mTouchOffsetToChildTop - mLocationOnScreen[1];
         // Draw the drag shadow at its last known location if the drag shadow exists.
         if (mDragShadowOverlay != null) {
             mDragShadowOverlay.setX(mDragShadowLeft);
@@ -263,10 +271,6 @@
 
     @Override
     public void onDragFinished(int x, int y) {
-        // Update the drag shadow location.
-        mDragShadowLeft = x - mTouchOffsetToChildLeft;
-        mDragShadowTop = y - mTouchOffsetToChildTop;
-
         if (mDragShadowOverlay != null) {
             mDragShadowOverlay.clearAnimation();
             mDragShadowOverlay.animate().alpha(0.0f)
diff --git a/src/com/android/dialer/list/SpeedDialFragment.java b/src/com/android/dialer/list/SpeedDialFragment.java
index cfcea9d..0399bf7 100644
--- a/src/com/android/dialer/list/SpeedDialFragment.java
+++ b/src/com/android/dialer/list/SpeedDialFragment.java
@@ -206,7 +206,7 @@
         mListView.getDragDropController().addOnDragDropListener(mContactTileAdapter);
 
         final ImageView dragShadowOverlay =
-                (ImageView) mParentView.findViewById(R.id.contact_tile_drag_shadow_overlay);
+                (ImageView) getActivity().findViewById(R.id.contact_tile_drag_shadow_overlay);
         mListView.setDragShadowOverlay(dragShadowOverlay);
 
         mEmptyView = mParentView.findViewById(R.id.phone_no_favorites_view);