Dialer: add onscreen "Dial" button.
Add a new "Dial" button, below the keypad (in portrait) or below the
"digits" widget (in landscape). It does the exact same action as tapping
the digits widget, and its enabled/disabled state uses the exact same
logic that turns the digit widget green when it's OK to dial.
This is a partial fix for bug 1825144 (soft SEND/END keys in places other
than in-call),
The button has visibility GONE by default; it's enabled on a per-product
basis using a flag in config.xml. (To enable this on devices that need
it, I'll separately check in resource overlay files in those other
projects)
For now the Dial button is just a regular button, with no special layout
or artwork. (But bug 1993282 is open to cover any future visual design
tweaks we might need.)
diff --git a/src/com/android/contacts/TwelveKeyDialer.java b/src/com/android/contacts/TwelveKeyDialer.java
index a7c1bf5..428cc8e 100644
--- a/src/com/android/contacts/TwelveKeyDialer.java
+++ b/src/com/android/contacts/TwelveKeyDialer.java
@@ -95,6 +95,7 @@
private Drawable mDeleteEmptyBackground;
private View mDigitsAndBackspace;
private View mDialpad;
+ private View mDialButton;
private ListView mDialpadChooser;
private DialpadChooserAdapter mDialpadChooserAdapter;
//Member variables for dialpad options
@@ -168,6 +169,11 @@
mDigits.setBackgroundDrawable(mDigitsEmptyBackground);
mDigits.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
}
+
+ // Update the enabledness of the "Dial" button
+ if (mDialButton != null) {
+ mDialButton.setEnabled(mDigits.length() != 0);
+ }
}
@Override
@@ -200,6 +206,13 @@
setupKeypad();
}
+ // Check whether we should show the onscreen "Dial" button.
+ 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);
+ }
+
view = findViewById(R.id.backspace);
view.setOnClickListener(this);
view.setOnLongClickListener(this);
@@ -678,6 +691,7 @@
keyPressed(KeyEvent.KEYCODE_DEL);
return;
}
+ case R.id.dialButton:
case R.id.digits: {
vibrate(); // Vibrate here too, just like we do for the regular keys
placeCall();
@@ -813,6 +827,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);
mDialpadChooser.setVisibility(View.VISIBLE);
// Instantiate the DialpadChooserAdapter and hook it up to the
@@ -825,6 +840,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);
mDialpadChooser.setVisibility(View.GONE);
}
}