Merge change 26599 into eclair

* changes:
  New assets for the new UI design.
diff --git a/res/layout-finger/contacts_list_item.xml b/res/layout-finger/contacts_list_item.xml
index f2c3204..ccc53e7 100644
--- a/res/layout-finger/contacts_list_item.xml
+++ b/res/layout-finger/contacts_list_item.xml
@@ -30,7 +30,7 @@
     <View android:id="@+id/list_divider"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        android:background="@android:drawable/divider_horizontal_dark"
+        android:background="@*android:drawable/divider_horizontal_dark_opaque"
     />
 
     <RelativeLayout
@@ -38,17 +38,49 @@
         android:layout_height="?android:attr/listPreferredItemHeight"
         android:paddingLeft="14dip"
     >
-
-        <ImageView android:id="@+id/presence"
-            android:layout_width="32dip"
-            android:layout_height="32dip"
-            android:layout_alignParentRight="true"
-            android:layout_marginLeft="5dip"
-            android:layout_centerVertical="true"
-
-            android:gravity="center"
-            android:scaleType="centerInside"
-        />
+    
+        <LinearLayout android:id="@+id/right_side"
+            android:layout_width="wrap_content"
+            android:layout_height="fill_parent"
+            android:orientation="horizontal"
+            android:layout_marginLeft="11dip"
+            android:layout_alignParentRight="true">
+            
+            <ImageView android:id="@+id/presence"
+                android:layout_width="32dip"
+                android:layout_height="32dip"
+                android:layout_marginLeft="5dip"
+                android:layout_marginRight="5dip"
+    
+                android:layout_gravity="center_vertical"
+                android:scaleType="centerInside"
+            />
+            
+            <LinearLayout android:id="@+id/call_view"
+                android:layout_width="wrap_content"
+                android:layout_height="fill_parent"
+                android:orientation="horizontal">
+    
+                <View android:id="@+id/divider"
+                    android:layout_width="1px"
+                    android:layout_height="fill_parent"
+                    android:background="@*android:drawable/divider_vertical_dark_opaque"
+                />
+    
+                <ImageView android:id="@+id/call_button"
+                    android:layout_width="wrap_content"
+                    android:layout_height="fill_parent"
+                    android:paddingLeft="14dip"
+                    android:paddingRight="14dip"
+                    android:layout_centerVertical="true"
+                    android:gravity="center"
+                    android:src="@android:drawable/sym_action_call"
+                    android:background="@android:drawable/list_selector_background"
+                />
+    
+            </LinearLayout>
+    
+        </LinearLayout>
 
         <TextView android:id="@+id/label"
             android:layout_width="wrap_content"
@@ -70,7 +102,7 @@
             android:layout_marginLeft="5dip"
             android:layout_toRightOf="@id/label"
             android:layout_alignBaseline="@id/label"
-            android:layout_toLeftOf="@id/presence"
+            android:layout_toLeftOf="@id/right_side"
             android:layout_alignWithParentIfMissing="true"
 
             android:singleLine="true"
@@ -85,7 +117,7 @@
             android:layout_alignWithParentIfMissing="true"
             android:layout_alignParentTop="true"
             android:layout_alignParentLeft="true"
-            android:layout_toLeftOf="@id/presence"
+            android:layout_toLeftOf="@id/right_side"
             android:layout_marginBottom="1dip"
 
             android:singleLine="true"
@@ -94,31 +126,5 @@
             android:textAppearance="?android:attr/textAppearanceLarge"
         />
 
-        <LinearLayout android:id="@+id/call_view"
-            android:layout_width="wrap_content"
-            android:layout_height="fill_parent"
-            android:orientation="horizontal"
-            android:layout_marginLeft="11dip"
-            android:layout_alignParentRight="true">
-
-            <View android:id="@+id/divider"
-                android:layout_width="1dip"
-                android:layout_height="fill_parent"
-                android:background="@drawable/divider_vertical_dark"
-            />
-
-            <ImageView android:id="@+id/call_button"
-                android:layout_width="wrap_content"
-                android:layout_height="fill_parent"
-                android:paddingLeft="14dip"
-                android:paddingRight="14dip"
-                android:layout_centerVertical="true"
-                android:gravity="center"
-                android:src="@android:drawable/sym_action_call"
-                android:background="@android:drawable/list_selector_background"
-            />
-
-        </LinearLayout>
-
     </RelativeLayout>
 </LinearLayout>
diff --git a/res/layout-finger/contacts_list_item_photo.xml b/res/layout-finger/contacts_list_item_photo.xml
index 9f762ab..7fecada 100644
--- a/res/layout-finger/contacts_list_item_photo.xml
+++ b/res/layout-finger/contacts_list_item_photo.xml
@@ -30,26 +30,56 @@
     <View android:id="@+id/list_divider"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        android:background="@android:drawable/divider_horizontal_dark"
