UI improvements in the call details.

Change-Id: I296242079ba0095c25fbc82826d50ab377eeddeb
diff --git a/res/drawable-hdpi/call_log_action_bar_bg.9.png b/res/drawable-hdpi/call_log_action_bar_bg.9.png
new file mode 100644
index 0000000..2e4d0ca
--- /dev/null
+++ b/res/drawable-hdpi/call_log_action_bar_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_call_log_home.png b/res/drawable-hdpi/ic_call_log_home.png
new file mode 100644
index 0000000..c7c8f16
--- /dev/null
+++ b/res/drawable-hdpi/ic_call_log_home.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_call_log_list_incoming_call.png b/res/drawable-hdpi/ic_call_log_list_incoming_call.png
index 15b5e44..624a0c5 100644
--- a/res/drawable-hdpi/ic_call_log_list_incoming_call.png
+++ b/res/drawable-hdpi/ic_call_log_list_incoming_call.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_call_log_list_missed_call.png b/res/drawable-hdpi/ic_call_log_list_missed_call.png
index 8dcb279..bd572cd 100644
--- a/res/drawable-hdpi/ic_call_log_list_missed_call.png
+++ b/res/drawable-hdpi/ic_call_log_list_missed_call.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_call_log_list_outgoing_call.png b/res/drawable-hdpi/ic_call_log_list_outgoing_call.png
index 160c707..1a93a78 100644
--- a/res/drawable-hdpi/ic_call_log_list_outgoing_call.png
+++ b/res/drawable-hdpi/ic_call_log_list_outgoing_call.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_call_log_list_voicemail.png b/res/drawable-hdpi/ic_call_log_list_voicemail.png
index d2ee44f..0c2a6f4 100644
--- a/res/drawable-hdpi/ic_call_log_list_voicemail.png
+++ b/res/drawable-hdpi/ic_call_log_list_voicemail.png
Binary files differ
diff --git a/res/drawable-mdpi/call_log_action_bar_bg.9.png b/res/drawable-mdpi/call_log_action_bar_bg.9.png
new file mode 100644
index 0000000..2e4d0ca
--- /dev/null
+++ b/res/drawable-mdpi/call_log_action_bar_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_call_log_home.png b/res/drawable-mdpi/ic_call_log_home.png
new file mode 100644
index 0000000..c7c8f16
--- /dev/null
+++ b/res/drawable-mdpi/ic_call_log_home.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_call_log_list_incoming_call.png b/res/drawable-mdpi/ic_call_log_list_incoming_call.png
index c7eec52..77be776 100644
--- a/res/drawable-mdpi/ic_call_log_list_incoming_call.png
+++ b/res/drawable-mdpi/ic_call_log_list_incoming_call.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_call_log_list_missed_call.png b/res/drawable-mdpi/ic_call_log_list_missed_call.png
index 1907a62..66c8d85 100644
--- a/res/drawable-mdpi/ic_call_log_list_missed_call.png
+++ b/res/drawable-mdpi/ic_call_log_list_missed_call.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_call_log_list_outgoing_call.png b/res/drawable-mdpi/ic_call_log_list_outgoing_call.png
index 041d086..a7f85b2 100644
--- a/res/drawable-mdpi/ic_call_log_list_outgoing_call.png
+++ b/res/drawable-mdpi/ic_call_log_list_outgoing_call.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_call_log_list_voicemail.png b/res/drawable-mdpi/ic_call_log_list_voicemail.png
index d2ee44f..6aec9ed 100644
--- a/res/drawable-mdpi/ic_call_log_list_voicemail.png
+++ b/res/drawable-mdpi/ic_call_log_list_voicemail.png
Binary files differ
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index 83c8f1b..1fe6faa 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -19,100 +19,91 @@
     android:layout_height="match_parent"
     android:orientation="horizontal"
     android:gravity="top"
-    android:paddingTop="?attr/call_detail_top_gap"
-    android:background="?attr/call_detail_transparent_background"
 >
+    <LinearLayout
+        android:id="@+id/action_bar"
+        android:layout_width="match_parent"
+        android:layout_height="?attr/call_detail_action_bar_height"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentTop="true"
+        android:orientation="horizontal"
+        android:background="@drawable/call_log_action_bar_bg"
+    >
+        <ImageView
+            android:id="@+id/action_bar_home"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:src="@drawable/ic_call_log_home"
+        />
+    </LinearLayout>
     <ImageView
         android:id="@+id/contact_background"
         android:layout_width="match_parent"
         android:layout_height="?attr/call_detail_contact_background_height"
         android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
+        android:layout_below="@id/action_bar"
         android:adjustViewBounds="true"
         android:scaleType="centerCrop"
 
         android:background="@drawable/ic_contact_picture"
     />
