Make phone number copyable on call detail

Now the phone number is long-pressable, which starts the CAB
for copying phone number.

Tapping the phone number again while will unselect it. (Or press back or UP.)

Also tweak the highlight area for the phone number view, per UX suggestion.
Now when you press the phone number view, the entire row will be highlighted,
including the SMS action view.

Tested:
- Regular phone number.
- SIP address.
- No-caller ID, or "private number" -> The "Call XXX" view is gone, so
nothing to long-press.
- "Voicemail".  The text "Voicemail" will by copied, which is iffy, but I
don't think "fixing" it is worth introducing more complication to the code.

Bug 6354066

Change-Id: I54ee67589a2e5aaba8e4a5dd9589e8c9e46c18b8
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index 7498f5a..1d0a285 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -20,6 +20,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:visibility="gone"
+    android:background="@android:color/black"
 >
     <!--
       The list view is under everything.
@@ -32,7 +33,6 @@
         android:layout_height="wrap_content"
         android:layout_alignParentLeft="true"
         android:layout_alignParentTop="true"
-        android:background="@android:color/black"
     />
 
     <!-- All the controls which are part of the pinned header are in this layout. -->
@@ -128,35 +128,34 @@
             android:layout_height="wrap_content"
             android:paddingBottom="@dimen/call_detail_button_spacing"
             android:layout_below="@id/blue_separator"
-            android:background="@android:color/black"
         >
             <!-- The voicemail fragment will be put here. -->
         </LinearLayout>
-        <FrameLayout android:id="@+id/call_and_sms_container"
+        <FrameLayout
+            android:id="@+id/call_and_sms"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
+            android:layout_height="@dimen/call_log_list_item_height"
             android:layout_marginBottom="@dimen/call_detail_button_spacing"
             android:layout_below="@id/voicemail_container"
-            android:background="@android:color/black"
+            android:gravity="center_vertical"
+            android:background="@drawable/dialpad_background"
         >
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:id="@+id/call_and_sms"
+            <LinearLayout
+                android:id="@+id/call_and_sms_main_action"
                 android:layout_width="match_parent"
-                android:layout_height="@dimen/call_log_list_item_height"
+                android:layout_height="match_parent"
                 android:orientation="horizontal"
-                android:gravity="center_vertical"
-                android:background="@drawable/dialpad_background"
-            >
+                android:focusable="true"
+                android:background="?android:attr/selectableItemBackground"
+                >
 
-                <LinearLayout android:id="@+id/call_and_sms_main_action"
+                <LinearLayout
                     android:layout_width="0dip"
                     android:layout_height="match_parent"
                     android:layout_weight="1"
                     android:paddingLeft="@dimen/call_log_indent_margin"
                     android:orientation="vertical"
                     android:gravity="center_vertical"
-                    android:focusable="true"
-                    android:background="?android:attr/selectableItemBackground"
                 >
 
                     <TextView android:id="@+id/call_and_sms_text"
@@ -179,7 +178,6 @@
                         android:singleLine="true"
                         android:ellipsize="end"
                     />
-
                 </LinearLayout>
 
                 <View android:id="@+id/call_and_sms_divider"
@@ -213,7 +211,7 @@
         android:layout_height="match_parent"
         android:layout_alignParentLeft="true"
         android:layout_alignParentTop="true"
-        android:background="#000000"
+        android:background="@android:color/black"
         android:visibility="gone"
         android:clickable="true"
     />
diff --git a/res/menu/call_details_cab.xml b/res/menu/call_details_cab.xml
new file mode 100644
index 0000000..7de675f
--- /dev/null
+++ b/res/menu/call_details_cab.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:id="@+id/copy_phone_number"
+        android:icon="?android:attr/actionModeCopyDrawable"
+        android:title="@string/menu_copy"
+    />
+</menu>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 48e63e5..cb2b1ca 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -75,4 +75,8 @@
 
     <!-- Color of image view placeholder. -->
     <color name="image_placeholder">#DDDDDD</color>
+
+    <!-- Standard color for selected items. -->
+    <color name="item_selected">#660099cc</color>
+
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index bff222e..b030f43 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -115,6 +115,9 @@
     <!-- Menu item used to delete a specific contact -->
     <string name="menu_deleteContact">Delete</string>
 
+    <!-- Menu item to copy something [CHAR_LIMIT=10] -->
+    <string name="menu_copy">Copy</string>
+
     <!-- Menu item used to create a contact shortcut when viewing contact details. [CHAR LIMIT=30] -->
     <string name="menu_create_contact_shortcut">Place on Home screen</string>