OSDN Git Service

New text field to display the punched numbers.
authorNicolas Catania <niko@google.com>
Mon, 21 Sep 2009 23:42:00 +0000 (16:42 -0700)
committerNicolas Catania <niko@google.com>
Mon, 21 Sep 2009 23:42:00 +0000 (16:42 -0700)
The numbers are centered in the field.
The active background is used when non empty.
Added top and bottom margin.
The font used appear a bit small compare to the
design, need to come up with a textAppearance resource
to control it (future CL)

Tested on cdma and gsm phones.

Bug: 2104523

res/layout-finger/twelve_key_dialer.xml
res/layout-land-finger/twelve_key_dialer.xml
src/com/android/contacts/TwelveKeyDialer.java

index 74f644b..418b154 100644 (file)
     android:layout_height="fill_parent"
     android:orientation="vertical"
 >
+
     <!-- Text field above the keypad where the digits are displayed -->
+    <!-- TODO: Use a textAppearance to control the display of the number -->
     <EditText android:id="@+id/digits"
         android:layout_width="fill_parent"
         android:layout_height="66dip"
+        android:layout_marginBottom="6dip"
+        android:layout_marginTop="1dip"
+        android:gravity="center"
         android:maxLines="1"
         android:scrollHorizontally="true"
         android:textSize="28sp"
index 0b89572..11ec8d6 100644 (file)
 >
 
     <!-- Text field above the keypad where the digits are displayed -->
+    <!-- TODO: Use a textAppearance to control the display of the number -->
     <EditText android:id="@+id/digits"
         android:layout_width="fill_parent"
         android:layout_height="66dip"
+        android:layout_marginBottom="6dip"
+        android:layout_marginTop="1dip"
+        android:gravity="center"
         android:maxLines="1"
         android:scrollHorizontally="true"
         android:textSize="28sp"
index ebb76c0..bdc6b6f 100644 (file)
@@ -155,6 +155,13 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
             mDigits.getText().clear();
         }
 
+        final boolean notEmpty = mDigits.length() != 0;
+        if (notEmpty) {
+            mDigits.setBackgroundDrawable(mDigitsBackground);
+        } else {
+            mDigits.setBackgroundDrawable(mDigitsEmptyBackground);
+        }
+
         updateDialAndDeleteButtonStateEnabledAttr();
     }
 
@@ -165,10 +172,9 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
         // Set the content view
         setContentView(getContentViewResource());
 
-        // Load up the resources for the text field and delete button
+        // Load up the resources for the text field.
         Resources r = getResources();
         mDigitsBackground = r.getDrawable(R.drawable.btn_dial_textfield_active);
-        //mDigitsBackground.setDither(true);
         mDigitsEmptyBackground = r.getDrawable(R.drawable.btn_dial_textfield);
 
         mDigits = (EditText) findViewById(R.id.digits);