am 6406d98f: Merge "Add call button to details, increase hit area." into mnc-dev

* commit '6406d98f10d6e74492e7cc47bd6f5c6c5fbb6fdf':
  Add call button to details, increase hit area.
diff --git a/res/drawable-hdpi/ic_card_phone.png b/res/drawable-hdpi/ic_card_phone.png
deleted file mode 100644
index 5b29a32..0000000
--- a/res/drawable-hdpi/ic_card_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_card_phone.png b/res/drawable-mdpi/ic_card_phone.png
deleted file mode 100644
index fb9ab44..0000000
--- a/res/drawable-mdpi/ic_card_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_card_phone.png b/res/drawable-xhdpi/ic_card_phone.png
deleted file mode 100644
index 77df721..0000000
--- a/res/drawable-xhdpi/ic_card_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_card_phone.png b/res/drawable-xxhdpi/ic_card_phone.png
deleted file mode 100644
index d7e52ed..0000000
--- a/res/drawable-xxhdpi/ic_card_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_card_phone.png b/res/drawable-xxxhdpi/ic_card_phone.png
deleted file mode 100644
index a938659..0000000
--- a/res/drawable-xxxhdpi/ic_card_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index c077851..abc0fbb 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -13,91 +13,98 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/call_detail"
     android:layout_width="match_parent"
-    android:layout_height="match_parent" >
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:layout_alignParentStart="true"
+    android:layout_alignParentTop="true"
+    android:background="@color/background_dialer_call_log" >
 
+    <!-- Caller information "card" -->
     <LinearLayout
-        android:id="@+id/call_detail"
+        android:id="@+id/caller_information"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical"
-        android:layout_alignParentStart="true"
-        android:layout_alignParentTop="true"
-        android:background="@color/background_dialer_call_log" >
-        <!-- Caller information "card" -->
+        android:layout_height="wrap_content"
+        android:paddingStart="@dimen/call_detail_horizontal_margin"
+        android:paddingTop="@dimen/call_detail_top_margin"
+        android:paddingBottom="@dimen/call_detail_bottom_margin"
+        android:baselineAligned="false"
+        android:orientation="horizontal"
+        android:translationZ="@dimen/call_detail_translation_z"
+        android:focusable="true"
+        android:background="@color/background_dialer_white" >
+
+        <QuickContactBadge
+            android:id="@+id/quick_contact_photo"
+            android:layout_width="@dimen/contact_photo_size"
+            android:layout_height="@dimen/contact_photo_size"
+            android:layout_alignParentStart="true"
+            android:layout_gravity="top"
+            android:layout_marginTop="3dp"
+            android:focusable="true" />
+
         <LinearLayout
-            android:id="@+id/caller_information"
-            android:layout_width="match_parent"
+            android:layout_width="0dp"
             android:layout_height="wrap_content"
-            android:paddingStart="@dimen/call_detail_horizontal_margin"
-            android:paddingTop="@dimen/call_detail_top_margin"
-            android:paddingBottom="@dimen/call_detail_bottom_margin"
-            android:baselineAligned="false"
-            android:orientation="horizontal"
-            android:translationZ="@dimen/call_detail_translation_z"
-            android:focusable="true"
-            android:background="@color/background_dialer_white" >
+            android:layout_weight="1"
+            android:orientation="vertical"
+            android:gravity="center_vertical"
+            android:layout_marginStart="@dimen/call_detail_horizontal_margin">
 
