Add floating dialpad action button

* Replace fake action bar at the bottom of the screen with a floating
action button which casts a shadow.

* Remove the now unused mDialpadOverflowMenu button in DialtactsActivity

* Modify dialpad layout to add a bottom row of buttons which provide
access to the add contact button and overflow menu

* Fix dialpad layout so the heights applied in XML are actually
respected - previously they were being ignored and each dialpad key
was being assigned the height of MATCH_PARENT

Bug: 13932988

Change-Id: I6e48c00c5ceeeffed142c3dd259e630d6daf8111
diff --git a/res/drawable-hdpi/ic_overflow_menu.png b/res/drawable-hdpi/ic_overflow_menu.png
new file mode 100644
index 0000000..0170057
--- /dev/null
+++ b/res/drawable-hdpi/ic_overflow_menu.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_overflow_menu.png b/res/drawable-mdpi/ic_overflow_menu.png
new file mode 100644
index 0000000..0170057
--- /dev/null
+++ b/res/drawable-mdpi/ic_overflow_menu.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_overflow_menu.png b/res/drawable-xhdpi/ic_overflow_menu.png
new file mode 100644
index 0000000..7773841
--- /dev/null
+++ b/res/drawable-xhdpi/ic_overflow_menu.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_overflow_menu.png b/res/drawable-xxhdpi/ic_overflow_menu.png
new file mode 100644
index 0000000..7773841
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_overflow_menu.png
Binary files differ
diff --git a/res/layout/dialpad.xml b/res/layout/dialpad.xml
index c13f525..df6f527 100644
--- a/res/layout/dialpad.xml
+++ b/res/layout/dialpad.xml
@@ -42,20 +42,36 @@
                     android:baselineAlignBottom="true" />
             </LinearLayout>
         </com.android.dialer.dialpad.DialpadKeyButton>
-        <include layout="@layout/dialpad_key" android:id="@+id/two"/>
-        <include layout="@layout/dialpad_key" android:id="@+id/three"/>
+        <include layout="@layout/dialpad_key"
+            android:id="@+id/two"
+            style="@style/DialpadKeyButtonStyle" />
+        <include layout="@layout/dialpad_key"
+            android:id="@+id/three"
+            style="@style/DialpadKeyButtonStyle" />
     </TableRow>
 
     <TableRow>
-        <include layout="@layout/dialpad_key" android:id="@+id/four"/>
-        <include layout="@layout/dialpad_key" android:id="@+id/five"/>
-        <include layout="@layout/dialpad_key" android:id="@+id/six"/>
+        <include layout="@layout/dialpad_key"
+            android:id="@+id/four"
+            style="@style/DialpadKeyButtonStyle" />
+        <include layout="@layout/dialpad_key"
+            android:id="@+id/five"
+            style="@style/DialpadKeyButtonStyle" />
+        <include layout="@layout/dialpad_key"
+            android:id="@+id/six"
+            style="@style/DialpadKeyButtonStyle" />
     </TableRow>
 
     <TableRow>
-        <include layout="@layout/dialpad_key" android:id="@+id/seven"/>
-        <include layout="@layout/dialpad_key" android:id="@+id/eight"/>
-        <include layout="@layout/dialpad_key" android:id="@+id/nine"/>
+        <include layout="@layout/dialpad_key"
+            android:id="@+id/seven"
+            style="@style/DialpadKeyButtonStyle" />
+        <include layout="@layout/dialpad_key"
+            android:id="@+id/eight"
+            style="@style/DialpadKeyButtonStyle" />
+        <include layout="@layout/dialpad_key"
+            android:id="@+id/nine"
+            style="@style/DialpadKeyButtonStyle" />
     </TableRow>
 
     <TableRow>
@@ -72,7 +88,9 @@
                     android:layout_width="@dimen/dialpad_key_letters_width" />
             </LinearLayout>
         </com.android.dialer.dialpad.DialpadKeyButton>
-        <include layout="@layout/dialpad_key" android:id="@+id/zero"/>
+        <include layout="@layout/dialpad_key"
+            android:id="@+id/zero"
+            style="@style/DialpadKeyButtonStyle" />
         <com.android.dialer.dialpad.DialpadKeyButton
             android:id="@+id/pound"
             style="@style/DialpadKeyButtonStyle">
@@ -87,4 +105,35 @@
             </LinearLayout>
         </com.android.dialer.dialpad.DialpadKeyButton>
     </TableRow>