+        android:background="@*android:drawable/divider_horizontal_dark_opaque"
     />
 
     <RelativeLayout
         android:layout_width="fill_parent"
         android:layout_height="?android:attr/listPreferredItemHeight"
         android:paddingLeft="5dip"
-        android:paddingRight="5dip"
     >
 
-        <ImageView android:id="@+id/presence"
-            android:layout_width="32dip"
-            android:layout_height="32dip"
-            android:layout_alignParentRight="true"
-            android:layout_marginLeft="5dip"
-            android:layout_centerVertical="true"
-
-            android:gravity="center"
-            android:scaleType="centerInside"
-        />
+        <LinearLayout android:id="@+id/right_side"
+            android:layout_width="wrap_content"
+            android:layout_height="fill_parent"
+            android:orientation="horizontal"
+            android:layout_marginLeft="11dip"
+            android:layout_alignParentRight="true">
+            
+            <ImageView android:id="@+id/presence"
+                android:layout_width="32dip"
+                android:layout_height="32dip"
+                android:layout_marginLeft="5dip"
+                android:layout_marginRight="5dip"
+    
+                android:layout_gravity="center_vertical"
+                android:scaleType="centerInside"
+            />
+            
+            <LinearLayout android:id="@+id/call_view"
+                android:layout_width="wrap_content"
+                android:layout_height="fill_parent"
+                android:orientation="horizontal">
+    
+                <View android:id="@+id/divider"
+                    android:layout_width="1px"
+                    android:layout_height="fill_parent"
+                    android:background="@*android:drawable/divider_vertical_dark_opaque"
+                />
+    
+                <ImageView android:id="@+id/call_button"
+                    android:layout_width="wrap_content"
+                    android:layout_height="fill_parent"
+                    android:paddingLeft="14dip"
+                    android:paddingRight="14dip"
+                    android:layout_centerVertical="true"
+                    android:gravity="center"
+                    android:src="@android:drawable/sym_action_call"
+                    android:background="@android:drawable/list_selector_background"
+                />
+    
+            </LinearLayout>
+        </LinearLayout>
 
         <android.widget.FasttrackBadgeWidget android:id="@+id/photo"
             android:layout_alignParentLeft="true"
@@ -85,7 +115,7 @@
             android:layout_height="wrap_content"
             android:layout_marginLeft="5dip"
             android:layout_toRightOf="@id/label"
-            android:layout_toLeftOf="@id/presence"
+            android:layout_toLeftOf="@id/right_side"
             android:layout_alignBaseline="@id/label"
             android:layout_alignWithParentIfMissing="true"
 
@@ -98,7 +128,7 @@
             android:layout_width="0dip"
             android:layout_height="0dip"
             android:layout_toRightOf="@id/photo"
-            android:layout_toLeftOf="@id/presence"
+            android:layout_toLeftOf="@id/right_side"
             android:layout_alignParentTop="true"
             android:layout_above="@id/label"
             android:layout_alignWithParentIfMissing="true"
@@ -109,30 +139,5 @@
             android:textAppearance="?android:attr/textAppearanceLarge"
         />
 
-        <LinearLayout android:id="@+id/call_view"
-            android:layout_width="wrap_content"
-            android:layout_height="fill_parent"
-            android:orientation="horizontal"
-            android:layout_marginLeft="11dip"
-            android:layout_alignParentRight="true">
-
-            <View android:id="@+id/divider"
-                android:layout_width="1dip"
-                android:layout_height="fill_parent"
-                android:background="@drawable/divider_vertical_dark"
-            />
-
-            <ImageView android:id="@+id/call_button"
-                android:layout_width="wrap_content"
-                android:layout_height="fill_parent"
-                android:paddingLeft="14dip"
-                android:paddingRight="14dip"
-                android:layout_centerVertical="true"
-                android:gravity="center"
-                android:src="@android:drawable/sym_action_call"
-                android:background="@android:drawable/list_selector_background"
-            />
-
-        </LinearLayout>
     </RelativeLayout>
 </LinearLayout>
diff --git a/res/layout-finger/recent_calls_list_item.xml b/res/layout-finger/recent_calls_list_item.xml
index 275dea2..0f53d87 100644
--- a/res/layout-finger/recent_calls_list_item.xml
+++ b/res/layout-finger/recent_calls_list_item.xml
@@ -33,12 +33,12 @@
     />
 
     <View android:id="@+id/divider"
-        android:layout_width="1dip"
+        android:layout_width="1px"
         android:layout_height="fill_parent"
         android:layout_toLeftOf="@id/call_icon"
         android:layout_marginLeft="11dip"
 
-        android:background="@drawable/divider_vertical_dark"
+        android:background="@*android:drawable/divider_vertical_dark_opaque"
     />
 
     <ImageView android:id="@+id/call_type_icon"
