summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/proguard.flags6
-rw-r--r--InCallUI/res/anim/slide_in.xml23
-rw-r--r--InCallUI/res/anim/slide_out.xml23
-rw-r--r--InCallUI/res/drawable/dialpad_key_colors.xml22
-rw-r--r--InCallUI/res/layout/dialpad.xml76
-rw-r--r--InCallUI/res/layout/dialpad_key.xml34
-rw-r--r--InCallUI/res/layout/dtmf_twelve_key_dialer_view.xml135
-rw-r--r--InCallUI/res/values/colors.xml22
-rw-r--r--InCallUI/res/values/dimens.xml16
-rw-r--r--InCallUI/res/values/strings.xml50
-rw-r--r--InCallUI/res/values/styles.xml49
-rw-r--r--InCallUI/src/com/android/incallui/DialpadFragment.java147
-rw-r--r--InCallUI/src/com/android/incallui/InCallActivity.java17
-rw-r--r--InCallUI/src/com/android/incallui/NeededForReflection.java30
14 files changed, 525 insertions, 125 deletions
diff --git a/InCallUI/proguard.flags b/InCallUI/proguard.flags
index bc8814355..4e8310ca9 100644
--- a/InCallUI/proguard.flags
+++ b/InCallUI/proguard.flags
@@ -6,3 +6,9 @@
-keepclasseswithmembers class com.android.incallui.AnimationUtils$CrossFadeDrawable {
*** setCrossFadeAlpha(...);
}
+
+# Any class or method annotated with NeededForTesting or NeededForReflection.
+-keepclassmembers class * {
+@com.android.contacts.common.test.NeededForTesting *;
+@com.android.incallui.NeededForReflection *;
+}
diff --git a/InCallUI/res/anim/slide_in.xml b/InCallUI/res/anim/slide_in.xml
new file mode 100644
index 000000000..c8372ce27
--- /dev/null
+++ b/InCallUI/res/anim/slide_in.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<objectAnimator
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:valueFrom="0.67"
+ android:valueTo="0"
+ android:valueType="floatType"
+ android:propertyName="yFraction"
+ android:duration="200" /> \ No newline at end of file
diff --git a/InCallUI/res/anim/slide_out.xml b/InCallUI/res/anim/slide_out.xml
new file mode 100644
index 000000000..2861db275
--- /dev/null
+++ b/InCallUI/res/anim/slide_out.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<objectAnimator
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:valueFrom="0"
+ android:valueTo="0.67"
+ android:valueType="floatType"
+ android:propertyName="yFraction"
+ android:duration="200" /> \ No newline at end of file
diff --git a/InCallUI/res/drawable/dialpad_key_colors.xml b/InCallUI/res/drawable/dialpad_key_colors.xml
new file mode 100644
index 000000000..27b4d4fc5
--- /dev/null
+++ b/InCallUI/res/drawable/dialpad_key_colors.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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="@color/background_dialpad_pressed" />
+ <item android:drawable="@color/background_dialpad" />
+</selector>
diff --git a/InCallUI/res/layout/dialpad.xml b/InCallUI/res/layout/dialpad.xml
new file mode 100644
index 000000000..d537e6200
--- /dev/null
+++ b/InCallUI/res/layout/dialpad.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<TableLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/dialpad"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:paddingLeft="@dimen/dialpad_horizontal_padding"
+ android:paddingRight="@dimen/dialpad_horizontal_padding"
+ android:background="@color/background_dialpad"
+ android:stretchColumns="*"
+ android:layoutDirection="ltr" >
+
+ <TableRow>
+ <include layout="@layout/dialpad_key" android:id="@+id/one"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/two"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/three"/>
+ </TableRow>
+
+ <TableRow>
+ <include layout="@layout/dialpad_key" android:id="@+id/four"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/five"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/six"/>
+ </TableRow>
+
+ <TableRow>
+ <include layout="@layout/dialpad_key" android:id="@+id/seven"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/eight"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/nine"/>
+ </TableRow>
+
+ <TableRow>
+ <com.android.dialer.dialpad.DialpadKeyButton
+ android:id="@+id/star"
+ style="@style/DialpadKeyButtonStyle">
+ <LinearLayout
+ style="@style/DialpadKeyInternalLayoutStyle">
+ <TextView
+ android:id="@id/dialpad_key_number"
+ style="@style/DialpadKeyStarPoundStyle" />
+ <View
+ android:layout_height="match_parent"
+ android:layout_width="@dimen/dialpad_key_letters_width" />
+ </LinearLayout>
+ </com.android.dialer.dialpad.DialpadKeyButton>
+ <include layout="@layout/dialpad_key" android:id="@+id/zero"/>
+ <com.android.dialer.dialpad.DialpadKeyButton
+ android:id="@+id/pound"
+ style="@style/DialpadKeyButtonStyle">
+ <LinearLayout
+ style="@style/DialpadKeyInternalLayoutStyle">
+ <TextView
+ android:id="@id/dialpad_key_number"
+ style="@style/DialpadKeyStarPoundStyle" />
+ <View
+ android:layout_height="match_parent"
+ android:layout_width="@dimen/dialpad_key_letters_width" />
+ </LinearLayout>
+ </com.android.dialer.dialpad.DialpadKeyButton>
+ </TableRow>
+</TableLayout>
diff --git a/InCallUI/res/layout/dialpad_key.xml b/InCallUI/res/layout/dialpad_key.xml
new file mode 100644
index 000000000..180074dec
--- /dev/null
+++ b/InCallUI/res/layout/dialpad_key.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/DialpadKeyButtonStyle">
+
+ <LinearLayout style="@style/DialpadKeyInternalLayoutStyle">
+
+ <!-- Note in the referenced styles that we assign hard widths to these components
+ because we want them to line up vertically when we arrange them in an MxN grid -->
+
+ <TextView
+ android:id="@+id/dialpad_key_number"
+ style="@style/DialpadKeyNumberStyle" />
+
+ <TextView
+ android:id="@+id/dialpad_key_letters"
+ style="@style/DialpadKeyLettersStyle" />
+ </LinearLayout>
+</FrameLayout> \ No newline at end of file
diff --git a/InCallUI/res/layout/dtmf_twelve_key_dialer_view.xml b/InCallUI/res/layout/dtmf_twelve_key_dialer_view.xml
index fe84010c7..7240cb119 100644
--- a/InCallUI/res/layout/dtmf_twelve_key_dialer_view.xml
+++ b/InCallUI/res/layout/dtmf_twelve_key_dialer_view.xml
@@ -14,9 +14,7 @@
limitations under the License.
-->
-<!-- The grid of buttons used in the onscreen DTMF dialpad;
- see dtmf_twelve_key_dialer_view.xml. -->
-<LinearLayout
+<view class="com.android.incallui.DialpadFragment$DialpadSlidingLinearLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dtmf_twelve_key_dialer_view"
android:layout_width="match_parent"
@@ -24,99 +22,50 @@
android:orientation="vertical"
android:layout_marginTop="1dip" >
- <!-- Display of the digits you've typed so far.
- This widget appears completely non-interactive to the user: you
- can't edit or "hit backspace" since these are DTMF tones you've
- already sent over the network. But it's still an EditText rather
- than a TextView because it needs to receive key events from a
- hard keyboard, if present (see mDialerKeyListener). -->
- <EditText
- android:id="@+id/dtmfDialerField"
+ <View
+ android:id="@+id/dialpad_spacer"
android:layout_width="match_parent"
- android:layout_height="32dp"
- android:layout_marginTop="10dp"
- android:layout_marginBottom="5dp"
- android:layout_marginStart="32dp"
- android:layout_marginEnd="32dp"
- android:paddingEnd="16dp"
- android:paddingStart="16dp"
- android:singleLine="true"
- 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"/>
+ android:layout_height="0dp"
+ android:layout_weight="1"/>
- <TableLayout
- android:id="@+id/dialpad"
+ <view class="com.android.incallui.DialpadFragment$HoverIgnoringLinearLayout"
+ android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="@integer/dialpad_layout_weight_dialpad"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="@dimen/dialpad_vertical_margin"
- android:paddingStart="5dip"
- android:paddingEnd="5dip"
- android:paddingBottom="10dip"
- android:background="@color/dialpad_background"
- android:layoutDirection="ltr">
+ android:layout_height="wrap_content"
+ android:background="@color/background_dialpad">
- <TableRow
- android:layout_height="0px"
- android:layout_weight="1">
- <ImageButton android:id="@+id/one" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_1_no_vm_wht"
- android:contentDescription="@string/description_image_button_one" />
- <ImageButton android:id="@+id/two" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_2_wht"
- android:contentDescription="@string/description_image_button_two" />
- <ImageButton android:id="@+id/three" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_3_wht"
- android:contentDescription="@string/description_image_button_three" />
- </TableRow>
+ <View
+ android:layout_height="@dimen/translucent_shadow_height"
+ android:layout_width="match_parent"
+ android:background="@color/translucent_shadow" />
- <TableRow
- android:layout_height="0px"
- android:layout_weight="1">
- <ImageButton android:id="@+id/four" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_4_wht"
- android:contentDescription="@string/description_image_button_four" />
- <ImageButton android:id="@+id/five" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_5_wht"
- android:contentDescription="@string/description_image_button_five" />
- <ImageButton android:id="@+id/six" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_6_wht"
- android:contentDescription="@string/description_image_button_six" />
- </TableRow>
+ <!-- Display of the digits you've typed so far.
+ This widget appears completely non-interactive to the user: you
+ can't edit or "hit backspace" since these are DTMF tones you've
+ already sent over the network. But it's still an EditText rather
+ than a TextView because it needs to receive key events from a
+ hard keyboard, if present (see mDialerKeyListener). -->
+ <EditText
+ android:id="@+id/dtmfDialerField"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dialpad_digits_height"
+ android:layout_marginTop="10dp"
+ android:layout_marginBottom="5dp"
+ android:layout_marginStart="32dp"
+ android:layout_marginEnd="32dp"
+ android:paddingEnd="16dp"
+ android:paddingStart="16dp"
+ android:singleLine="true"
+ android:scrollHorizontally="true"
+ android:gravity="center"
+ android:freezesText="true"
+ android:background="@color/background_dialpad"
+ android:fontFamily="sans-serif-light"
+ android:textSize="@dimen/dialpad_digits_text_size"
+ android:textColor="@color/dialpad_digits_text_color"
+ android:focusableInTouchMode="false"
+ android:clickable="false"/>
- <TableRow
- android:layout_height="0px"
- android:layout_weight="1">
- <ImageButton android:id="@+id/seven" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_7_wht"
- android:contentDescription="@string/description_image_button_seven" />
- <ImageButton android:id="@+id/eight" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_8_wht"
- android:contentDescription="@string/description_image_button_eight" />
- <ImageButton android:id="@+id/nine" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_9_wht"
- android:contentDescription="@string/description_image_button_nine" />
- </TableRow>
-
- <TableRow
- android:layout_height="0px"
- android:layout_weight="1">
- <ImageButton android:id="@+id/star" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_star_wht"
- android:contentDescription="@string/description_image_button_star" />
- <ImageButton android:id="@+id/zero" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_0_no_plus_wht"
- android:contentDescription="@string/description_image_button_zero" />
- <ImageButton android:id="@+id/pound" style="@style/DialpadButtonStyle"
- android:src="@drawable/dial_num_pound_wht"
- android:contentDescription="@string/description_image_button_pound" />
- </TableRow>
- </TableLayout>
-</LinearLayout>
+ <include layout="@layout/dialpad"/>
+ </view>
+</view>
diff --git a/InCallUI/res/values/colors.xml b/InCallUI/res/values/colors.xml
index baed4a0a2..516563406 100644
--- a/InCallUI/res/values/colors.xml
+++ b/InCallUI/res/values/colors.xml
@@ -23,9 +23,6 @@
<color name="incall_secondary_info_background">#8033b5e5</color> <!-- semitransparent blueish grey -->
<color name="incall_call_banner_text_color">#FFFFFF</color> <!-- white -->
- <!-- DTMF Dialer -->
- <color name="dtmf_dialer_display_text">#FFFFFF</color> <!-- white -->
-
<!-- Color of the theme of the People app -->
<color name="people_app_theme_color">#33B5E5</color>
@@ -44,11 +41,26 @@
<!-- Used when the End Call button is disabled -->
<drawable name="end_call_disabled_state">#303030</drawable>
- <!-- Dialpad background -->
- <color name="dialpad_background">#000000</color>
+ <!-- Color of dialpad digits -->
+ <color name="dialpad_digits_text_color">#000000</color>
+
+ <!-- Background color of dialpad -->
+ <color name="background_dialpad">#ffffff</color>
+
+ <!-- Pressed color of dialpad buttons -->
+ <color name="background_dialpad_pressed">#ececec</color>
<!-- Button background -->
<color name="button_background">#000000</color>
<color name="wifi_connected_background">#8099cc00</color>
+
+ <!-- Background color of action bars -->
+ <color name="actionbar_background_color">#3B77E7</color>
+
+ <!-- Secondary color of dialpad text (used for the letters corresponding to each digit -->
+ <color name="dialpad_secondary_text_color">#8b8b8b</color>
+
+ <!-- Translucent shadow color -->
+ <color name="translucent_shadow">#33999999</color>
</resources>
diff --git a/InCallUI/res/values/dimens.xml b/InCallUI/res/values/dimens.xml
index ebfb93494..9bde442e6 100644
--- a/InCallUI/res/values/dimens.xml
+++ b/InCallUI/res/values/dimens.xml
@@ -71,7 +71,8 @@
<!-- Dimensions for Emergency Dialer and dialpad inside the in-call screen -->
<dimen name="dialpad_horizontal_margin">4dp</dimen>
<dimen name="dialpad_vertical_margin">2dp</dimen>
- <dimen name="dialpad_digits_text_size">35sp</dimen>
+ <dimen name="dialpad_digits_text_size">36sp</dimen>
+ <dimen name="dialpad_digits_height">47dp</dimen>
<!-- Just used in landscape mode -->
<dimen name="emergency_dialer_digits_height">0px</dimen>
@@ -116,4 +117,17 @@
<dimen name="glowpadview_margin_bottom">-48dip</dimen>
<dimen name="glowpadview_margin_right">0dip</dimen>
+ <!-- Text dimensions for dialpad keys -->
+ <dimen name="dialpad_key_numbers_size">40sp</dimen>
+ <dimen name="dialpad_key_letters_size">13sp</dimen>
+ <dimen name="dialpad_key_star_pound_size">26sp</dimen>
+ <dimen name="dialpad_key_numbers_width">30dp</dimen>
+ <dimen name="dialpad_key_letters_width">50dp</dimen>
+ <dimen name="dialpad_key_height">56dp</dimen>
+ <dimen name="dialpad_key_plus_size">18sp</dimen>
+ <dimen name="dialpad_number_to_letters_padding">11dp</dimen>
+ <dimen name="dialpad_horizontal_padding">5dp</dimen>
+
+ <!-- Height of translucent shadow effect -->
+ <dimen name="translucent_shadow_height">2dp</dimen>
</resources>
diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml
index bbcbbe962..622c6e03f 100644
--- a/InCallUI/res/values/strings.xml
+++ b/InCallUI/res/values/strings.xml
@@ -519,4 +519,54 @@
<string name="emergency_call_dialog_number_for_display">Emergency number</string>
<string name="in_call_wifi_connected">Connected via <xliff:g id="wifi_ssid">%s</xliff:g></string>
+
+ <!-- The digit to be displayed on the 0 key of the dialpad [CHAR LIMIT=1]-->
+ <string name="dialpad_0_number">0</string>
+ <!-- The digit to be displayed on the 1 key of the dialpad [CHAR LIMIT=1]-->
+ <string name="dialpad_1_number">1</string>
+ <!-- The digit to be displayed on the 2 key of the dialpad [CHAR LIMIT=1]-->
+ <string name="dialpad_2_number">2</string>
+ <!-- The digit to be displayed on the 3 key of the dialpad [CHAR LIMIT=1]-->
+ <string name="dialpad_3_number">3</string>
+ <!-- The digit to be displayed on the 4 key of the dialpad [CHAR LIMIT=1]-->
+ <string name="dialpad_4_number">4</string>
+ <!-- The digit to be displayed on the 5 key of the dialpad [CHAR LIMIT=1]-->
+ <string name="dialpad_5_number">5</string>
+ <!-- The digit to be displayed on the 6 key of the dialpad [CHAR LIMIT=1]-->
+ <string name="dialpad_6_number">6</string>
+ <!-- The digit to be displayed on the 7 key of the dialpad [CHAR LIMIT=1]-->
+ <string name="dialpad_7_number">7</string>
+ <!-- The digit to be displayed on the 8 key of the dialpad [CHAR LIMIT=1]-->
+ <string name="dialpad_8_number">8</string>
+ <!-- The digit to be displayed on the 9 key of the dialpad [CHAR LIMIT=1]-->
+ <string name="dialpad_9_number">9</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_star_number">*</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_pound_number">#</string>
+
+ <!-- Do not translate. -->
+ <string name="dialpad_0_letters">+</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_1_letters"></string>
+ <!-- Do not translate. -->
+ <string name="dialpad_2_letters">ABC</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_3_letters">DEF</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_4_letters">GHI</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_5_letters">JKL</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_6_letters">MNO</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_7_letters">PQRS</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_8_letters">TUV</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_9_letters">WXYZ</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_star_letters"></string>
+ <!-- Do not translate. -->
+ <string name="dialpad_pound_letters"></string>
</resources>
diff --git a/InCallUI/res/values/styles.xml b/InCallUI/res/values/styles.xml
index 91090b844..1b15d2937 100644
--- a/InCallUI/res/values/styles.xml
+++ b/InCallUI/res/values/styles.xml
@@ -131,21 +131,46 @@
<item name="android:windowAnimationStyle">@style/InCallAnimationStyle</item>
</style>
- <style name="DialpadButtonStyle">
- <item name="android:layout_width">0dip</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:layout_weight">1</item>
- <item name="android:background">?android:attr/selectableItemBackground</item>
+ <style name="DialpadKeyNumberStyle">
+ <item name="android:textColor">@color/actionbar_background_color</item>
+ <item name="android:textSize">@dimen/dialpad_key_numbers_size</item>
+ <item name="android:fontFamily">sans-serif-light</item>
+ <item name="android:layout_width">@dimen/dialpad_key_numbers_width</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:gravity">center</item>
+ </style>
+
+ <style name="DialpadKeyStarPoundStyle">
+ <item name="android:textColor">@color/dialpad_secondary_text_color</item>
+ <item name="android:textSize">@dimen/dialpad_key_star_pound_size</item>
+ <item name="android:fontFamily">sans-serif-light</item>
+ <item name="android:layout_width">@dimen/dialpad_key_numbers_width</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:gravity">center</item>
+ </style>
+
+ <style name="DialpadKeyLettersStyle">
+ <item name="android:textColor">@color/dialpad_secondary_text_color</item>
+ <item name="android:textSize">@dimen/dialpad_key_letters_size</item>
+ <item name="android:fontFamily">sans-serif-light</item>
+ <item name="android:layout_width">@dimen/dialpad_key_letters_width</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:paddingLeft">@dimen/dialpad_number_to_letters_padding</item>
+ </style>
+
+ <style name="DialpadKeyButtonStyle">
<item name="android:soundEffectsEnabled">false</item>
+ <item name="android:clickable">true</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">@dimen/dialpad_key_height</item>
+ <item name="android:background">@drawable/dialpad_key_colors</item>
+ <item name="android:focusable">true</item>
</style>
- <style name="DialtactsDigitsTextAppearance">
- <item name="android:maxLines">1</item>
- <item name="android:textSize">@dimen/dialpad_digits_text_size</item>
- <item name="android:textColor">?android:attr/textColorPrimary</item>
- <item name="android:freezesText">true</item>
- <item name="android:editable">true</item>
- <item name="android:cursorVisible">false</item>
+ <style name="DialpadKeyInternalLayoutStyle">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_gravity">center</item>
</style>
<style name="PrimaryCallInfoPrimaryCallBanner">
diff --git a/InCallUI/src/com/android/incallui/DialpadFragment.java b/InCallUI/src/com/android/incallui/DialpadFragment.java
index 5087561e6..c6ec742af 100644
--- a/InCallUI/src/com/android/incallui/DialpadFragment.java
+++ b/InCallUI/src/com/android/incallui/DialpadFragment.java
@@ -17,16 +17,22 @@
package com.android.incallui;
import android.content.Context;
+import android.content.res.Resources;
import android.os.Bundle;
import android.text.Editable;
import android.text.method.DialerKeyListener;
+import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityManager;
import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.TableRow;
+import android.widget.TextView;
import java.util.HashMap;
@@ -37,6 +43,79 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese
implements DialpadPresenter.DialpadUi, View.OnTouchListener, View.OnKeyListener,
View.OnHoverListener, View.OnClickListener {
+ private static final float DIALPAD_SLIDE_FRACTION = 0.67f;
+
+ /**
+ * LinearLayout with getter and setter methods for the translationY property using floats,
+ * for animation purposes.
+ */
+ public static class DialpadSlidingLinearLayout extends LinearLayout {
+
+ public DialpadSlidingLinearLayout(Context context) {
+ super(context);
+ }
+
+ public DialpadSlidingLinearLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public DialpadSlidingLinearLayout(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ public float getYFraction() {
+ final int height = getHeight();
+ if (height == 0) return 0;
+ return getTranslationY() / height;
+ }
+
+ public void setYFraction(float yFraction) {
+ setTranslationY(yFraction * getHeight());
+ }
+ }
+
+ /**
+ * LinearLayout that always returns true for onHoverEvent callbacks, to fix
+ * problems with accessibility due to the dialpad overlaying other fragments.
+ */
+ public static class HoverIgnoringLinearLayout extends LinearLayout {
+
+ public HoverIgnoringLinearLayout(Context context) {
+ super(context);
+ }
+
+ public HoverIgnoringLinearLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public HoverIgnoringLinearLayout(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ public boolean onHoverEvent(MotionEvent event) {
+ return true;
+ }
+ }
+
+ private class DismissListener implements View.OnClickListener, View.OnLongClickListener {
+
+ @Override
+ public void onClick(View view) {
+ dismiss();
+ }
+
+ @Override
+ public boolean onLongClick(View view) {
+ dismiss();
+ return true;
+ }
+
+ private void dismiss() {
+ ((InCallActivity) getActivity()).getCallButtonFragment().displayDialpad(false);
+ }
+ }
+
private EditText mDtmfDialerField;
/** Hash Map to map a view id to a character*/
@@ -382,6 +461,34 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese
setupKeypad(parent);
}
+
+ final DismissListener dl = new DismissListener();
+ final View spacer = parent.findViewById(R.id.dialpad_spacer);
+ spacer.setOnClickListener(dl);
+ spacer.setOnLongClickListener(dl);
+
+ final ViewTreeObserver vto = parent.getViewTreeObserver();
+ // Adjust the translation of the DialpadFragment in a preDrawListener instead of in
+ // DialtactsActivity, because at the point in time when the DialpadFragment is added,
+ // its views have not been laid out yet.
+ final ViewTreeObserver.OnPreDrawListener
+ preDrawListener = new ViewTreeObserver.OnPreDrawListener() {
+ @Override
+ public boolean onPreDraw() {
+ if (isHidden()) return true;
+ if (parent.getTranslationY() == 0) {
+ ((DialpadSlidingLinearLayout) parent)
+ .setYFraction(DIALPAD_SLIDE_FRACTION);
+ }
+ final ViewTreeObserver vto = parent.getViewTreeObserver();
+ vto.removeOnPreDrawListener(this);
+ return true;
+ }
+
+ };
+
+ vto.addOnPreDrawListener(preDrawListener);
+
return parent;
}
@@ -440,21 +547,43 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese
}
}
- /**
- * setup the keys on the dialer activity, using the keymaps.
- */
- private void setupKeypad(View parent) {
- // for each view id listed in the displaymap
+ private void setupKeypad(View fragmentView) {
+ final int[] buttonIds = new int[] {R.id.zero, R.id.one, R.id.two, R.id.three, R.id.four,
+ R.id.five, R.id.six, R.id.seven, R.id.eight, R.id.nine, R.id.star, R.id.pound};
+
+ final int[] numberIds = new int[] {R.string.dialpad_0_number, R.string.dialpad_1_number,
+ R.string.dialpad_2_number, R.string.dialpad_3_number, R.string.dialpad_4_number,
+ R.string.dialpad_5_number, R.string.dialpad_6_number, R.string.dialpad_7_number,
+ R.string.dialpad_8_number, R.string.dialpad_9_number, R.string.dialpad_star_number,
+ R.string.dialpad_pound_number};
+
+ final int[] letterIds = new int[] {R.string.dialpad_0_letters, R.string.dialpad_1_letters,
+ R.string.dialpad_2_letters, R.string.dialpad_3_letters, R.string.dialpad_4_letters,
+ R.string.dialpad_5_letters, R.string.dialpad_6_letters, R.string.dialpad_7_letters,
+ R.string.dialpad_8_letters, R.string.dialpad_9_letters,
+ R.string.dialpad_star_letters, R.string.dialpad_pound_letters};
+
+ final Resources resources = getResources();
+
View button;
- for (int viewId : mDisplayMap.keySet()) {
- // locate the view
- button = parent.findViewById(viewId);
- // Setup the listeners for the buttons
+ TextView numberView;
+ TextView lettersView;
+
+ for (int i = 0; i < buttonIds.length; i++) {
+ button = fragmentView.findViewById(buttonIds[i]);
button.setOnTouchListener(this);
button.setClickable(true);
button.setOnKeyListener(this);
button.setOnHoverListener(this);
button.setOnClickListener(this);
+ numberView = (TextView) button.findViewById(R.id.dialpad_key_number);
+ lettersView = (TextView) button.findViewById(R.id.dialpad_key_letters);
+ final String numberString = resources.getString(numberIds[i]);
+ numberView.setText(numberString);
+ button.setContentDescription(numberString);
+ if (lettersView != null) {
+ lettersView.setText(resources.getString(letterIds[i]));
+ }
}
}
}
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 9c408a6f8..5a11b1885 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -21,6 +21,7 @@ import com.android.services.telephony.common.Call.State;
import android.app.Activity;
import android.app.AlertDialog;
+import android.app.FragmentTransaction;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnCancelListener;
@@ -308,6 +309,10 @@ public class InCallActivity extends Activity {
InCallPresenter.getInstance().getProximitySensor().onConfigurationChanged(config);
}
+ public CallButtonFragment getCallButtonFragment() {
+ return mCallButtonFragment;
+ }
+
private void internalResolveIntent(Intent intent) {
final String action = intent.getAction();
@@ -365,7 +370,7 @@ public class InCallActivity extends Activity {
if (mDialpadFragment == null) {
mDialpadFragment = (DialpadFragment) getFragmentManager()
.findFragmentById(R.id.dialpadFragment);
- mDialpadFragment.getView().setVisibility(View.INVISIBLE);
+ getFragmentManager().beginTransaction().hide(mDialpadFragment).commit();
}
if (mConferenceManagerFragment == null) {
@@ -398,13 +403,15 @@ public class InCallActivity extends Activity {
}
public void displayDialpad(boolean showDialpad) {
+ final FragmentTransaction ft = getFragmentManager().beginTransaction();
if (showDialpad) {
- mDialpadFragment.setVisible(true);
- mCallCardFragment.setVisible(false);
+ ft.setCustomAnimations(R.anim.slide_in, 0);
+ ft.show(mDialpadFragment);
} else {
- mDialpadFragment.setVisible(false);
- mCallCardFragment.setVisible(true);
+ ft.setCustomAnimations(0, R.anim.slide_out);
+ ft.hide(mDialpadFragment);
}
+ ft.commit();
InCallPresenter.getInstance().getProximitySensor().onDialpadVisible(showDialpad);
}
diff --git a/InCallUI/src/com/android/incallui/NeededForReflection.java b/InCallUI/src/com/android/incallui/NeededForReflection.java
new file mode 100644
index 000000000..363a0a548
--- /dev/null
+++ b/InCallUI/src/com/android/incallui/NeededForReflection.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2014 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.incallui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Denotes that the class, constructor, method or field is used for reflection and therefore cannot
+ * be removed by tools like ProGuard.
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target({ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD})
+public @interface NeededForReflection {}