+
+    <TableRow>
+        <FrameLayout
+            android:id="@+id/dialpad_add_contact"
+            android:contentDescription="@string/description_add_contact"
+            style="@style/DialpadBottomKeyButtonStyle"
+            android:visibility="invisible"
+            >
+            <ImageView
+                android:src="@drawable/ic_add_person_dk"
+                android:importantForAccessibility="no"
+                android:paddingRight="@dimen/dialpad_key_letters_width"
+                style="@style/DialpadKeyInternalLayoutStyle"
+                />
+        </FrameLayout>
+        <Space
+            style="@style/DialpadBottomKeyButtonStyle"
+            />
+        <FrameLayout
+            android:id="@+id/dialpad_overflow"
+            android:contentDescription="@string/description_dialpad_overflow"
+            style="@style/DialpadBottomKeyButtonStyle"
+            >
+            <ImageView
+                android:src="@drawable/ic_overflow_menu"
+                android:importantForAccessibility="no"
+                android:paddingRight="@dimen/dialpad_key_letters_width"
+                style="@style/DialpadKeyInternalLayoutStyle"
+                />
+        </FrameLayout>
+    </TableRow>
 </TableLayout>
diff --git a/res/layout/dialpad_digits.xml b/res/layout/dialpad_digits.xml
index 21638f0..55fd27e 100644
--- a/res/layout/dialpad_digits.xml
+++ b/res/layout/dialpad_digits.xml
@@ -38,7 +38,6 @@
         android:textSize="@dimen/dialpad_digits_text_size"
         android:freezesText="true"
         android:focusableInTouchMode="true"
-        android:editable="true"
         android:cursorVisible="false"
         android:textColor="@color/dialpad_digits_text_color"
         android:textCursorDrawable="@null"
diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml
index d285cc3..9d3c620 100644
--- a/res/layout/dialpad_fragment.xml
+++ b/res/layout/dialpad_fragment.xml
@@ -32,13 +32,13 @@
         android:background="@drawable/shadow_fade_up" />
     <view class="com.android.dialer.dialpad.DialpadFragment$HoverIgnoringLinearLayout"
         android:id="@+id/top"
-        android:animateLayoutChanges="true"
         android:layout_height="wrap_content"
         android:layout_width="match_parent"
         android:layout_gravity="bottom"
         android:orientation="vertical"
         android:layoutDirection="ltr"
-        android:background="@color/background_dialpad">
+        android:background="@color/background_dialpad"
+        android:clickable="true">
 
         <Space
             android:layout_width="match_parent"
@@ -47,13 +47,13 @@
 
         <Space
             android:layout_width="match_parent"
-            android:layout_height="10dp" />
+            android:layout_height="5dp" />
 
         <include layout="@layout/dialpad_digits" />
 
         <Space
             android:layout_width="match_parent"
-            android:layout_height="8dp" />
+            android:layout_height="4dp" />
 
         <include layout="@layout/dialpad" />
 
diff --git a/res/layout/dialpad_key.xml b/res/layout/dialpad_key.xml
index 5bf858c..abbe4f9 100644
--- a/res/layout/dialpad_key.xml
+++ b/res/layout/dialpad_key.xml
@@ -17,7 +17,7 @@
 <!-- A layout representing a single key in the dialpad -->
 <com.android.dialer.dialpad.DialpadKeyButton
     xmlns:android="http://schemas.android.com/apk/res/android"
-    style="@style/DialpadKeyButtonStyle">
+    style="@style/DialpadKeyButtonStyle" >
 
     <LinearLayout style="@style/DialpadKeyInternalLayoutStyle">
 
diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml
index 2513216..50049af 100644
--- a/res/layout/dialtacts_activity.xml
+++ b/res/layout/dialtacts_activity.xml
@@ -13,7 +13,7 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<LinearLayout
+<RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/dialtacts_mainlayout"
     android:layout_width="match_parent"
@@ -27,8 +27,7 @@
     <RelativeLayout
         android:id="@+id/dialtacts_container"
         android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1"
+        android:layout_height="match_parent"
         android:clipChildren="false">
         <!-- The main contacts grid -->
         <FrameLayout
@@ -117,45 +116,28 @@
             </com.android.dialer.list.RemoveView>
         </FrameLayout>
     </RelativeLayout>
-    <!-- TODO: To be removed entirely and replaced with a floating action button -->
     <FrameLayout
-        android:layout_height="@dimen/fake_action_bar_height"
-        android:layout_width="match_parent"
-        android:id="@+id/fake_action_bar"
-        android:background="@color/actionbar_background_color">
-        <ImageButton
-            android:id="@+id/call_history_button"
-            android:layout_width="@dimen/fake_menu_button_min_width"
-            android:layout_height="match_parent"
-            android:layout_gravity="bottom|start"
-            android:background="?android:attr/selectableItemBackground"
-            android:contentDescription="@string/action_menu_call_history_description"
-            android:src="@drawable/ic_menu_history_lt"/>
+        android:layout_height="@dimen/floating_action_button_height"
+        android:layout_width="@dimen/floating_action_button_width"
+        android:layout_marginBottom="@dimen/floating_action_button_margin_bottom"
+        android:id="@+id/floating_action_button"
+        android:background="@color/actionbar_background_color"
+        android:layout_centerHorizontal="true"
+        android:layout_alignParentBottom="true" >
         <ImageButton
             android:id="@+id/dialpad_button"
