Add call button to favorites, and move button to right side of call log.

Change-Id: I7445ceee5f7cd39b037feb80f04fb61153a6db02
diff --git a/res/layout-finger/contacts_list_item.xml b/res/layout-finger/contacts_list_item.xml
index 8efec3d..9d48d34 100644
--- a/res/layout-finger/contacts_list_item.xml
+++ b/res/layout-finger/contacts_list_item.xml
@@ -97,6 +97,18 @@
             android:gravity="center_vertical|left"
             android:textAppearance="?android:attr/textAppearanceLarge"
         />
+            
+        <ImageView android:id="@+id/call_button"
+	        android:layout_width="50dip"
+	        android:layout_height="50dip"
+	        android:layout_marginLeft="9dip"
+	        android:layout_alignParentRight="true"
+	        android:layout_centerVertical="true"
+	        
+	        android:gravity="center"
+	        android:src="@android:drawable/sym_action_call"
+	        android:background="@drawable/list_item_secondary_button"
+	    />
     
     </RelativeLayout>
 </LinearLayout>
\ No newline at end of file
diff --git a/res/layout-finger/contacts_list_item_photo.xml b/res/layout-finger/contacts_list_item_photo.xml
index d497b8b..ef40018 100644
--- a/res/layout-finger/contacts_list_item_photo.xml
+++ b/res/layout-finger/contacts_list_item_photo.xml
@@ -103,6 +103,18 @@
             android:gravity="center_vertical|left"
             android:textAppearance="?android:attr/textAppearanceLarge"
         />
+        
+        <ImageView android:id="@+id/call_button"
+	        android:layout_width="50dip"
+	        android:layout_height="50dip"
+	        android:layout_marginLeft="9dip"
+	        android:layout_alignParentRight="true"
+	        android:layout_centerVertical="true"
+	        
+	        android:gravity="center"
+	        android:src="@android:drawable/sym_action_call"
+	        android:background="@drawable/list_item_secondary_button"
+	    />
     
     </RelativeLayout>
 </LinearLayout>
diff --git a/res/layout-finger/recent_calls_list_item.xml b/res/layout-finger/recent_calls_list_item.xml
index bab9ea1..924e180 100644
--- a/res/layout-finger/recent_calls_list_item.xml
+++ b/res/layout-finger/recent_calls_list_item.xml
@@ -17,43 +17,34 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="?android:attr/listPreferredItemHeight"
-    android:paddingLeft="0dip"
-    android:paddingRight="12dip"
+    android:paddingLeft="9dip"
+    android:paddingRight="9dip"
 >
 
     <ImageView android:id="@+id/call_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="fill_parent"
-
-        android:paddingLeft="14dip"
-        android:paddingRight="11dip"
+        android:layout_width="50dip"
+        android:layout_height="50dip"
+        android:layout_marginLeft="9dip"
+        android:layout_alignParentRight="true"
+        android:layout_centerVertical="true"
         
-        android:gravity="center_vertical"
+        android:gravity="center"
         android:src="@android:drawable/sym_action_call"
-        android:background="@android:drawable/list_selector_background"
+        android:background="@drawable/list_item_secondary_button"
     />
-
-    <View android:id="@+id/divider"
-        android:layout_width="1dip"
-        android:layout_height="fill_parent"
-        android:layout_toRightOf="@id/call_icon"
-        android:layout_marginRight="11dip"
-
-        android:background="@drawable/divider_vertical_dark"
-    />
-
+    
     <ImageView android:id="@+id/call_type_icon"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_alignParentRight="true"
+        android:layout_toLeftOf="@id/call_icon"
         android:layout_alignParentTop="true"
     />
     
     <TextView android:id="@+id/date"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_alignParentRight="true"
         android:layout_alignParentBottom="true"
+        android:layout_toLeftOf="@id/call_icon"
         android:layout_marginBottom="9dip"
 
         android:textAppearance="?android:attr/textAppearanceSmall"
@@ -63,11 +54,10 @@
     <TextView android:id="@+id/label"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_toRightOf="@id/divider"
         android:layout_alignParentBottom="true"
         android:layout_marginBottom="8dip"
         android:layout_marginTop="-10dip"