-            <QuickContactBadge
-                android:id="@+id/quick_contact_photo"
-                android:layout_width="@dimen/contact_photo_size"
-                android:layout_height="@dimen/contact_photo_size"
-                android:layout_alignParentStart="true"
-                android:layout_gravity="top"
-                android:layout_marginTop="3dp"
-                android:focusable="true"
-                />
-
-            <LinearLayout
+            <TextView
+                android:id="@+id/caller_name"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:orientation="vertical"
-                android:gravity="center_vertical"
-                android:layout_marginStart="@dimen/call_detail_horizontal_margin"
-                >
-                <TextView
-                    android:id="@+id/caller_name"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textColor="?attr/call_log_primary_text_color"
-                    android:textSize="@dimen/call_log_primary_text_size"
-                    android:includeFontPadding="false"
-                    android:layout_marginBottom="5dp"
-                    android:singleLine="true"
-                    />
-                <TextView
-                    android:id="@+id/caller_number"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textColor="?attr/call_log_secondary_text_color"
-                    android:textSize="@dimen/call_log_secondary_text_size"
-                    android:layout_marginBottom="1dp"
-                    android:singleLine="true"
-                    />
-                <TextView
-                    android:id="@+id/phone_account_label"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textColor="?attr/call_log_secondary_text_color"
-                    android:textSize="@dimen/call_log_secondary_text_size"
-                    android:singleLine="true"
-                    android:visibility="gone"
-                    />
-            </LinearLayout>
+                android:textColor="?attr/call_log_primary_text_color"
+                android:textSize="@dimen/call_log_primary_text_size"
+                android:includeFontPadding="false"
+                android:layout_marginBottom="5dp"
+                android:singleLine="true" />
+
+            <TextView
+                android:id="@+id/caller_number"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="?attr/call_log_secondary_text_color"
+                android:textSize="@dimen/call_log_secondary_text_size"
+                android:layout_marginBottom="1dp"
+                android:singleLine="true" />
+
+            <TextView
+                android:id="@+id/phone_account_label"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="?attr/call_log_secondary_text_color"
+                android:textSize="@dimen/call_log_secondary_text_size"
+                android:singleLine="true"
+                android:visibility="gone" />
+
         </LinearLayout>
 
-        <!--
-          The list view is under everything.
-          It contains a first header element which is hidden under the controls UI.
-          When scrolling, the controls move up until the name bar hits the top.
-          -->
-        <ListView
-            android:id="@+id/history"
-            android:layout_width="match_parent"
-            android:layout_height="fill_parent"
-        />
-
+        <ImageView
+            android:id="@+id/call_back_button"
+            android:layout_width="@dimen/call_button_dimen"
+            android:layout_height="@dimen/call_button_dimen"
+            android:layout_marginEnd="16dp"
+            android:background="?android:attr/selectableItemBackgroundBorderless"
+            android:src="@drawable/ic_call_24dp"
+            android:scaleType="center"
+            android:tint="@color/recent_call_log_item_phone_icon_tint"
+            android:contentDescription="@string/description_call_log_call_action"
+            android:visibility="gone" />
 
     </LinearLayout>
-</RelativeLayout>
+
+    <!--
+      The list view is under everything.
+      It contains a first header element which is hidden under the controls UI.
+      When scrolling, the controls move up until the name bar hits the top.
+      -->
+    <ListView
+        android:id="@+id/history"
+        android:layout_width="match_parent"
+        android:layout_height="fill_parent" />
+
+</LinearLayout>
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index af8cb8b..7fce595 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -138,14 +138,14 @@
 
                 <ImageView
                     android:id="@+id/call_icon"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
+                    android:layout_width="@dimen/call_button_dimen"
+                    android:layout_height="@dimen/call_button_dimen"
                     android:layout_gravity="center_vertical"
                     android:layout_marginEnd="@dimen/call_log_icon_margin"
                     android:background="?android:attr/selectableItemBackgroundBorderless"
-                    android:src="@drawable/ic_card_phone"
+                    android:src="@drawable/ic_call_24dp"
+                    android:scaleType="center"
                     android:tint="@color/recent_call_log_item_phone_icon_tint"
-                    android:alpha="0.3"
                     android:contentDescription="@string/description_call_log_call_action"
                     android:visibility="gone" />
 
diff --git a/res/values/colors.xml b/res/values/colors.xml
index c1e71e1..352bce5 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -36,8 +36,8 @@
     <!-- Color of the text describing an unconsumed voicemail. -->
     <color name="call_log_voicemail_highlight_color">#33b5e5</color>
 
-    <!-- Tint of the recent card phone icon -->
-    <color name="recent_call_log_item_phone_icon_tint">#000000</color>
+    <!-- Tint of the recent card phone icon; 30% black -->
+    <color name="recent_call_log_item_phone_icon_tint">#4d000000</color>
 
     <color name="voicemail_playback_icon_tint">#8e8e8e</color>
 
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index b36b9d6..9d987e8 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -132,4 +132,6 @@
     <dimen name="preference_padding_bottom">16dp</dimen>
     <dimen name="preference_side_margin">16dp</dimen>
     <dimen name="preference_summary_line_spacing_extra">4dp</dimen>
