OSDN Git Service

New dial action button at the bottom of the dialer.
authorNicolas Catania <niko@google.com>
Fri, 18 Sep 2009 13:26:16 +0000 (06:26 -0700)
committerNicolas Catania <niko@google.com>
Fri, 18 Sep 2009 18:08:11 +0000 (11:08 -0700)
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

17 files changed:
res/drawable-finger/btn_dial_action.xml [new file with mode: 0644]
res/drawable-hdpi-finger/btn_dial_action_middle_disable.9.png [new file with mode: 0755]
res/drawable-hdpi-finger/btn_dial_action_middle_disable_focused.9.png [new file with mode: 0755]
res/drawable-hdpi-finger/btn_dial_action_middle_normal.9.png [new file with mode: 0755]
res/drawable-hdpi-finger/btn_dial_action_middle_pressed.9.png [new file with mode: 0755]
res/drawable-hdpi-finger/btn_dial_action_middle_selected.9.png [new file with mode: 0755]
res/drawable-hdpi-finger/ic_dial_action_call.png [new file with mode: 0755]
res/drawable-mdpi-finger/btn_dial_action_middle_disable.9.png [new file with mode: 0755]
res/drawable-mdpi-finger/btn_dial_action_middle_disable_focused.9.png [new file with mode: 0755]
res/drawable-mdpi-finger/btn_dial_action_middle_normal.9.png [new file with mode: 0755]
res/drawable-mdpi-finger/btn_dial_action_middle_pressed.9.png [new file with mode: 0755]
res/drawable-mdpi-finger/btn_dial_action_middle_selected.9.png [new file with mode: 0755]
res/drawable-mdpi-finger/ic_dial_action_call.png [new file with mode: 0755]
res/layout-finger/twelve_key_dialer.xml
res/layout-land-finger/twelve_key_dialer.xml
res/values/config.xml
src/com/android/contacts/TwelveKeyDialer.java

diff --git a/res/drawable-finger/btn_dial_action.xml b/res/drawable-finger/btn_dial_action.xml
new file mode 100644 (file)
index 0000000..9ffb31b
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+     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.
+-->
+
+<!-- Background resource for dial button for the various 12 key dialers. -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <!-- Disabled views -->
+    <item android:state_focused="true" android:state_enabled="false"
+        android:drawable="@drawable/btn_dial_action_middle_disable_focused" />
+    <item android:state_enabled="false"
+        android:drawable="@drawable/btn_dial_action_middle_disable" />
+
+    <!-- Enabled views -->
+    <item android:state_pressed="true" android:state_enabled="true"
+        android:drawable="@drawable/btn_dial_action_middle_pressed" />
+    <item android:state_focused="true" android:state_enabled="true"
+        android:drawable="@drawable/btn_dial_action_middle_selected" />
+    <item android:state_enabled="true"
+        android:drawable="@drawable/btn_dial_action_middle_normal" />
+</selector>
diff --git a/res/drawable-hdpi-finger/btn_dial_action_middle_disable.9.png b/res/drawable-hdpi-finger/btn_dial_action_middle_disable.9.png
new file mode 100755 (executable)
index 0000000..0a6cd66
Binary files /dev/null and b/res/drawable-hdpi-finger/btn_dial_action_middle_disable.9.png differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_middle_disable_focused.9.png b/res/drawable-hdpi-finger/btn_dial_action_middle_disable_focused.9.png
new file mode 100755 (executable)
index 0000000..b28176f
Binary files /dev/null and b/res/drawable-hdpi-finger/btn_dial_action_middle_disable_focused.9.png differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_middle_normal.9.png b/res/drawable-hdpi-finger/btn_dial_action_middle_normal.9.png
new file mode 100755 (executable)
index 0000000..0a6cd66
Binary files /dev/null and b/res/drawable-hdpi-finger/btn_dial_action_middle_normal.9.png differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_middle_pressed.9.png b/res/drawable-hdpi-finger/btn_dial_action_middle_pressed.9.png
new file mode 100755 (executable)
index 0000000..58f187d
Binary files /dev/null and b/res/drawable-hdpi-finger/btn_dial_action_middle_pressed.9.png differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_middle_selected.9.png b/res/drawable-hdpi-finger/btn_dial_action_middle_selected.9.png
new file mode 100755 (executable)
index 0000000..f201dee
Binary files /dev/null and b/res/drawable-hdpi-finger/btn_dial_action_middle_selected.9.png differ
diff --git a/res/drawable-hdpi-finger/ic_dial_action_call.png b/res/drawable-hdpi-finger/ic_dial_action_call.png
new file mode 100755 (executable)
index 0000000..1ba3a98
Binary files /dev/null and b/res/drawable-hdpi-finger/ic_dial_action_call.png differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_middle_disable.9.png b/res/drawable-mdpi-finger/btn_dial_action_middle_disable.9.png
new file mode 100755 (executable)
index 0000000..0740c95
Binary files /dev/null and b/res/drawable-mdpi-finger/btn_dial_action_middle_disable.9.png differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_middle_disable_focused.9.png b/res/drawable-mdpi-finger/btn_dial_action_middle_disable_focused.9.png
new file mode 100755 (executable)
index 0000000..c57627f
Binary files /dev/null and b/res/drawable-mdpi-finger/btn_dial_action_middle_disable_focused.9.png differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_middle_normal.9.png b/res/drawable-mdpi-finger/btn_dial_action_middle_normal.9.png
new file mode 100755 (executable)
index 0000000..0740c95
Binary files /dev/null and b/res/drawable-mdpi-finger/btn_dial_action_middle_normal.9.png differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_middle_pressed.9.png b/res/drawable-mdpi-finger/btn_dial_action_middle_pressed.9.png
new file mode 100755 (executable)
index 0000000..a5f9f98
Binary files /dev/null and b/res/drawable-mdpi-finger/btn_dial_action_middle_pressed.9.png differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_middle_selected.9.png b/res/drawable-mdpi-finger/btn_dial_action_middle_selected.9.png
new file mode 100755 (executable)
index 0000000..dcd4b82
Binary files /dev/null and b/res/drawable-mdpi-finger/btn_dial_action_middle_selected.9.png differ
diff --git a/res/drawable-mdpi-finger/ic_dial_action_call.png b/res/drawable-mdpi-finger/ic_dial_action_call.png
new file mode 100755 (executable)
index 0000000..1942899
Binary files /dev/null and b/res/drawable-mdpi-finger/ic_dial_action_call.png differ
index b873d3e..b350f4f 100644 (file)
@@ -4,9 +4,9 @@
      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.
     <!-- Keypad section -->
     <include layout="@layout/dialpad" />
 