diff --git a/src/com/android/contacts/ViewContactActivity.java b/src/com/android/contacts/ViewContactActivity.java
index 14039f0..70c1867 100644
--- a/src/com/android/contacts/ViewContactActivity.java
+++ b/src/com/android/contacts/ViewContactActivity.java
@@ -963,8 +963,7 @@
 
                             if (protocolObj instanceof Number) {
                                 int protocol = ((Number) protocolObj).intValue();
-                                host = ContactsUtils.lookupProviderNameFromId(
-                                        protocol).toLowerCase();
+                                host = ContactsUtils.lookupProviderNameFromId(protocol);
                                 if (protocol == CommonDataKinds.Im.PROTOCOL_GOOGLE_TALK
                                         || protocol == CommonDataKinds.Im.PROTOCOL_MSN) {
                                     entry.maxLabelLines = 2;
@@ -975,9 +974,10 @@
                             }
 
                             // Only add the intent if there is a valid host
+                            //  host is null for CommonDataKinds.Im.PROTOCOL_CUSTOM
                             if (!TextUtils.isEmpty(host)) {
                                 entry.intent = new Intent(Intent.ACTION_SENDTO,
-                                        constructImToUrl(host, entry.data));
+                                        constructImToUrl(host.toLowerCase(), entry.data));
                             }
                             //TODO(emillar) Add in presence info
                             /*if (!aggCursor.isNull(METHODS_STATUS_COLUMN)) {
diff --git a/src/com/android/contacts/ui/ShowOrCreateActivity.java b/src/com/android/contacts/ui/ShowOrCreateActivity.java
index 8d3ed01..7728b36 100755
--- a/src/com/android/contacts/ui/ShowOrCreateActivity.java
+++ b/src/com/android/contacts/ui/ShowOrCreateActivity.java
@@ -23,6 +23,7 @@
 
 import android.app.Activity;
 import android.app.AlertDialog;
+import android.app.Dialog;
 import android.content.ComponentName;
 import android.content.ContentUris;
 import android.content.DialogInterface;
@@ -68,6 +69,8 @@
 
     static final int CONTACT_ID_INDEX = 0;
 
+    static final int CREATE_CONTACT_DIALOG = 1;
+
     static final int QUERY_TOKEN = 42;
 
     private NotifyingAsyncQueryHandler mQueryHandler;
@@ -189,24 +192,33 @@
                 finish();
 
             } else {
+	        showDialog(CREATE_CONTACT_DIALOG);
+           }
+        }
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int id) {
+        switch(id) {
+	    case CREATE_CONTACT_DIALOG:
                 // Prompt user to insert or edit contact
-                Intent createIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
+                final Intent createIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
                 createIntent.putExtras(mCreateExtras);
                 createIntent.setType(RawContacts.CONTENT_ITEM_TYPE);
 
-                CharSequence message = getResources().getString(
+                final CharSequence message = getResources().getString(
                         R.string.add_contact_dlg_message_fmt, mCreateDescrip);
 
-                new AlertDialog.Builder(this)
+                return new AlertDialog.Builder(this)
                         .setTitle(R.string.add_contact_dlg_title)
                         .setMessage(message)
                         .setPositiveButton(android.R.string.ok,
                                 new IntentClickListener(this, createIntent))
                         .setNegativeButton(android.R.string.cancel,
                                 new IntentClickListener(this, null))
-                        .show();
-            }
+                        .create();
         }
+	return super.onCreateDialog(id);
     }
 
     /** {@inheritDoc} */
diff --git a/src/com/android/contacts/ui/widget/GenericEditorView.java b/src/com/android/contacts/ui/widget/GenericEditorView.java
index 3522258..4490fbf 100644
--- a/src/com/android/contacts/ui/widget/GenericEditorView.java
+++ b/src/com/android/contacts/ui/widget/GenericEditorView.java
@@ -215,7 +215,11 @@
     }
 
     /**
-     * Prepare dialog for entering a custom label.
+     * Prepare dialog for entering a custom label. The input value is trimmed: white spaces before
+     * and after the input text is removed.
+     * <p>
+     * If the final value is empty, this change request is ignored;
+     * no empty text is allowed in any custom label.
      */
     public Dialog createCustomDialog() {
         final EditText customType = new EditText(mContext);
@@ -228,13 +232,14 @@
 
         builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int which) {
-                final String customText = customType.getText().toString();
-                mEntry.put(mType.customColumn, customText);
-                rebuildLabel();
+                final String customText = customType.getText().toString().trim();
+                if (!TextUtils.isEmpty(customText)) {
+                    mEntry.put(mType.customColumn, customText);
+                    rebuildLabel();
+                }
             }
         });
 
-        // TODO: handle canceled case by reverting to previous type?
         builder.setNegativeButton(android.R.string.cancel, null);
 
         return builder.create();