Use system assets on dialpad/calllog

Since "dial" button has green background for pressed state,
we need to copy some framework assets to our project and have
btn_call.xml which is very similar to framework's
item_background_holo_dark.xml

Also use correct "pressed" state for menu buttons

Bug: 5300071
Bug: 5298218
Change-Id: I82bebecd56716934812dfd9e0a87cbc88d04ceab
diff --git a/res/drawable-hdpi/btn_dial_pressed.png b/res/drawable-hdpi/btn_dial_pressed.png
deleted file mode 100644
index 9c73cca..0000000
--- a/res/drawable-hdpi/btn_dial_pressed.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/btn_dial_selected.9.png b/res/drawable-hdpi/btn_dial_selected.9.png
deleted file mode 100644
index 6372fa0..0000000
--- a/res/drawable-hdpi/btn_dial_selected.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/list_selector_disabled_holo_dark.9.png b/res/drawable-hdpi/list_selector_disabled_holo_dark.9.png
new file mode 100644
index 0000000..f6fd30d
--- /dev/null
+++ b/res/drawable-hdpi/list_selector_disabled_holo_dark.9.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_dial_pressed.png b/res/drawable-mdpi/btn_dial_pressed.png
deleted file mode 100644
index 2440553..0000000
--- a/res/drawable-mdpi/btn_dial_pressed.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/btn_dial_selected.9.png b/res/drawable-mdpi/btn_dial_selected.9.png
deleted file mode 100644
index f9258a1..0000000
--- a/res/drawable-mdpi/btn_dial_selected.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/list_selector_disabled_holo_dark.9.png b/res/drawable-mdpi/list_selector_disabled_holo_dark.9.png
new file mode 100644
index 0000000..92da2f0
--- /dev/null
+++ b/res/drawable-mdpi/list_selector_disabled_holo_dark.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/btn_dial_pressed.png b/res/drawable-xhdpi/btn_dial_pressed.png
deleted file mode 100644
index 27c95b7..0000000
--- a/res/drawable-xhdpi/btn_dial_pressed.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/btn_dial_selected.9.png b/res/drawable-xhdpi/btn_dial_selected.9.png
deleted file mode 100644
index 1e2fe56..0000000
--- a/res/drawable-xhdpi/btn_dial_selected.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/list_selector_disabled_holo_dark.9.png b/res/drawable-xhdpi/list_selector_disabled_holo_dark.9.png
new file mode 100644
index 0000000..88726b6
--- /dev/null
+++ b/res/drawable-xhdpi/list_selector_disabled_holo_dark.9.png
Binary files differ
diff --git a/res/drawable/btn_call.xml b/res/drawable/btn_call.xml
index 51c2b7d..73ff87b 100644
--- a/res/drawable/btn_call.xml
+++ b/res/drawable/btn_call.xml
@@ -14,12 +14,20 @@
      limitations under the License.
 -->
 
-<!-- Background resource for call button in the various dialpads -->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_pressed="true"
-        android:drawable="@drawable/btn_call_pressed" />
-    <item android:state_focused="true"
-        android:drawable="@drawable/btn_dial_selected" />
-    <item
-        android:drawable="@android:color/transparent" />
+<!-- Background resource for call button in the various dialpads.
+     Almost a copy from framework's item_background_holo_dark.xml, but has different pressed effect
+  -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+          android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+
+    <item android:state_window_focused="false" android:drawable="@android:color/transparent" />
+
+    <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
+    <item android:state_focused="true"  android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_dark" />
+    <item android:state_focused="true"  android:state_enabled="false"                              android:drawable="@drawable/list_selector_disabled_holo_dark" />
+    <item android:state_focused="true"                                android:state_pressed="true" android:drawable="@drawable/btn_call_pressed" />
+    <item android:state_focused="false"                               android:state_pressed="true" android:drawable="@drawable/btn_call_pressed" />
+    <item android:state_focused="true"                                                             android:drawable="@drawable/list_focused_holo" />
+    <item                                                                                          android:drawable="@android:color/transparent" />
 </selector>
+
diff --git a/res/drawable/btn_dial.xml b/res/drawable/btn_dial.xml
deleted file mode 100644
index 2a577e0..0000000
--- a/res/drawable/btn_dial.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<!-- Background resource for digit buttons in the various dialpads
-	 used by the Contacts app (see dialpad.xml).
-     -->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_pressed="true"
-        android:drawable="@drawable/btn_dial_pressed" />
-    <item android:state_focused="true"
-        android:drawable="@drawable/btn_dial_selected" />
-
-    <item
-        android:drawable="@android:color/transparent" />
-</selector>
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index 936bca8..a890ddf 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -156,7 +156,7 @@
                     android:orientation="vertical"
                     android:gravity="center_vertical"
                     android:focusable="true"
-                    android:background="@drawable/btn_dial"
+                    android:background="?android:attr/selectableItemBackground"
                 >
 
                     <TextView android:id="@+id/call_and_sms_text"
@@ -191,7 +191,7 @@
                     android:gravity="center"
                     android:scaleType="centerInside"
                     android:focusable="true"
-                    android:background="@drawable/btn_dial"
+                    android:background="?android:attr/selectableItemBackground"
                 />
             </LinearLayout>
         </FrameLayout>
diff --git a/res/layout/dialpad_additional_buttons.xml b/res/layout/dialpad_additional_buttons.xml
index f0e4a42..ae37fd5 100644
--- a/res/layout/dialpad_additional_buttons.xml
+++ b/res/layout/dialpad_additional_buttons.xml
@@ -33,7 +33,7 @@
         android:layout_height="match_parent"
         android:layout_gravity="center_vertical"
         android:state_enabled="false"