-    <!-- Onscreen "Dial" button, used on some platforms -->
-    <Button android:id="@+id/dialButton"
-            android:text="@string/dial_button_label"
-            android:textAppearance="?android:attr/textAppearanceLarge"
-            android:layout_width="wrap_content"
-            android:layout_height="60dip"
-            android:gravity="center"
-            android:layout_gravity="center_horizontal"
-            android:layout_marginTop="20dip"
-            android:paddingLeft="100dip"
-            android:paddingRight="100dip"
-            android:enabled="false"
-            android:visibility="gone"
-            />
+    <!-- Horizontal row of buttons (Voicemail + DialButton + Backspace.) -->
+    <LinearLayout android:id="@+id/voicemailAndDialAndBackspace"
+        android:layout_width="wrap_content"
+        android:layout_height="fill_parent"
+        android:layout_gravity="center_horizontal"
+        android:layout_marginBottom="7dip"
+        android:orientation="horizontal">
+
+        <!-- Onscreen "Dial" button, used on all platforms by
+             default. Its usage can be disabled using resources (see
+             config.xml.) -->
+        <ImageButton android:id="@+id/dialButton"
+            android:layout_width="116dip"
+            android:layout_height="50dip"
+            android:layout_gravity="center_vertical"
+            android:state_enabled="false"
+            android:background="@drawable/btn_dial_action"
+            android:src="@drawable/ic_dial_action_call" />
+    </LinearLayout>
 
     <!-- "Dialpad chooser" UI, shown only when the user brings up the
          Dialer while a call is already in progress.
index d797fc1..2978799 100644 (file)
@@ -4,9 +4,9 @@
      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.
 
     </LinearLayout>
 
-    <!-- Onscreen "Dial" button, used on some platforms -->
-    <Button android:id="@+id/dialButton"
-            android:text="@string/dial_button_label"
-            android:textAppearance="?android:attr/textAppearanceLarge"
-            android:layout_width="wrap_content"
-            android:layout_height="60dip"
-            android:gravity="center"
-            android:layout_gravity="center_horizontal"
-            android:layout_marginTop="20dip"
-            android:paddingLeft="100dip"
-            android:paddingRight="100dip"
-            android:enabled="false"
-            android:visibility="gone"
-            />
+    <!-- Horizontal row of buttons (Voicemail + DialButton + Backspace.) -->
+    <LinearLayout android:id="@+id/voicemailAndDialAndBackspace"
+        android:layout_width="wrap_content"
+        android:layout_height="fill_parent"
+        android:layout_gravity="center_horizontal"
+        android:layout_marginBottom="7dip"
+        android:orientation="horizontal">
+
+        <!-- Onscreen "Dial" button, used on all platforms by
+             default. Its usage can be disabled using resources (see
+             config.xml.) -->
+        <ImageButton android:id="@+id/dialButton"
+            android:layout_width="116dip"
+            android:layout_height="50dip"
+            android:layout_gravity="center_vertical"
+            android:state_enabled="false"
+            android:background="@drawable/btn_dial_action"
+            android:src="@drawable/ic_dial_action_call" />
+    </LinearLayout>
 
     <!-- "Dialpad chooser" UI, shown only when the user brings up the
          Dialer while a call is already in progress.
index a7f39ff..81c3d67 100644 (file)
@@ -76,9 +76,9 @@
     <string name="config_export_extensions_to_consider" translatable="false"></string>
 
     <!-- If true, show an onscreen "Dial" button in the dialer.
-         (In practice this is used only on platforms with no hard SEND/END
+         In practice this is used on all platforms even the ones with hard SEND/END
          keys, but for maximum flexibility it's controlled by a flag here
-         (which can be overridden on a per-product basis.)) -->
-    <bool name="config_show_onscreen_dial_button">false</bool>
+         (which can be overridden on a per-product basis.) -->
+    <bool name="config_show_onscreen_dial_button">true</bool>
 
 </resources>
index 6ee9b32..2e88d89 100644 (file)
@@ -94,6 +94,7 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
     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 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
             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 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
             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 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
             // be visible if the phone is idle!
             showDialpadChooser(false);
         }
+
+        updateDialButtonStateEnabledAttr();
     }
 
     @Override
@@ -778,7 +783,7 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
             // 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 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
             // 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 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
     }
 
     /**
+     * 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.