Added backspace button.
Deleted old unused resource (delete active, normal, pressed, selected).
Renamed 'backspace' instances to 'delete' for consistency.
Removed the linear layout that used to hold the digit and backspace.
Bug 2104523
diff --git a/res/drawable-finger/btn_dial_delete.xml b/res/drawable-finger/btn_dial_delete.xml
index 235554d..b8c672d 100644
--- a/res/drawable-finger/btn_dial_delete.xml
+++ b/res/drawable-finger/btn_dial_delete.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
+<!-- Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,12 +14,20 @@
limitations under the License.
-->
+<!-- Background resource for backspace button for the various 12 key dialers. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
- android:drawable="@drawable/btn_dial_delete_pressed" />
- <item android:state_focused="true"
- android:drawable="@drawable/btn_dial_delete_selected" />
- <item
- android:drawable="@drawable/btn_dial_delete_normal" />
+ <!-- Disabled views -->
+ <item android:state_focused="true" android:state_enabled="false"
+ android:drawable="@drawable/btn_dial_action_right_disable_focused" />
+ <item android:state_enabled="false"
+ android:drawable="@drawable/btn_dial_action_right_disable" />
+
+ <!-- Enabled views -->
+ <item android:state_pressed="true" android:state_enabled="true"
+ android:drawable="@drawable/btn_dial_action_right_pressed" />
+ <item android:state_focused="true" android:state_enabled="true"
+ android:drawable="@drawable/btn_dial_action_right_selected" />
+ <item android:state_enabled="true"
+ android:drawable="@drawable/btn_dial_action_right_normal" />
</selector>
diff --git a/res/drawable-finger/btn_dial_delete_activated.9.png b/res/drawable-finger/btn_dial_delete_activated.9.png
deleted file mode 100644
index 453a368..0000000
--- a/res/drawable-finger/btn_dial_delete_activated.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-finger/btn_dial_delete_active.xml b/res/drawable-finger/btn_dial_delete_active.xml
deleted file mode 100644
index 3403f34..0000000
--- a/res/drawable-finger/btn_dial_delete_active.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
- android:drawable="@drawable/btn_dial_delete_pressed" />
- <item android:state_focused="true"
- android:drawable="@drawable/btn_dial_delete_selected" />
- <item
- android:drawable="@drawable/btn_dial_delete_activated" />
-</selector>
-
diff --git a/res/drawable-finger/btn_dial_delete_normal.9.png b/res/drawable-finger/btn_dial_delete_normal.9.png
deleted file mode 100644
index 9da1cff..0000000
--- a/res/drawable-finger/btn_dial_delete_normal.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-finger/btn_dial_delete_pressed.9.png b/res/drawable-finger/btn_dial_delete_pressed.9.png
deleted file mode 100644
index 5bbc20d..0000000
--- a/res/drawable-finger/btn_dial_delete_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-finger/btn_dial_delete_selected.9.png b/res/drawable-finger/btn_dial_delete_selected.9.png
deleted file mode 100644
index d959768..0000000
--- a/res/drawable-finger/btn_dial_delete_selected.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-finger/ic_delete_phone_number.xml b/res/drawable-finger/ic_delete_phone_number.xml
deleted file mode 100644
index adfc0ce..0000000
--- a/res/drawable-finger/ic_delete_phone_number.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
- android:drawable="@drawable/ic_delete_phone_number_blk" />
- <item android:state_focused="true"
- android:drawable="@drawable/ic_delete_phone_number_blk" />
- <item
- android:drawable="@drawable/ic_delete_phone_number_wht" />
-</selector>
-
diff --git a/res/drawable-finger/ic_delete_phone_number_blk.png b/res/drawable-finger/ic_delete_phone_number_blk.png
deleted file mode 100644
index 2e83d36..0000000
--- a/res/drawable-finger/ic_delete_phone_number_blk.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-finger/ic_delete_phone_number_wht.png b/res/drawable-finger/ic_delete_phone_number_wht.png
deleted file mode 100644
index 988bcfd..0000000
--- a/res/drawable-finger/ic_delete_phone_number_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_right_disable.9.png b/res/drawable-hdpi-finger/btn_dial_action_right_disable.9.png
new file mode 100755
index 0000000..6e6fa30
--- /dev/null
+++ b/res/drawable-hdpi-finger/btn_dial_action_right_disable.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_right_disable_focused.9.png b/res/drawable-hdpi-finger/btn_dial_action_right_disable_focused.9.png
new file mode 100755
index 0000000..46a042f
--- /dev/null
+++ b/res/drawable-hdpi-finger/btn_dial_action_right_disable_focused.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_right_normal.9.png b/res/drawable-hdpi-finger/btn_dial_action_right_normal.9.png
new file mode 100755
index 0000000..6e6fa30
--- /dev/null
+++ b/res/drawable-hdpi-finger/btn_dial_action_right_normal.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_right_pressed.9.png b/res/drawable-hdpi-finger/btn_dial_action_right_pressed.9.png
new file mode 100755
index 0000000..d66a509
--- /dev/null
+++ b/res/drawable-hdpi-finger/btn_dial_action_right_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_right_selected.9.png b/res/drawable-hdpi-finger/btn_dial_action_right_selected.9.png
new file mode 100755
index 0000000..d2ee98b
--- /dev/null
+++ b/res/drawable-hdpi-finger/btn_dial_action_right_selected.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_dial_action_delete.png b/res/drawable-hdpi-finger/ic_dial_action_delete.png
new file mode 100755
index 0000000..2e206c8
--- /dev/null
+++ b/res/drawable-hdpi-finger/ic_dial_action_delete.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_right_disable.9.png b/res/drawable-mdpi-finger/btn_dial_action_right_disable.9.png
new file mode 100755
index 0000000..85dfff0
--- /dev/null
+++ b/res/drawable-mdpi-finger/btn_dial_action_right_disable.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_right_disable_focused.9.png b/res/drawable-mdpi-finger/btn_dial_action_right_disable_focused.9.png
new file mode 100755
index 0000000..1f76f0c
--- /dev/null
+++ b/res/drawable-mdpi-finger/btn_dial_action_right_disable_focused.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_right_normal.9.png b/res/drawable-mdpi-finger/btn_dial_action_right_normal.9.png
new file mode 100755
index 0000000..85dfff0
--- /dev/null
+++ b/res/drawable-mdpi-finger/btn_dial_action_right_normal.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_right_pressed.9.png b/res/drawable-mdpi-finger/btn_dial_action_right_pressed.9.png
new file mode 100755
index 0000000..226633f
--- /dev/null
+++ b/res/drawable-mdpi-finger/btn_dial_action_right_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_right_selected.9.png b/res/drawable-mdpi-finger/btn_dial_action_right_selected.9.png
new file mode 100755
index 0000000..9cca52c
--- /dev/null
+++ b/res/drawable-mdpi-finger/btn_dial_action_right_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_dial_action_delete.png b/res/drawable-mdpi-finger/ic_dial_action_delete.png
new file mode 100755
index 0000000..440ae37
--- /dev/null
+++ b/res/drawable-mdpi-finger/ic_dial_action_delete.png
Binary files differ
diff --git a/res/layout-finger/twelve_key_dialer.xml b/res/layout-finger/twelve_key_dialer.xml
index c904deb..74f644b 100644
--- a/res/layout-finger/twelve_key_dialer.xml
+++ b/res/layout-finger/twelve_key_dialer.xml
@@ -20,46 +20,24 @@
android:layout_height="fill_parent"
android:orientation="vertical"
>
- <LinearLayout android:id="@+id/digitsAndBackspace"
+ <!-- Text field above the keypad where the digits are displayed -->
+ <EditText android:id="@+id/digits"
android:layout_width="fill_parent"
android:layout_height="66dip"
- android:layout_marginTop="3dip"
- android:layout_marginBottom="5dip"
- android:layout_marginLeft="3dip"
- android:layout_marginRight="3dip"
- android:orientation="horizontal"
- >
-
- <EditText android:id="@+id/digits"
- android:layout_width="0dip"
- android:layout_weight="1"
- android:layout_height="66dip"
- android:maxLines="1"
- android:scrollHorizontally="true"
- android:textSize="28sp"
- android:freezesText="true"
- android:background="@drawable/btn_dial_textfield"
- android:textColor="@color/dialer_button_text"
- android:focusableInTouchMode="false"
- android:nextFocusRight="@+id/backspace"
- />
-
- <ImageButton android:id="@+id/backspace"
- style="@android:style/Widget.Button.Inset"
- android:layout_width="wrap_content"
- android:layout_height="66dip"
- android:background="@drawable/btn_dial_delete"
- android:src="@drawable/ic_delete_phone_number"
- android:gravity="center"
- />
-
- </LinearLayout>
+ android:maxLines="1"
+ android:scrollHorizontally="true"
+ android:textSize="28sp"
+ android:freezesText="true"
+ android:background="@drawable/btn_dial_textfield"
+ android:textColor="@color/dialer_button_text"
+ android:focusableInTouchMode="false"
+ />
<!-- Keypad section -->
<include layout="@layout/dialpad" />
- <!-- Horizontal row of buttons (Voicemail + DialButton + Backspace.) -->
- <LinearLayout android:id="@+id/voicemailAndDialAndBackspace"
+ <!-- Horizontal row of buttons (Voicemail + DialButton + Delete.) -->
+ <LinearLayout android:id="@+id/voicemailAndDialAndDelete"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
@@ -85,6 +63,15 @@
android:state_enabled="false"
android:background="@drawable/btn_dial_action"
android:src="@drawable/ic_dial_action_call" />
+
+ <!-- Onscreen "Backspace/Delete" button -->
+ <ImageButton android:id="@+id/deleteButton"
+ android:layout_width="90dip"
+ android:layout_height="52dip"
+ android:layout_gravity="center_vertical"
+ android:state_enabled="false"
+ android:background="@drawable/btn_dial_delete"
+ android:src="@drawable/ic_dial_action_delete" />
</LinearLayout>
<!-- "Dialpad chooser" UI, shown only when the user brings up the
diff --git a/res/layout-land-finger/twelve_key_dialer.xml b/res/layout-land-finger/twelve_key_dialer.xml
index 9547ed5..0b89572 100644
--- a/res/layout-land-finger/twelve_key_dialer.xml
+++ b/res/layout-land-finger/twelve_key_dialer.xml
@@ -20,47 +20,22 @@
android:layout_height="fill_parent"
android:orientation="vertical"
>
- <LinearLayout android:id="@+id/digitsAndBackspace"
+
+ <!-- Text field above the keypad where the digits are displayed -->
+ <EditText android:id="@+id/digits"
android:layout_width="fill_parent"
android:layout_height="66dip"
- android:addStatesFromChildren="true"
- android:gravity="center_vertical"
- android:baselineAligned="false"
- android:layout_marginTop="3dip"
- android:layout_marginBottom="5dip"
- android:layout_marginLeft="3dip"
- android:layout_marginRight="3dip"
- >
+ android:maxLines="1"
+ android:scrollHorizontally="true"
+ android:textSize="28sp"
+ android:freezesText="true"
+ android:background="@drawable/btn_dial_textfield"
+ android:textColor="@color/dialer_button_text"
+ android:hint="@string/dialerKeyboardHintText"
+ />
- <EditText android:id="@+id/digits"
- android:layout_width="0dip"
- android:layout_weight="1"
- android:layout_height="66dip"
- android:maxLines="1"
- android:scrollHorizontally="true"
- android:textSize="28sp"
- android:freezesText="true"
- android:background="@drawable/btn_dial_textfield"
- android:textColor="@color/dialer_button_text"
- android:hint="@string/dialerKeyboardHintText"
- />
-
- <!--
- The button goes at the right.
- -->
- <ImageButton android:id="@+id/backspace"
- style="@android:style/Widget.Button.Inset"
- android:src="@drawable/ic_delete_phone_number"
- android:layout_width="wrap_content"
- android:layout_height="66dip"
- android:background="@drawable/btn_dial_delete"
- android:gravity="center"
- />
-
- </LinearLayout>
-
- <!-- Horizontal row of buttons (Voicemail + DialButton + Backspace.) -->
- <LinearLayout android:id="@+id/voicemailAndDialAndBackspace"
+ <!-- Horizontal row of buttons (Voicemail + DialButton + Delete.) -->
+ <LinearLayout android:id="@+id/voicemailAndDialAndDelete"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
@@ -86,6 +61,15 @@
android:state_enabled="false"
android:background="@drawable/btn_dial_action"
android:src="@drawable/ic_dial_action_call" />
+
+ <!-- Onscreen "Backspace/Delete" button -->
+ <ImageButton android:id="@+id/deleteButton"
+ android:layout_width="90dip"
+ android:layout_height="52dip"
+ android:layout_gravity="center_vertical"
+ android:state_enabled="false"
+ android:background="@drawable/btn_dial_delete"
+ android:src="@drawable/ic_dial_action_delete" />
</LinearLayout>
<!-- "Dialpad chooser" UI, shown only when the user brings up the
diff --git a/src/com/android/contacts/TwelveKeyDialer.java b/src/com/android/contacts/TwelveKeyDialer.java
index 2be677a..ebb76c0 100644
--- a/src/com/android/contacts/TwelveKeyDialer.java
+++ b/src/com/android/contacts/TwelveKeyDialer.java
@@ -89,11 +89,8 @@
private Object mToneGeneratorLock = new Object();
private Drawable mDigitsBackground;
private Drawable mDigitsEmptyBackground;
- private Drawable mDeleteBackground;
- private Drawable mDeleteEmptyBackground;
- private View mDigitsAndBackspace;
private View mDialpad;
- private View mVoicemailDialAndBackspaceRow;
+ private View mVoicemailDialAndDeleteRow;
private View mVoicemailButton;
private View mDialButton;
private ListView mDialpadChooser;
@@ -158,19 +155,7 @@
mDigits.getText().clear();
}
- // Set the proper background for the dial input area
- if (mDigits.length() != 0) {
- mDelete.setBackgroundDrawable(mDeleteBackground);
- mDigits.setBackgroundDrawable(mDigitsBackground);
- mDigits.setCompoundDrawablesWithIntrinsicBounds(
- getResources().getDrawable(R.drawable.ic_dial_number), null, null, null);
- } else {
- mDelete.setBackgroundDrawable(mDeleteEmptyBackground);
- mDigits.setBackgroundDrawable(mDigitsEmptyBackground);
- mDigits.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
- }
-
- updateDialButtonStateEnabledAttr();
+ updateDialAndDeleteButtonStateEnabledAttr();
}
@Override
@@ -185,11 +170,6 @@
mDigitsBackground = r.getDrawable(R.drawable.btn_dial_textfield_active);
//mDigitsBackground.setDither(true);
mDigitsEmptyBackground = r.getDrawable(R.drawable.btn_dial_textfield);
- //mDigitsEmptyBackground.setDither(true);
- mDeleteBackground = r.getDrawable(R.drawable.btn_dial_delete_active);
- //mDeleteBackground.setDither(true);
- mDeleteEmptyBackground = r.getDrawable(R.drawable.btn_dial_delete);
- //mDeleteEmptyBackground.setDither(true);
mDigits = (EditText) findViewById(R.id.digits);
mDigits.setKeyListener(DialerKeyListener.getInstance());
@@ -203,12 +183,12 @@
setupKeypad();
}
- mVoicemailDialAndBackspaceRow = findViewById(R.id.voicemailAndDialAndBackspace);
+ mVoicemailDialAndDeleteRow = findViewById(R.id.voicemailAndDialAndDelete);
initVoicemailButton();
// Check whether we should show the onscreen "Dial" button.
- mDialButton = mVoicemailDialAndBackspaceRow.findViewById(R.id.dialButton);
+ mDialButton = mVoicemailDialAndDeleteRow.findViewById(R.id.dialButton);
if (r.getBoolean(R.bool.config_show_onscreen_dial_button)) {
mDialButton.setOnClickListener(this);
@@ -217,12 +197,11 @@
mDialButton = null;
}
- view = findViewById(R.id.backspace);
+ view = mVoicemailDialAndDeleteRow.findViewById(R.id.deleteButton);
view.setOnClickListener(this);
view.setOnLongClickListener(this);
mDelete = view;
- mDigitsAndBackspace = findViewById(R.id.digitsAndBackspace);
mDialpad = findViewById(R.id.dialpad); // This is null in landscape mode
// Set up the "dialpad chooser" UI; see showDialpadChooser().
@@ -438,7 +417,7 @@
showDialpadChooser(false);
}
- updateDialButtonStateEnabledAttr();
+ updateDialAndDeleteButtonStateEnabledAttr();
}
@Override
@@ -666,7 +645,7 @@
keyPressed(KeyEvent.KEYCODE_STAR);
return;
}
- case R.id.backspace: {
+ case R.id.deleteButton: {
keyPressed(KeyEvent.KEYCODE_DEL);
return;
}
@@ -688,8 +667,12 @@
final Editable digits = mDigits.getText();
int id = view.getId();
switch (id) {
- case R.id.backspace: {
+ case R.id.deleteButton: {
digits.clear();
+ // TODO: The framework forgets to clear the pressed
+ // status of disabled button. Until this is fixed,
+ // clear manually the pressed status. b/2133127
+ mDelete.setPressed(false);
return true;
}
case R.id.one: {
@@ -789,9 +772,9 @@
private void showDialpadChooser(boolean enabled) {
if (enabled) {
// Log.i(TAG, "Showing dialpad chooser!");
- mDigitsAndBackspace.setVisibility(View.GONE);
+ mDigits.setVisibility(View.GONE);
if (mDialpad != null) mDialpad.setVisibility(View.GONE);
- mVoicemailDialAndBackspaceRow.setVisibility(View.GONE);
+ mVoicemailDialAndDeleteRow.setVisibility(View.GONE);
mDialpadChooser.setVisibility(View.VISIBLE);
// Instantiate the DialpadChooserAdapter and hook it up to the
@@ -802,9 +785,9 @@
}
} else {
// Log.i(TAG, "Displaying normal Dialer UI.");
- mDigitsAndBackspace.setVisibility(View.VISIBLE);
+ mDigits.setVisibility(View.VISIBLE);
if (mDialpad != null) mDialpad.setVisibility(View.VISIBLE);
- mVoicemailDialAndBackspaceRow.setVisibility(View.VISIBLE);
+ mVoicemailDialAndDeleteRow.setVisibility(View.VISIBLE);
mDialpadChooser.setVisibility(View.GONE);
}
}
@@ -1046,14 +1029,18 @@
}
/**
- * Update the enabledness of the "Dial" button if applicable.
+ * Update the enabledness of the "Dial" and "Backspace" buttons if applicable.
*/
- private void updateDialButtonStateEnabledAttr() {
+ private void updateDialAndDeleteButtonStateEnabledAttr() {
+ final boolean notEmpty = mDigits.length() != 0;
+
if (mDialButton != null) {
- mDialButton.setEnabled(mDigits.length() != 0);
+ mDialButton.setEnabled(notEmpty);
}
+ mDelete.setEnabled(notEmpty);
}
+
/**
* Check if voicemail is enabled/accessible.
*/
@@ -1065,7 +1052,7 @@
// Possibly no READ_PHONE_STATE privilege.
}
- mVoicemailButton = mVoicemailDialAndBackspaceRow.findViewById(R.id.voicemailButton);
+ mVoicemailButton = mVoicemailDialAndDeleteRow.findViewById(R.id.voicemailButton);
if (hasVoicemail) {
mVoicemailButton.setOnClickListener(this);
} else {