Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit cb51464babc6683ecf60bf69ab46697fdb65eb77 1 parent f40c04a
Daisuke Miyakawa authored
View
1  Android.mk
@@ -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
View
4 res/drawable-finger/btn_dial.xml
@@ -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>
View
4 res/drawable-finger/dial_num_0.xml
@@ -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>
View
4 res/drawable-finger/dial_num_1_no_vm.xml
@@ -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>
View
4 res/drawable-finger/dial_num_2.xml
@@ -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>
View
4 res/drawable-finger/dial_num_3.xml
@@ -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>
View
4 res/drawable-finger/dial_num_4.xml
@@ -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>
View
4 res/drawable-finger/dial_num_5.xml
@@ -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>
View
4 res/drawable-finger/dial_num_6.xml
@@ -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>
View
4 res/drawable-finger/dial_num_7.xml
@@ -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>
View
4 res/drawable-finger/dial_num_8.xml
@@ -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>
View
4 res/drawable-finger/dial_num_9.xml
@@ -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>
View
4 res/drawable-finger/dial_num_pound.xml
@@ -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>
View
4 res/drawable-finger/dial_num_star.xml
@@ -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>
View
112 res/layout-finger/dialpad.xml
@@ -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>
View
95 res/layout-finger/non_drawer_dialpad.xml
@@ -54,99 +54,6 @@
android:clickable="false"/>
<!-- The dialpad itself -->
- <com.android.phone.ButtonGridLayout
- android:id="@+id/dialpad"
- android:paddingLeft="7dp"
- android:paddingRight="7dp"
- android:paddingTop="6dp"
- android:paddingBottom="6dp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- >
- <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_green"
- />
-
- <ImageButton android:id="@+id/two"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_2"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/three"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_3"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/four"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_4"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/five"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_5"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/six"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_6"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/seven"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_7"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/eight"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_8"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/nine"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_9"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/star"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_star"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/zero"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_0"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/pound"
- android:layout_width="88dp"
- android:layout_height="50dp"
- android:src="@drawable/dial_num_pound"
- android:background="@drawable/btn_dial_green"
- />
- </com.android.phone.ButtonGridLayout>
+ <include layout="@layout/dialpad" />
</com.android.phone.DTMFTwelveKeyDialerView>
View
116 res/layout-long-finger/dialpad.xml
@@ -1,116 +0,0 @@
-<?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.
--->
-
-<!-- Dialpad in the Phone app.
- Tall screen version with taller buttons.
- -->
-
-<com.android.phone.ButtonGridLayout 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_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_weight="1"
->
- <ImageButton android:id="@+id/one"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_1_no_vm"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/two"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_2"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/three"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_3"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/four"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_4"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/five"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_5"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/six"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_6"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/seven"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_7"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/eight"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_8"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/nine"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_9"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/star"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_star"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/zero"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_0"
- android:background="@drawable/btn_dial"
- />
-
- <ImageButton android:id="@+id/pound"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_pound"
- android:background="@drawable/btn_dial"
- />
-</com.android.phone.ButtonGridLayout>
-
View
152 res/layout-long-finger/non_drawer_dialpad.xml
@@ -1,152 +0,0 @@
-<?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.
--->
-
-<!-- New style in-call DTMF dialpad, for devices that use the
- InCallTouchUi widget, and thus do NOT use a SlidingDrawer
- to contain the dialpad.
-
- This provides basically the same UI elements as
- dtmf_twelve_key_dialer.xml and dialpad.xml, but in a more
- compact layout, and without the SlidingDrawer container.
- -->
-<com.android.phone.DTMFTwelveKeyDialerView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/non_drawer_dtmf_dialer"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_marginTop="1dip"
- android:visibility="gone"
- >
-
- <!-- Display of the digits you've typed so far -->
- <EditText
- android:id="@+id/dtmfDialerField"
- android:layout_width="match_parent"
- android:layout_height="32dp"
- android:layout_marginTop="10dp"
- android:layout_marginBottom="5dp"
- android:layout_marginLeft="32dp"
- android:layout_marginRight="32dp"
- android:paddingRight="16dp"
- android:paddingLeft="16dp"
- android:maxLines="1"
- android:scrollHorizontally="true"
- android:textSize="24sp"
- android:gravity="center"
- android:freezesText="true"
- android:background="@null"
- android:textColor="@color/dtmf_dialer_display_text"
- android:focusableInTouchMode="false"
- android:clickable="false"/>
-
- <!-- The dialpad itself -->
- <com.android.phone.ButtonGridLayout
- android:id="@+id/dialpad"
- android:paddingLeft="7dp"
- android:paddingRight="7dp"
- android:paddingTop="6dp"
- android:paddingBottom="6dp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- >
- <ImageButton android:id="@+id/one"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_1_no_vm"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/two"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_2"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/three"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_3"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/four"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_4"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/five"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_5"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/six"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_6"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/seven"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_7"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/eight"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_8"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/nine"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_9"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/star"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_star"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/zero"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_0"
- android:background="@drawable/btn_dial_green"
- />
-
- <ImageButton android:id="@+id/pound"
- android:layout_width="88dp"
- android:layout_height="58dp"
- android:src="@drawable/dial_num_pound"
- android:background="@drawable/btn_dial_green"
- />
- </com.android.phone.ButtonGridLayout>
-
-</com.android.phone.DTMFTwelveKeyDialerView>
View
18 res/values-long/dimens.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+<resources>
+ <dimen name="dialpad_button_height">58dip</dimen>
+</resources>
View
16 res/values/dimens.xml
@@ -1,4 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
<resources>
<!-- Dimensions for OTA Call Card -->
<dimen name="otabase_layout_marginTop">30dip</dimen>
@@ -6,4 +20,6 @@
<dimen name="otaactivate_layout_marginTop">10dip</dimen>
<dimen name="otalistenprogress_layout_marginTop">5dip</dimen>
<dimen name="otasuccessfail_layout_marginTop">10dip</dimen>
+
+ <dimen name="dialpad_button_height">50dip</dimen>
</resources>
View
84 res/values/strings.xml
@@ -1498,4 +1498,88 @@
<!-- Dialog message when changing a string for the "Respond via SMS" feature. [CHAR LIMIT=40] -->
<string name="respond_via_sms_edittext_dialog_message">Customize this response:</string>
+ <!-- String describing the image on ImageButton one
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_one">one</string>
+
+ <!-- String describing the image on ImageButton two
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_two">two</string>
+
+ <!-- String describing the image on ImageButton three
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_three">three</string>
+
+ <!-- String describing the image on ImageButton four
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_four">four</string>
+
+ <!-- String describing the image on ImageButton five
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_five">five</string>
+
+ <!-- String describing the image on ImageButton six
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_six">six</string>
+
+ <!-- String describing the image on ImageButton seven
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_seven">seven</string>
+
+ <!-- String describing the image on ImageButton eight
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_eight">eight</string>
+
+ <!-- String describing the image on ImageButton nine
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_nine">nine</string>
+
+ <!-- String describing the image on ImageButton star
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_star">star</string>
+
+ <!-- String describing the image on ImageButton zero
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_zero">zero</string>
+
+ <!-- String describing the image on ImageButton pound
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_image_button_pound">pound</string>
+
</resources>
View
7 res/values/styles.xml
@@ -230,4 +230,11 @@
<item name="android:windowCloseOnTouchOutside">true</item>
</style>
+ <style name="DialpadButtonStyle">
+ <item name="android:layout_width">0dip</item>
+ <item name="android:layout_height">@dimen/dialpad_button_height</item>
+ <item name="android:layout_weight">1</item>
+ <item name="android:background">@drawable/btn_dial</item>
+ <item name="android:soundEffectsEnabled">false</item>
+ </style>
</resources>
View
182 src/com/android/phone/ButtonGridLayout.java
@@ -1,182 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.phone;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View.MeasureSpec;
-import android.view.View;
-import android.view.ViewGroup;
-
-/**
- * Create a 4x3 grid of dial buttons.
- *
- * It was easier and more efficient to do it this way than use
- * standard layouts. It's perfectly fine (and actually encouraged) to
- * use custom layouts rather than piling up standard layouts.
- *
- * The horizontal and vertical spacings between buttons are controlled
- * by the amount of padding (attributes on the ButtonGridLayout element):
- * - horizontal = left + right padding and
- * - vertical = top + bottom padding.
- *
- * This class assumes that all the buttons have the same size.
- * The buttons will be bottom aligned in their view on layout.
- *
- * Invocation: onMeasure is called first by the framework to know our
- * size. Then onLayout is invoked to layout the buttons.
- */
-// TODO: Blindly layout the buttons w/o checking if we overrun the
-// bottom-right corner.
-
-public class ButtonGridLayout extends ViewGroup {
- static private final String TAG = "ButtonGridLayout";
- static private final int COLUMNS = 3;
- static private final int ROWS = 4;
- static private final int NUM_CHILDREN = ROWS * COLUMNS;
-
- private View[] mButtons = new View[NUM_CHILDREN];
-
- // This what the fields represent (height is similar):
- // PL: mPaddingLeft
- // BW: mButtonWidth
- // PR: mPaddingRight
- //
- // mWidthInc
- // <-------------------->
- // PL BW PR
- // <----><--------><---->
- // --------
- // | |
- // | button |
- // | |
- // --------
- //
- // We assume mPaddingLeft == mPaddingRight == 1/2 padding between
- // buttons.
- //
- // mWidth == COLUMNS x mWidthInc
-
- // Width and height of a button
- private int mButtonWidth;
- private int mButtonHeight;
-
- // Width and height of a button + padding.
- private int mWidthInc;
- private int mHeightInc;
-
- // Height of the dialpad. Used to align it at the bottom of the
- // view.
- private int mWidth;
- private int mHeight;
-
-
- public ButtonGridLayout(Context context) {
- super(context);
- }
-
- public ButtonGridLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public ButtonGridLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- /**
- * Cache the buttons in a member array for faster access. Compute
- * the measurements for the width/height of buttons. The inflate
- * sequence is called right after the constructor and before the
- * measure/layout phase.
- */
- @Override
- protected void onFinishInflate () {
- super.onFinishInflate();
- final View[] buttons = mButtons;
- for (int i = 0; i < NUM_CHILDREN; i++) {
- buttons[i] = getChildAt(i);
- // Measure the button to get initialized.
- buttons[i].measure(MeasureSpec.UNSPECIFIED , MeasureSpec.UNSPECIFIED);
- }
-
- // Cache the measurements.
- final View child = buttons[0];
- mButtonWidth = child.getMeasuredWidth();
- mButtonHeight = child.getMeasuredHeight();
- mWidthInc = mButtonWidth + mPaddingLeft + mPaddingRight;
- mHeightInc = mButtonHeight + mPaddingTop + mPaddingBottom;
- mWidth = COLUMNS * mWidthInc;
- mHeight = ROWS * mHeightInc;
- }
-
- /**
- * Set the background of all the children. Typically a selector to
- * change the background based on some combination of the button's
- * attributes (e.g pressed, enabled...)
- * @param resid Is a resource id to be used for each button's background.
- */
- public void setChildrenBackgroundResource(int resid) {
- final View[] buttons = mButtons;
- for (int i = 0; i < NUM_CHILDREN; i++) {
- buttons[i].setBackgroundResource(resid);
- }
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- final View[] buttons = mButtons;
- final int paddingLeft = mPaddingLeft;
- final int buttonWidth = mButtonWidth;
- final int buttonHeight = mButtonHeight;
- final int widthInc = mWidthInc;
- final int heightInc = mHeightInc;
-
- int i = 0;
- // The last row is bottom aligned.
- int y = (bottom - top) - mHeight + mPaddingTop;
- for (int row = 0; row < ROWS; row++) {
- int x = paddingLeft;
- for (int col = 0; col < COLUMNS; col++) {
- buttons[i].layout(x, y, x + buttonWidth, y + buttonHeight);
- x += widthInc;
- i++;
- }
- y += heightInc;
- }
- }
-
- /**
- * This method is called twice in practice. The first time both
- * with and height are constraint by AT_MOST. The second time, the
- * width is still AT_MOST and the height is EXACTLY. Either way
- * the full width/height should be in mWidth and mHeight and we
- * use 'resolveSize' to do the right thing.
- */
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- final int width = resolveSize(mWidth, widthMeasureSpec);
- final int height = resolveSize(mHeight, heightMeasureSpec);
- setMeasuredDimension(width, height);
- }
-
- @Override
- public boolean shouldDelayChildPressedState() {
- return false;
- }
-}
View
13 src/com/android/phone/DTMFTwelveKeyDialerView.java
@@ -43,7 +43,7 @@
private static final boolean DBG = false;
private DTMFTwelveKeyDialer mDialer;
- private ButtonGridLayout mButtonGrid;
+
public DTMFTwelveKeyDialerView (Context context) {
super(context);
@@ -55,7 +55,6 @@ public DTMFTwelveKeyDialerView(Context context, AttributeSet attrs) {
void setDialer (DTMFTwelveKeyDialer dialer) {
mDialer = dialer;
- mButtonGrid = (ButtonGridLayout)findViewById(R.id.dialpad);
}
/**
@@ -87,11 +86,17 @@ public boolean dispatchKeyEvent(KeyEvent event) {
* @param resid Is a resource id to be used for each button's background.
*/
public void setKeysBackgroundResource(int resid) {
- mButtonGrid.setChildrenBackgroundResource(resid);
+ final View[] buttons = new View[] {
+ findViewById(R.id.one), findViewById(R.id.two), findViewById(R.id.three),
+ findViewById(R.id.four), findViewById(R.id.five), findViewById(R.id.six),
+ findViewById(R.id.seven), findViewById(R.id.eight), findViewById(R.id.nine),
+ findViewById(R.id.star), findViewById(R.id.zero), findViewById(R.id.pound) };
+ for (View button : buttons) {
+ button.setBackgroundResource(resid);
+ }
}
private void log(String msg) {
Log.d(LOG_TAG, msg);
}
-
}
Please sign in to comment.
Something went wrong with that request. Please try again.