Allow configuration of dialpad buttons visibility
The overflow menu/add contact buttons should have their
visibility toggled based on whether or not the digits can be edited.
For InCallUI, since the digits are not editable, none of these
action buttons should ever show up.
Change-Id: I2ce982fb0e2f5993f291f00ec309d99b3ddddbe8
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index ce2db3c..5de9ffd 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -309,7 +309,7 @@
mDigitsFilledByIntent = false;
mDigits.setCursorVisible(false);
mAddContactButton.setVisibility(View.INVISIBLE);
- } else {
+ } else if (mDialpadView.canDigitsBeEdited()){
mAddContactButton.setVisibility(View.VISIBLE);
}
diff --git a/src/com/android/dialer/dialpad/DialpadView.java b/src/com/android/dialer/dialpad/DialpadView.java
index d81be4d..a8b1e79 100644
--- a/src/com/android/dialer/dialpad/DialpadView.java
+++ b/src/com/android/dialer/dialpad/DialpadView.java
@@ -38,6 +38,8 @@
private EditText mDigits;
private ImageButton mDelete;
+ private boolean mCanDigitsBeEdited;
+
public DialpadView(Context context) {
this(context, null);
}
@@ -115,7 +117,7 @@
* @param canBeEdited If true, the backspace button will be shown and the digits EditText
* will be configured to allow text manipulation.
*/
- public void setDigitsCanBeEdited(boolean canBeEdited) {
+ public void setCanDigitsBeEdited(boolean canBeEdited) {
View deleteButton = findViewById(R.id.deleteButton);
deleteButton.setVisibility(canBeEdited ? View.VISIBLE : View.GONE);
@@ -124,6 +126,17 @@
digits.setLongClickable(canBeEdited);
digits.setFocusableInTouchMode(canBeEdited);
digits.setCursorVisible(false);
+
+ View overflowMenuButton = findViewById(R.id.dialpad_overflow);
+ overflowMenuButton.setVisibility(canBeEdited ? View.VISIBLE : View.GONE);
+
+ View addContactButton = findViewById(R.id.dialpad_add_contact);
+ addContactButton.setVisibility(canBeEdited ? View.VISIBLE : View.GONE);
+ mCanDigitsBeEdited = canBeEdited;
+ }
+
+ public boolean canDigitsBeEdited() {
+ return mCanDigitsBeEdited;
}
/**