-            android:layout_width="@dimen/fake_menu_button_min_width"
+            android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:layout_gravity="bottom|center"
             android:background="?android:attr/selectableItemBackground"
             android:contentDescription="@string/action_menu_dialpad_button"
             android:src="@drawable/ic_menu_dialpad_lt"/>
         <ImageButton
             android:id="@+id/dial_button"
-            android:layout_width="@dimen/fake_action_bar_height"
-            android:layout_height="@dimen/fake_action_bar_height"
-            android:layout_gravity="bottom|center"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
             android:background="@drawable/btn_call"
             android:contentDescription="@string/description_dial_button"
             android:src="@drawable/ic_dial_action_call"
             android:visibility="gone" />
-        <ImageButton
-            android:id="@+id/overflow_menu_button"
-            android:layout_width="@dimen/fake_menu_button_min_width"
-            android:layout_height="match_parent"
-            android:layout_gravity="bottom|end"
-            android:visibility="gone"
-            android:src="@drawable/ic_menu_overflow_lt"
-            android:contentDescription="@string/action_menu_overflow_description"
-            android:background="?android:attr/selectableItemBackground"/>
     </FrameLayout>
-</LinearLayout>
+</RelativeLayout>
diff --git a/res/menu/dialpad_options.xml b/res/menu/dialpad_options.xml
index 0727dd5..27a9b8a 100644
--- a/res/menu/dialpad_options.xml
+++ b/res/menu/dialpad_options.xml
@@ -15,11 +15,6 @@
 -->
 <menu xmlns:android="http://schemas.android.com/apk/res/android">
     <item
-        android:id="@+id/menu_add_contacts"
-        android:title="@string/recentCalls_addToContact"
-        android:showAsAction="withText"
-        android:orderInCategory="1" />
-    <item
         android:id="@+id/menu_2s_pause"
         android:title="@string/add_2sec_pause"
         android:showAsAction="withText"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 496eb43..d947361 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -51,11 +51,13 @@
     <dimen name="dialpad_key_numbers_width">30dp</dimen>
     <dimen name="dialpad_key_letters_width">50dp</dimen>
     <dimen name="dialpad_key_height">56dp</dimen>
+    <!-- The bottom row of the dialpad is slightly taller to account for the dial button -->
+    <dimen name="dialpad_bottom_key_height">70dp</dimen>
     <dimen name="dialpad_key_plus_size">18sp</dimen>
     <dimen name="dialpad_number_to_letters_padding">11dp</dimen>
     <dimen name="dialpad_horizontal_padding">5dp</dimen>
-    <dimen name="dialpad_digits_text_size">36sp</dimen>
-    <dimen name="dialpad_digits_height">47dp</dimen>
+    <dimen name="dialpad_digits_text_size">33sp</dimen>
+    <dimen name="dialpad_digits_height">55dp</dimen>
     <dimen name="dialpad_digits_padding">16dp</dimen>
     <dimen name="dialpad_digits_margin_bottom">0px</dimen>
     <dimen name="dialpad_center_margin">3dp</dimen>
@@ -63,9 +65,14 @@
     <!-- Match call_button_height to Phone's dimens/in_call_end_button_height -->
     <dimen name="call_button_height">74dp</dimen>
 
-    <dimen name="fake_action_bar_height">60dp</dimen>
-    <!-- Min width of fake menu buttons, which should be same as ActionBar's one -->
-    <dimen name="fake_menu_button_min_width">56dp</dimen>
+    <!-- Height of the floating action button -->
+    <dimen name="floating_action_button_height">60dp</dimen>
+    <!-- Width of the floating action button -->
+    <dimen name="floating_action_button_width">60dp</dimen>
+    <!-- Bottom margin of the floating action button -->
+    <dimen name="floating_action_button_margin_bottom">10dp</dimen>
+    <!-- Z translation of the floating action button -->
+    <dimen name="floating_action_button_translation_z">5dp</dimen>
 
     <!--  Favorites tile and recent call log padding -->
     <dimen name="contact_tile_divider_width">1dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index bd9aefb..2575a0b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -427,6 +427,9 @@
     -->
     <string name="description_add_contact">Add contact</string>
 
+    <!-- String describing the overflow menu button in the dialpad -->
+    <string name="description_dialpad_overflow">More options</string>
+
     <!-- String describing the button to view the contact for the current number.
 
         Note: AccessibilityServices use this attribute to announce what the view represents.
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 381ee35..a0e8aeb 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -144,6 +144,10 @@
         <item name="android:focusable">true</item>
     </style>
 
+    <style name="DialpadBottomKeyButtonStyle" parent="DialpadKeyButtonStyle">
+        <item name="android:layout_height">@dimen/dialpad_bottom_key_height</item>
+    </style>
+
     <style name="DialpadKeyInternalLayoutStyle">
         <item name="android:layout_width">wrap_content</item>
         <item name="android:layout_height">wrap_content</item>