-    <View
-        android:id="@+id/contact_background_overlay"
+    <ListView
+        android:id="@android:id/list"
         android:layout_width="match_parent"
-        android:layout_height="?attr/call_detail_contact_background_height"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/contact_background"
         android:background="?attr/call_detail_primary_background_color"
-        android:alpha="?attr/call_detail_contact_background_overlay_alpha"
     />
-
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="?attr/call_detail_contact_background_overlay_height"
+        android:background="#3F000000"
+        android:layout_alignParentLeft="true"
+        android:layout_above="@android:id/list"
+    />
     <RelativeLayout
         android:id="@+id/photo_panel"
         android:layout_width="match_parent"
-        android:layout_height="?attr/call_detail_contact_background_height"
+        android:layout_height="?attr/call_detail_contact_background_overlay_height"
         android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:paddingBottom="10dp"
+        android:layout_above="@android:id/list"
+        android:paddingLeft="5dip"
     >
-        <ImageView
-            android:id="@+id/contact_photo"
-            android:layout_width="?attr/call_detail_contact_photo_size"
-            android:layout_height="?attr/call_detail_contact_photo_size"
-            android:layout_alignParentLeft="true"
-            android:layout_alignParentBottom="true"
-
-            android:background="@drawable/ic_contact_picture"
-        />
         <RelativeLayout
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_alignParentLeft="true"
             android:layout_alignParentBottom="true"
-            android:layout_toRightOf="@id/contact_photo"
-            android:layout_marginLeft="10dp"
         >
             <include layout="@layout/call_log_phone_call_details" />
         </RelativeLayout>
-        <RelativeLayout
-            android:layout_width="wrap_content"
-            android:layout_height="?attr/call_detail_action_icon_size"
+        <ImageView
+            android:id="@+id/main_action"
+            android:layout_width="?attr/call_detail_action_icon_size"
+            android:layout_height="match_parent"
+            android:gravity="center_vertical"
+            android:scaleType="center"
             android:layout_alignParentRight="true"
             android:layout_alignParentBottom="true"
-            android:layout_marginBottom="10dp"
-        >
-            <ImageView
-                android:id="@+id/call"
-                android:layout_width="?attr/call_detail_action_icon_size"
-                android:layout_height="?attr/call_detail_action_icon_size"
-                android:layout_alignParentRight="true"
-                android:gravity="center_vertical"
-                android:src="@drawable/ic_call_log_list_action_call"
-                android:scaleType="center"
-            />
-            <View
-                android:id="@+id/divider"
-                android:layout_width="1px"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="5dip"
-                android:layout_marginBottom="5dip"
-                android:layout_toLeftOf="@id/call"
-                android:layout_marginLeft="11dip"
-                android:background="#FFFFFF"
-            />
-        </RelativeLayout>
+        />
     </RelativeLayout>
     <RelativeLayout
         android:id="@+id/call_panel"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentLeft="true"
-        android:layout_below="@id/photo_panel"
+        android:layout_below="@android:id/list"
         android:paddingBottom="10dp"
         android:paddingTop="10dp"
         android:paddingLeft="80dp"
-        android:background="#FFFFFF"
+        android:background="?attr/call_detail_secondary_background_color"
     >
         <TextView
             android:id="@+id/time"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignParentLeft="true"
+            android:textColor="?attr/call_detail_secondary_text_color"
         />
         <TextView
             android:id="@+id/duration"
@@ -121,6 +112,7 @@
             android:layout_alignParentLeft="true"
             android:layout_below="@id/time"
             android:layout_alignLeft="@id/time"
+            android:textColor="?attr/call_detail_secondary_text_color"
         />
         <ImageView
             android:id="@+id/delete"
@@ -133,11 +125,4 @@
             android:visibility="gone"
         />
     </RelativeLayout>
-    <ListView
-        android:id="@android:id/list"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/call_panel"
-        android:background="?attr/call_detail_secondary_background_color"
-    />
 </RelativeLayout>
diff --git a/res/layout/call_log_phone_call_details.xml b/res/layout/call_log_phone_call_details.xml
index e58de21..5da2773 100644
--- a/res/layout/call_log_phone_call_details.xml
+++ b/res/layout/call_log_phone_call_details.xml
@@ -15,15 +15,6 @@
 -->
 
 <merge xmlns:android="http://schemas.android.com/apk/res/android">
-    <TextView
-        android:id="@+id/number"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?attr/call_detail_primary_text_color"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentBottom="true"
-    />
     <LinearLayout
         android:id="@+id/call_types"
         android:layout_width="wrap_content"
@@ -31,7 +22,7 @@
         android:textAppearance="?android:attr/textAppearanceSmall"
         android:textColor="?attr/call_detail_primary_text_color"
         android:layout_alignParentLeft="true"