-
+        
         android:singleLine="true"
         android:ellipsize="marquee"
         android:textAppearance="?android:attr/textAppearanceSmall"
@@ -92,12 +82,11 @@
     <TextView android:id="@+id/line1"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_toRightOf="@id/divider"
-        android:layout_toLeftOf="@id/call_type_icon"
         android:layout_alignParentTop="true"
+        android:layout_alignParentLeft="true"
         android:layout_above="@id/label"
         android:layout_alignWithParentIfMissing="true"
-
+        
         android:textAppearance="?android:attr/textAppearanceLarge"
         android:singleLine="true"
         android:gravity="center_vertical"
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index a0a2258..94ba438 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -166,6 +166,8 @@
     static final int MODE_MASK_SHOW_PHOTOS = 0x08000000;
     /** Mask for hiding additional information e.g. primary phone number in the list */
     static final int MODE_MASK_NO_DATA = 0x04000000;
+    /** Mask for showing a call button in the list */
+    static final int MODE_MASK_SHOW_CALL_BUTTON = 0x02000000;
 
     /** Unknown mode */
     static final int MODE_UNKNOWN = 0;
@@ -178,7 +180,7 @@
     /** Show frequently contacted contacts */
     static final int MODE_FREQUENT = 30 | MODE_MASK_SHOW_PHOTOS;
     /** Show starred and the frequent */
-    static final int MODE_STREQUENT = 35 | MODE_MASK_SHOW_PHOTOS;
+    static final int MODE_STREQUENT = 35 | MODE_MASK_SHOW_PHOTOS | MODE_MASK_SHOW_CALL_BUTTON;
     /** Show all contacts and pick them when clicking */
     static final int MODE_PICK_CONTACT = 40 | MODE_MASK_PICKER | MODE_MASK_SHOW_PHOTOS;
     /** Show all contacts as well as the option to create a new one */
@@ -1791,6 +1793,7 @@
         public TextView header;
         public View divider;
         public TextView nameView;
+        public ImageView callView;
         public CharArrayBuffer nameBuffer = new CharArrayBuffer(128);
         public TextView labelView;
         public CharArrayBuffer labelBuffer = new CharArrayBuffer(128);
@@ -1818,6 +1821,7 @@
         private CharSequence mUnknownNameText;
         private CharSequence[] mLocalizedLabels;
         private boolean mDisplayPhotos = false;
+        private boolean mDisplayCallButton = false;
         private boolean mDisplayAdditionalData = true;
         private HashMap<Long, SoftReference<Bitmap>> mBitmapCache = null;
         private HashSet<ImageView> mItemsMissingImages = null;
@@ -1867,6 +1871,10 @@
                 mDisplayAdditionalData = false;
             }
 
+            if ((mMode & MODE_MASK_SHOW_CALL_BUTTON) == MODE_MASK_SHOW_CALL_BUTTON) {
+                mDisplayCallButton = true;
+            }
+
             if ((mMode & MODE_MASK_SHOW_PHOTOS) == MODE_MASK_SHOW_PHOTOS) {
                 mDisplayPhotos = true;
                 setViewResource(R.layout.contacts_list_item_photo);
@@ -2057,6 +2065,10 @@
             cache.header = (TextView) view.findViewById(R.id.header);
             cache.divider = view.findViewById(R.id.list_divider);
             cache.nameView = (TextView) view.findViewById(R.id.name);
+            cache.callView = (ImageView) view.findViewById(R.id.call_button);
+            if (cache.callView != null) {
+                cache.callView.setOnClickListener(ContactsListActivity.this);
+            }
             cache.labelView = (TextView) view.findViewById(R.id.label);
             cache.dataView = (TextView) view.findViewById(R.id.data);
             cache.presenceView = (ImageView) view.findViewById(R.id.presence);
@@ -2119,6 +2131,15 @@
                 cache.nameView.setText(mUnknownNameText);
             }
 
+            // Make the call button visible if requested.
+            if (mDisplayCallButton) {
+                int pos = cursor.getPosition();
+                cache.callView.setVisibility(View.VISIBLE);
+                cache.callView.setTag(pos);
+            } else {
+                cache.callView.setVisibility(View.GONE);
+            }
+
             // Set the photo, if requested
             if (mDisplayPhotos) {