-        android:background="@drawable/btn_dial"
+        android:background="?android:attr/selectableItemBackground"
         android:contentDescription="@string/description_search_button"
         android:src="@drawable/ic_see_contacts_holo_dark"/>
 
@@ -57,7 +57,7 @@
         android:layout_height="match_parent"
         android:layout_gravity="center_vertical"
         android:state_enabled="false"
-        android:background="@drawable/btn_dial"
+        android:background="?android:attr/selectableItemBackground"
         android:contentDescription="@string/description_delete_button"
         android:src="@drawable/ic_dial_action_delete" />
 </LinearLayout>
diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml
index b2784e2..96cf543 100644
--- a/res/layout/dialpad_fragment.xml
+++ b/res/layout/dialpad_fragment.xml
@@ -30,30 +30,29 @@
         android:layout_height="0px"
         android:layout_weight="0.200"
         android:layout_marginTop="@dimen/dialpad_vertical_margin"
-        android:gravity="center" >
+        android:gravity="center"
+        android:background="@drawable/dialpad_background" >
 
-        <!-- Type of this EditText is set to NULL (to disable the IME keyboard)
-             in the java code.
-
-             Background drawable can be controlled programatically. -->
         <com.android.contacts.dialpad.DigitsEditText
             android:id="@+id/digits"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:layout_alignParentLeft="true"
-            android:layout_toLeftOf="@+id/moreoverflow"
-            android:background="@drawable/dialpad_background"
             android:gravity="center"
             android:textAppearance="@style/DialtactsDigitsTextAppearance"
-            android:textColor="?android:attr/textColorPrimary" />
+            android:textColor="?android:attr/textColorPrimary"
+            android:nextFocusRight="@+id/overflow_menu"
+            android:background="@android:color/transparent" />
 
-        <ImageButton android:id="@+id/overflow_menu"
+        <ImageButton
+            android:id="@+id/overflow_menu"
             android:layout_width="48dip"
             android:layout_height="match_parent"
             android:layout_alignParentRight="true"
             android:src="@drawable/ic_menu_overflow"
             android:contentDescription="@*android:string/action_menu_overflow_description"
-            android:background="@android:color/transparent"/>
+            android:nextFocusLeft="@id/digits"
+            android:background="?android:attr/selectableItemBackground"/>
 
     </RelativeLayout>
 
diff --git a/res/layout/dialtacts_custom_action_bar.xml b/res/layout/dialtacts_custom_action_bar.xml
index 2be66f7..0709626 100644
--- a/res/layout/dialtacts_custom_action_bar.xml
+++ b/res/layout/dialtacts_custom_action_bar.xml
@@ -31,11 +31,12 @@
     <ImageButton
         android:id="@+id/search_option"
         android:layout_width="wrap_content"
-        android:paddingRight="8dip"
+        android:paddingLeft="4dip"
+        android:paddingRight="4dip"
         android:layout_height="match_parent"
         android:layout_alignParentRight="true"
         android:src="@drawable/ic_menu_overflow"
-        android:background="@android:color/transparent"
+        android:background="?android:attr/selectableItemBackground"
         android:visibility="gone" />
 
 </LinearLayout>
diff --git a/res/layout/favorites_star.xml b/res/layout/favorites_star.xml
index 5bdc091..2ac3039 100644
--- a/res/layout/favorites_star.xml
+++ b/res/layout/favorites_star.xml
@@ -30,4 +30,4 @@
         android:contentDescription="@string/description_star"
         android:visibility="invisible"
         android:button="@drawable/btn_star_holo_dark"/>
-</FrameLayout>
\ No newline at end of file
+</FrameLayout>
diff --git a/res/layout/playback_layout.xml b/res/layout/playback_layout.xml
index c2fdb3e..711ebf8 100644
--- a/res/layout/playback_layout.xml
+++ b/res/layout/playback_layout.xml
@@ -24,7 +24,7 @@
                 android:id="@+id/playback_start_stop"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
-                android:background="@drawable/btn_dial"
+                android:background="?android:attr/selectableItemBackground"
                 android:src="@drawable/ic_hold_pause"
             />
         </LinearLayout>
@@ -38,7 +38,7 @@
                 android:id="@+id/playback_speakerphone"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
-                android:background="@drawable/btn_dial"
+                android:background="?android:attr/selectableItemBackground"
                 android:src="@drawable/ic_speakerphone_on"
             />
         </LinearLayout>
@@ -97,7 +97,7 @@
             android:src="@drawable/ic_minus"
             android:layout_width="64dip"
             android:layout_height="wrap_content"
-            android:background="@drawable/btn_dial"
+            android:background="?android:attr/selectableItemBackground"
             android:paddingBottom="19dip"
             android:paddingTop="29dip"
             android:layout_alignParentLeft="true"
@@ -108,7 +108,7 @@
             android:src="@drawable/ic_plus"
             android:layout_width="64dip"
             android:layout_height="wrap_content"
-            android:background="@drawable/btn_dial"
+            android:background="?android:attr/selectableItemBackground"
             android:paddingBottom="19dip"
             android:paddingTop="29dip"
             android:layout_alignParentRight="true"
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 4317050..0b47d5a 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -237,7 +237,7 @@
         <item name="android:layout_width">0dip</item>
         <item name="android:layout_height">match_parent</item>
         <item name="android:layout_weight">1</item>
-        <item name="android:background">@drawable/btn_dial</item>
+        <item name="android:background">?android:attr/selectableItemBackground</item>
         <item name="android:soundEffectsEnabled">false</item>
     </style>