-        android:layout_above="@id/number"
+        android:layout_alignParentBottom="true"
     />
     <TextView
         android:id="@+id/date"
@@ -40,8 +31,17 @@
         android:textAppearance="?android:attr/textAppearanceSmall"
         android:textColor="?attr/call_detail_primary_text_color"
         android:layout_toRightOf="@id/call_types"
-        android:layout_above="@id/number"
         android:layout_marginLeft="?attr/call_detail_date_margin"
+        android:layout_alignParentBottom="true"
+    />
+    <TextView
+        android:id="@+id/number"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="?attr/call_detail_primary_text_color"
+        android:layout_alignParentLeft="true"
+        android:layout_above="@id/call_types"
     />
     <TextView
         android:id="@+id/name"
@@ -50,7 +50,7 @@
         android:textAppearance="?android:attr/textAppearanceMedium"
         android:textColor="?attr/call_detail_primary_text_color"
         android:layout_alignParentLeft="true"
-        android:layout_above="@id/call_types"
+        android:layout_above="@id/number"
         android:paddingBottom="2dp"
     />
 </merge>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 0cf8e25..067a730 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -42,22 +42,20 @@
         <item name="call_log_list_item_height">60dip</item>
     </style>
 
-    <style name="CallDetailActivityTheme" parent="android:Theme.Holo.Light">
-        <item name="android:windowContentOverlay">@null</item>
-        <item name="android:windowIsTranslucent">true</item>
+    <style name="CallDetailActivityTheme" parent="android:Theme.Holo">
         <item name="android:windowNoTitle">true</item>
-        <item name="android:windowBackground">@android:color/transparent</item>
         <item name="android:gravity">top</item>
-        <item name="call_detail_top_gap">49dip</item>
         <item name="call_detail_transparent_background">#CC000000</item>
         <item name="call_detail_contact_background_height">150dip</item>
+        <item name="call_detail_contact_background_overlay_height">70dip</item>
+        <item name="call_detail_action_bar_height">60dip</item>
+        <item name="call_detail_action_icon_size">60dip</item>
         <item name="call_detail_contact_background_overlay_alpha">0.25</item>
-        <item name="call_detail_primary_background_color">#000000</item>
-        <item name="call_detail_contact_photo_size">60dip</item>
         <item name="call_detail_primary_text_color">#FFFFFF</item>
-        <item name="call_detail_action_icon_size">50dip</item>
-        <item name="call_detail_secondary_background_color">#FFFFFF</item>
         <item name="call_detail_date_margin">5dip</item>
+        <item name="call_detail_primary_background_color">#000000</item>
+        <item name="call_detail_secondary_text_color">#FFFFFF</item>
+        <item name="call_detail_secondary_background_color">#333333</item>
     </style>
 
     <style name="ContactDetailActivityTheme" parent="android:Theme.Holo.Light">
@@ -133,14 +131,16 @@
     </declare-styleable>
 
     <declare-styleable name="CallDetailActivity">
-        <attr name="call_detail_top_gap" format="dimension" />
         <attr name="call_detail_transparent_background" format="color" />
         <attr name="call_detail_contact_background_height" format="dimension" />
+        <attr name="call_detail_contact_background_overlay_height" format="dimension" />
         <attr name="call_detail_contact_background_overlay_alpha" format="float" />
         <attr name="call_detail_contact_photo_size" format="dimension" />
         <attr name="call_detail_action_icon_size" format="dimension" />
+        <attr name="call_detail_action_bar_height" format="dimension" />
         <attr name="call_detail_primary_text_color" format="color" />
         <attr name="call_detail_primary_background_color" format="color" />
+        <attr name="call_detail_secondary_text_color" format="color" />
         <attr name="call_detail_secondary_background_color" format="color" />
         <attr name="call_detail_date_margin" format="dimension" />
     </declare-styleable>
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index f87f8a4..a4a578f 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -61,8 +61,8 @@
     private PhoneCallDetailsHelper mPhoneCallDetailsHelper;
     private TextView mCallTimeView;
     private TextView mCallDurationView;
-    private View mCallActionView;
-    private ImageView mContactPhotoView;
+    private View mHomeActionView;
+    private ImageView mMainActionView;
     private ImageView mContactBackgroundView;
 
     private String mNumber = null;
@@ -121,14 +121,22 @@
                 getResources().getDrawable(R.drawable.ic_call_log_list_outgoing_call),
                 getResources().getDrawable(R.drawable.ic_call_log_list_missed_call),
                 getResources().getDrawable(R.drawable.ic_call_log_list_voicemail));
