Permalink
Browse files

Modify layout.

- use TableLayout instead of ButtonGridLayout everywhere
- remove ButtonGridLayout class entirely
- modify layout structure a bit: we should use dimens.xml for
  very similar layouts with different values
- add contentDescription for accessibility

Bug: 4982366
Change-Id: I6dfe3c8472a6b06c765be7dae1be1ec0c1dd8b96
  • Loading branch information...
1 parent f40c04a commit cb51464babc6683ecf60bf69ab46697fdb65eb77 Daisuke Miyakawa committed Jul 7, 2011
View
@@ -8,7 +8,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := user
LOCAL_SRC_FILES := \
- src/com/android/phone/ButtonGridLayout.java \
src/com/android/phone/CallLogAsync.java \
src/com/android/phone/HapticFeedback.java
@@ -23,6 +23,6 @@
android:drawable="@drawable/btn_dial_pressed" />
<item android:state_focused="true"
android:drawable="@drawable/btn_dial_selected" />
- <item
- android:drawable="@drawable/btn_dial_normal" />
+
+ <!-- no default drawable -->
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_0_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_0_blk" />
+ android:drawable="@drawable/dial_num_0_blk" /> -->
<item
android:drawable="@drawable/dial_num_0_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_1_no_vm_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_1_no_vm_blk" />
+ android:drawable="@drawable/dial_num_1_no_vm_blk" /> -->
<item
android:drawable="@drawable/dial_num_1_no_vm_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_2_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_2_blk" />
+ android:drawable="@drawable/dial_num_2_blk" /> -->
<item
android:drawable="@drawable/dial_num_2_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_3_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_3_blk" />
+ android:drawable="@drawable/dial_num_3_blk" /> -->
<item
android:drawable="@drawable/dial_num_3_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_4_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_4_blk" />
+ android:drawable="@drawable/dial_num_4_blk" /> -->
<item
android:drawable="@drawable/dial_num_4_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_5_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_5_blk" />
+ android:drawable="@drawable/dial_num_5_blk" /> -->
<item
android:drawable="@drawable/dial_num_5_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_6_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_6_blk" />
+ android:drawable="@drawable/dial_num_6_blk" /> -->
<item
android:drawable="@drawable/dial_num_6_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_7_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_7_blk" />
+ android:drawable="@drawable/dial_num_7_blk" /> -->
<item
android:drawable="@drawable/dial_num_7_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_8_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_8_blk" />
+ android:drawable="@drawable/dial_num_8_blk" /> -->
<item
android:drawable="@drawable/dial_num_8_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_9_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_9_blk" />
+ android:drawable="@drawable/dial_num_9_blk" /> -->
<item
android:drawable="@drawable/dial_num_9_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_pound_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_pound_blk" />
+ android:drawable="@drawable/dial_num_pound_blk" /> -->
<item
android:drawable="@drawable/dial_num_pound_wht" />
</selector>
@@ -15,10 +15,10 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
+ <!-- <item android:state_pressed="true"
android:drawable="@drawable/dial_num_star_blk" />
<item android:state_focused="true"
- android:drawable="@drawable/dial_num_star_blk" />
+ android:drawable="@drawable/dial_num_star_blk" /> -->
<item
android:drawable="@drawable/dial_num_star_wht" />
</selector>
@@ -14,99 +14,65 @@
limitations under the License.
-->
-<com.android.phone.ButtonGridLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<TableLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialpad"
android:paddingLeft="7dp"
android:paddingRight="7dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:layout_weight="1"
->
- <ImageButton android:id="@+id/one"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_1_no_vm"
- android:background="@drawable/btn_dial"
- />
+ android:layout_weight="1">
- <ImageButton android:id="@+id/two"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ <TableRow>
+ <ImageButton android:id="@+id/one" style="@style/DialpadButtonStyle"
+ android:src="@drawable/dial_num_1_no_vm"
+ android:contentDescription="@string/description_image_button_one" />
+ <ImageButton android:id="@+id/two" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_2"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/three"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ android:contentDescription="@string/description_image_button_two" />
+ <ImageButton android:id="@+id/three" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_3"
- android:background="@drawable/btn_dial"
- />
+ android:contentDescription="@string/description_image_button_three" />
+ </TableRow>
- <ImageButton android:id="@+id/four"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ <TableRow>
+ <ImageButton android:id="@+id/four" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_4"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/five"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ android:contentDescription="@string/description_image_button_four" />
+ <ImageButton android:id="@+id/five" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_5"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/six"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ android:contentDescription="@string/description_image_button_five" />
+ <ImageButton android:id="@+id/six" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_6"
- android:background="@drawable/btn_dial"
- />
+ android:contentDescription="@string/description_image_button_six" />
+ </TableRow>
- <ImageButton android:id="@+id/seven"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ <TableRow>
+ <ImageButton android:id="@+id/seven" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_7"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/eight"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ android:contentDescription="@string/description_image_button_seven" />
+ <ImageButton android:id="@+id/eight" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_8"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/nine"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ android:contentDescription="@string/description_image_button_eight" />
+ <ImageButton android:id="@+id/nine" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_9"
- android:background="@drawable/btn_dial"
- />
+ android:contentDescription="@string/description_image_button_nine" />
+ </TableRow>
- <ImageButton android:id="@+id/star"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ <TableRow>
+ <ImageButton android:id="@+id/star" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_star"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/zero"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ android:contentDescription="@string/description_image_button_star" />
+ <ImageButton android:id="@+id/zero" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_0"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/pound"
- android:layout_width="88dp"
- android:layout_height="50dp"
+ android:contentDescription="@string/description_image_button_zero" />
+ <ImageButton android:id="@+id/pound" style="@style/DialpadButtonStyle"
android:src="@drawable/dial_num_pound"
- android:background="@drawable/btn_dial"
- />
-</com.android.phone.ButtonGridLayout>
+ android:contentDescription="@string/description_image_button_pound" />
+
+ </TableRow>
+</TableLayout>
Oops, something went wrong.

0 comments on commit cb51464

Please sign in to comment.