New dial action button at the bottom of the dialer.

There is a new row of 3 buttons (voicemail, dial, backspace).
Currently only the dial button has been implemented.

In the new UI design the dial button should be visible even
on devices with a hard SEND button, therefore I changed the
resource that controls the display to true.

In the dialer, on resume, set the state_enabled attribute properly.

Bug: 2104523
diff --git a/src/com/android/contacts/TwelveKeyDialer.java b/src/com/android/contacts/TwelveKeyDialer.java
index 6ee9b32..2e88d89 100644
--- a/src/com/android/contacts/TwelveKeyDialer.java
+++ b/src/com/android/contacts/TwelveKeyDialer.java
@@ -94,6 +94,7 @@
     private View mDigitsAndBackspace;
     private View mDialpad;
     private View mDialButton;
+    private View mVoicemailDialAndBackspaceRow;
     private ListView mDialpadChooser;
     private DialpadChooserAdapter mDialpadChooserAdapter;
     //Member variables for dialpad options
@@ -168,10 +169,7 @@
             mDigits.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
         }
 
-        // Update the enabledness of the "Dial" button
-        if (mDialButton != null) {
-            mDialButton.setEnabled(mDigits.length() != 0);
-        }
+        updateDialButtonStateEnabledAttr();
     }
 
     @Override
@@ -204,11 +202,16 @@
             setupKeypad();
         }
 
+        mVoicemailDialAndBackspaceRow = findViewById(R.id.voicemailAndDialAndBackspace);
+
         // Check whether we should show the onscreen "Dial" button.
+        mDialButton = mVoicemailDialAndBackspaceRow.findViewById(R.id.dialButton);
+
         if (r.getBoolean(R.bool.config_show_onscreen_dial_button)) {
-            mDialButton = findViewById(R.id.dialButton);
-            mDialButton.setVisibility(View.VISIBLE);  // It's GONE by default
             mDialButton.setOnClickListener(this);
+        } else {
+            mDialButton.setVisibility(View.GONE); // It's VISIBLE by default
+            mDialButton = null;
         }
 
         view = findViewById(R.id.backspace);
@@ -431,6 +434,8 @@
             // be visible if the phone is idle!
             showDialpadChooser(false);
         }
+
+        updateDialButtonStateEnabledAttr();
     }
 
     @Override
@@ -778,7 +783,7 @@
             // Log.i(TAG, "Showing dialpad chooser!");
             mDigitsAndBackspace.setVisibility(View.GONE);
             if (mDialpad != null) mDialpad.setVisibility(View.GONE);
-            if (mDialButton != null) mDialButton.setVisibility(View.GONE);
+            mVoicemailDialAndBackspaceRow.setVisibility(View.GONE);
             mDialpadChooser.setVisibility(View.VISIBLE);
 
             // Instantiate the DialpadChooserAdapter and hook it up to the
@@ -791,7 +796,7 @@
             // Log.i(TAG, "Displaying normal Dialer UI.");
             mDigitsAndBackspace.setVisibility(View.VISIBLE);
             if (mDialpad != null) mDialpad.setVisibility(View.VISIBLE);
-            if (mDialButton != null) mDialButton.setVisibility(View.VISIBLE);
+            mVoicemailDialAndBackspaceRow.setVisibility(View.VISIBLE);
             mDialpadChooser.setVisibility(View.GONE);
         }
     }
@@ -1033,6 +1038,15 @@
     }
 
     /**
+     * Update the enabledness of the "Dial" button if applicable.
+     */
+    private void updateDialButtonStateEnabledAttr() {
+        if (mDialButton != null) {
+            mDialButton.setEnabled(mDigits.length() != 0);
+        }
+    }
+
+    /**
      * This function return true if Wait menu item can be shown
      * otherwise returns false. Assumes the passed string is non-empty
      * and the 0th index check is not required.