-        mCallActionView = findViewById(R.id.call);
-        mContactPhotoView = (ImageView) findViewById(R.id.contact_photo);
+        mHomeActionView = findViewById(R.id.action_bar_home);
+        mMainActionView = (ImageView) findViewById(R.id.main_action);
         mContactBackgroundView = (ImageView) findViewById(R.id.contact_background);
         mCallTimeView = (TextView) findViewById(R.id.time);
         mCallDurationView = (TextView) findViewById(R.id.duration);
         mDefaultCountryIso = ContactsUtils.getCurrentCountryIso(this);
         mContactPhotoManager = ContactPhotoManager.getInstance(this);
         getListView().setOnItemClickListener(this);
+        mHomeActionView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                // We want this to start the call log if this activity was not started from the
+                // call log itself.
+                CallDetailActivity.this.finish();
+            }
+        });
     }
 
     @Override
@@ -198,7 +206,7 @@
                         mNumber.equals(CallerInfo.PRIVATE_NUMBER)) {
                     numberText = getString(mNumber.equals(CallerInfo.PRIVATE_NUMBER)
                             ? R.string.private_num : R.string.unknown);
-                    mCallActionView.setVisibility(View.GONE);
+                    mMainActionView.setVisibility(View.GONE);
                 } else {
                     // Perform a reverse-phonebook lookup to find the PERSON_ID
                     Uri personUri = null;
@@ -227,38 +235,42 @@
                     }
                     numberText = mNumber;
 
-                    mCallActionView.setVisibility(View.VISIBLE);
-                    mCallActionView.setOnClickListener(new View.OnClickListener() {
+                    // Let user view contact details if they exist, otherwise add option
+                    // to create new contact from this number.
+                    final Intent mainActionIntent;
+                    final int mainActionIcon;
+                    if (personUri != null) {
+                        mainActionIntent = new Intent(Intent.ACTION_VIEW, personUri);
+                        mainActionIcon = R.drawable.sym_action_view_contact;
+                    } else {
+                        mainActionIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
+                        mainActionIntent.setType(Contacts.CONTENT_ITEM_TYPE);
+                        mainActionIntent.putExtra(Insert.PHONE, mNumber);
+                        mainActionIcon = R.drawable.sym_action_add;
+                    }
+
+                    mMainActionView.setVisibility(View.VISIBLE);
+                    mMainActionView.setImageResource(mainActionIcon);
+                    mMainActionView.setOnClickListener(new View.OnClickListener() {
                         @Override
                         public void onClick(View v) {
-                            Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
-                                    Uri.fromParts("tel", mNumber, null));
-                            startActivity(callIntent);
+                            startActivity(mainActionIntent);
                         }
                     });
 
                     // Build list of various available actions
                     List<ViewEntry> actions = new ArrayList<ViewEntry>();
 
+                    Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
+                            Uri.fromParts("tel", mNumber, null));
+                    actions.add(new ViewEntry(android.R.drawable.sym_action_call,
+                            getString(R.string.menu_callNumber, mNumber), callIntent));
+
                     Intent smsIntent = new Intent(Intent.ACTION_SENDTO,
                             Uri.fromParts("sms", mNumber, null));
                     actions.add(new ViewEntry(R.drawable.sym_action_sms,
                             getString(R.string.menu_sendTextMessage), smsIntent));
 
-                    // Let user view contact details if they exist, otherwise add option
-                    // to create new contact from this number.
-                    if (personUri != null) {
-                        Intent viewIntent = new Intent(Intent.ACTION_VIEW, personUri);
-                        actions.add(new ViewEntry(R.drawable.sym_action_view_contact,
-                                getString(R.string.menu_viewContact), viewIntent));
-                    } else {
-                        Intent createIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
-                        createIntent.setType(Contacts.CONTENT_ITEM_TYPE);
-                        createIntent.putExtra(Insert.PHONE, mNumber);
-                        actions.add(new ViewEntry(R.drawable.sym_action_add,
-                                getString(R.string.recentCalls_addToContact), createIntent));
-                    }
-
                     ViewAdapter adapter = new ViewAdapter(this, actions);
                     setListAdapter(adapter);
                 }
@@ -282,21 +294,7 @@
 
     /** Load the contact photos and places them in the corresponding views. */
     private void loadContactPhotos(final long photoId) {
-        // There seem to be a limitation in the ContactPhotoManager that does not allow requesting
-        // two photos at once.
-        // TODO: Figure out the problem with ContactPhotoManager and remove this nonsense.
-        mContactPhotoView.post(new Runnable() {
-            @Override
-            public void run() {
-                mContactPhotoManager.loadPhoto(mContactPhotoView, photoId);
-                mContactPhotoView.postDelayed(new Runnable() {
-                    @Override
-                    public void run() {
-                        mContactPhotoManager.loadPhoto(mContactBackgroundView, photoId);
-                    }
-                }, 100);
-            }
-        });
+        mContactPhotoManager.loadPhoto(mContactBackgroundView, photoId);
     }
 
     private String formatDuration(long elapsedSeconds) {