+
+    <dimen name="call_button_dimen">36dp</dimen>
 </resources>
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index 6da7c79..87ec774 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -97,11 +97,9 @@
 
         @Override
         public void onGetCallDetails(PhoneCallDetails[] details) {
-            Context context = CallDetailActivity.this;
-
             if (details == null) {
                 // Somewhere went wrong: we're going to bail out and show error to users.
-                Toast.makeText(context, R.string.toast_call_detail_error,
+                Toast.makeText(mContext, R.string.toast_call_detail_error,
                         Toast.LENGTH_SHORT).show();
                 finish();
                 return;
@@ -119,9 +117,9 @@
 
             // Cache the details about the phone number.
             final boolean canPlaceCallsTo =
-                PhoneNumberUtilsWrapper.canPlaceCallsTo(mNumber, numberPresentation);
-            final PhoneNumberUtilsWrapper phoneUtils = new PhoneNumberUtilsWrapper(context);
-            final boolean isVoicemailNumber =
+                    PhoneNumberUtilsWrapper.canPlaceCallsTo(mNumber, numberPresentation);
+            final PhoneNumberUtilsWrapper phoneUtils = new PhoneNumberUtilsWrapper(mContext);
+            mIsVoicemailNumber =
                     phoneUtils.isVoicemailNumber(accountHandle, mNumber);
             final boolean isSipNumber = PhoneNumberUtilsWrapper.isSipNumber(mNumber);
 
@@ -144,7 +142,9 @@
                 }
             }
 
-            String accountLabel = PhoneAccountUtils.getAccountLabel(context, accountHandle);
+            mCallButton.setVisibility(canPlaceCallsTo ? View.VISIBLE : View.GONE);
+
+            String accountLabel = PhoneAccountUtils.getAccountLabel(mContext, accountHandle);
             if (!TextUtils.isEmpty(accountLabel)) {
                 mAccountLabel.setText(accountLabel);
                 mAccountLabel.setVisibility(View.VISIBLE);
@@ -153,14 +153,14 @@
             }
 
             mHasEditNumberBeforeCallOption =
-                    canPlaceCallsTo && !isSipNumber && !isVoicemailNumber;
+                    canPlaceCallsTo && !isSipNumber && !mIsVoicemailNumber;
             mHasTrashOption = hasVoicemail();
             mHasRemoveFromCallLogOption = !hasVoicemail();
             invalidateOptionsMenu();
 
             ListView historyList = (ListView) findViewById(R.id.history);
             historyList.setAdapter(
-                    new CallDetailHistoryAdapter(context, mInflater, mCallTypeHelper, details));
+                    new CallDetailHistoryAdapter(mContext, mInflater, mCallTypeHelper, details));
 
             String lookupKey = contactUri == null ? null
                     : ContactInfoHelper.getLookupKeyFromUri(contactUri);
@@ -168,7 +168,7 @@
             final boolean isBusiness = mContactInfoHelper.isBusiness(firstDetails.sourceType);
 
             final int contactType =
-                    isVoicemailNumber ? ContactPhotoManager.TYPE_VOICEMAIL :
+                    mIsVoicemailNumber ? ContactPhotoManager.TYPE_VOICEMAIL :
                     isBusiness ? ContactPhotoManager.TYPE_BUSINESS :
                     ContactPhotoManager.TYPE_DEFAULT;
 
@@ -201,14 +201,17 @@
         }
     };
 
+    private Context mContext;
     private CallTypeHelper mCallTypeHelper;
     private QuickContactBadge mQuickContactBadge;
     private TextView mCallerName;
     private TextView mCallerNumber;
     private TextView mAccountLabel;
+    private View mCallButton;
     private ContactInfoHelper mContactInfoHelper;
 
-    private String mNumber = null;
+    private String mNumber;
+    private boolean mIsVoicemailNumber;
     private String mDefaultCountryIso;
 
     /* package */ LayoutInflater mInflater;
@@ -230,6 +233,8 @@
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
 
+        mContext = this;
+
         setContentView(R.layout.call_detail);
 
         mInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
@@ -248,6 +253,14 @@
         mDefaultCountryIso = GeoUtil.getCurrentCountryIso(this);
         mContactPhotoManager = ContactPhotoManager.getInstance(this);
 
+        mCallButton = (View) findViewById(R.id.call_back_button);
+        mCallButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                mContext.startActivity(IntentUtil.getCallIntent(mNumber));
+            }
+        });
+
         mContactInfoHelper = new ContactInfoHelper(this, GeoUtil.getCurrentCountryIso(this));
         getActionBar().setDisplayHomeAsUpEnabled(true);