summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/res/layout/call_button_fragment.xml4
-rw-r--r--InCallUI/res/layout/dialpad_incall.xml79
-rw-r--r--InCallUI/res/layout/dialpad_key_incall.xml34
-rw-r--r--InCallUI/res/layout/dtmf_twelve_key_dialer_view.xml134
-rw-r--r--InCallUI/res/values/dimens.xml19
-rw-r--r--InCallUI/res/values/styles.xml53
-rw-r--r--InCallUI/src/com/android/incallui/DialpadFragment.java81
7 files changed, 293 insertions, 111 deletions
diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml
index 013d1b22a..a182fc127 100644
--- a/InCallUI/res/layout/call_button_fragment.xml
+++ b/InCallUI/res/layout/call_button_fragment.xml
@@ -33,6 +33,9 @@
android:id="@+id/bottomButtons"
android:orientation="vertical"
android:layout_width="match_parent"
+ android:background="#0000ff"
+ android:layout_margin="0dp"
+ android:padding="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="invisible">
@@ -51,7 +54,6 @@
<ImageButton android:id="@+id/endButton"
style="@style/InCallEndButton"
android:layout_width="match_parent"
- android:layout_marginTop="2dp"
android:src="@drawable/ic_in_call_phone_hangup"
android:background="@drawable/end_call_background"
android:contentDescription="@string/onscreenEndCallText"/>
diff --git a/InCallUI/res/layout/dialpad_incall.xml b/InCallUI/res/layout/dialpad_incall.xml
new file mode 100644
index 000000000..d9473c1c6
--- /dev/null
+++ b/InCallUI/res/layout/dialpad_incall.xml
@@ -0,0 +1,79 @@
+<?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="0dp"
+ android:layout_weight="4"
+ 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 style="@style/InCallDialpadTableRowStyle">
+ <include layout="@layout/dialpad_key_incall" android:id="@+id/one"/>
+ <include layout="@layout/dialpad_key_incall" android:id="@+id/two"/>
+ <include layout="@layout/dialpad_key_incall" android:id="@+id/three"/>
+ </TableRow>
+
+ <TableRow style="@style/InCallDialpadTableRowStyle">
+ <include layout="@layout/dialpad_key_incall" android:id="@+id/four"/>
+ <include layout="@layout/dialpad_key_incall" android:id="@+id/five"/>
+ <include layout="@layout/dialpad_key_incall" android:id="@+id/six"/>
+ </TableRow>
+
+ <TableRow style="@style/InCallDialpadTableRowStyle">
+ <include layout="@layout/dialpad_key_incall" android:id="@+id/seven"/>
+ <include layout="@layout/dialpad_key_incall" android:id="@+id/eight"/>
+ <include layout="@layout/dialpad_key_incall" android:id="@+id/nine"/>
+ </TableRow>
+
+ <TableRow style="@style/InCallDialpadTableRowStyle">
+ <com.android.dialer.dialpad.DialpadKeyButton
+ android:id="@+id/star"
+ style="@style/InCallDialpadKeyButtonStyle">
+ <LinearLayout
+ style="@style/InCallDialpadKeyInternalLayoutStyle">
+ <TextView
+ android:id="@+id/dialpad_key_number"
+ style="@style/InCallDialpadKeyStarPoundStyle"
+ android:textSize="@dimen/dialpad_key_star_size" />
+ <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_incall" android:id="@+id/zero"/>
+ <com.android.dialer.dialpad.DialpadKeyButton
+ android:id="@+id/pound"
+ style="@style/InCallDialpadKeyButtonStyle">
+ <LinearLayout
+ style="@style/InCallDialpadKeyInternalLayoutStyle">
+ <TextView
+ android:id="@+id/dialpad_key_number"
+ style="@style/InCallDialpadKeyStarPoundStyle"
+ android:textSize="@dimen/dialpad_key_pound_size" />
+ <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_incall.xml b/InCallUI/res/layout/dialpad_key_incall.xml
new file mode 100644
index 000000000..8ce4b5135
--- /dev/null
+++ b/InCallUI/res/layout/dialpad_key_incall.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/InCallDialpadKeyButtonStyle">
+
+ <LinearLayout style="@style/InCallDialpadKeyInternalLayoutStyle">
+
+ <!-- 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/InCallDialpadKeyNumberStyle" />
+
+ <TextView
+ android:id="@+id/dialpad_key_letters"
+ style="@style/InCallDialpadKeyLettersStyle" />
+ </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..d921ca34a 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,41 @@
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"
- 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"/>
-
- <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">
-
- <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>
-
- <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>
-
- <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>
+ android:background="@color/background_dialpad">
+
+
+ <!-- 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="0dp"
+ android:layout_weight="1"
+ 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"/>
+
+ <include layout="@layout/dialpad_incall"/>
+ </view>
+</view>
diff --git a/InCallUI/res/values/dimens.xml b/InCallUI/res/values/dimens.xml
index ebfb93494..92e55d60c 100644
--- a/InCallUI/res/values/dimens.xml
+++ b/InCallUI/res/values/dimens.xml
@@ -45,7 +45,7 @@
<dimen name="in_call_button_height">76dp</dimen>
<!-- Height of the in-call "End" button. Match with Contact's dimens/call_button_height -->
- <dimen name="in_call_end_button_height">74dp</dimen>
+ <dimen name="in_call_end_button_height">60dp</dimen>
<!-- Width of buttons in the extra button row. -->
<dimen name="extra_row_button_width">56dp</dimen>
@@ -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,18 @@
<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_size">26sp</dimen>
+ <dimen name="dialpad_key_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/styles.xml b/InCallUI/res/values/styles.xml
index 91090b844..3fb2bb28a 100644
--- a/InCallUI/res/values/styles.xml
+++ b/InCallUI/res/values/styles.xml
@@ -131,21 +131,52 @@
<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>
+ <style name="InCallDialpadTableRowStyle">
+ <item name="android:layout_height">0dp</item>
<item name="android:layout_weight">1</item>
- <item name="android:background">?android:attr/selectableItemBackground</item>
+ <item name="android:layout_width">match_parent</item>
+ </style>
+
+ <style name="InCallDialpadKeyNumberStyle">
+ <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="InCallDialpadKeyStarPoundStyle">
+ <item name="android:textColor">@color/dialpad_secondary_text_color</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="InCallDialpadKeyLettersStyle">
+ <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="InCallDialpadKeyButtonStyle">
<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="InCallDialpadKeyInternalLayoutStyle">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_gravity">center</item>
+ <item name="android: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 31e75b033..ed45217a4 100644
--- a/InCallUI/src/com/android/incallui/DialpadFragment.java
+++ b/InCallUI/src/com/android/incallui/DialpadFragment.java
@@ -20,13 +20,16 @@ import android.content.Context;
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 java.util.HashMap;
@@ -37,6 +40,61 @@ 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 EditText mDtmfDialerField;
/** Hash Map to map a view id to a character*/
@@ -381,6 +439,29 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese
setupKeypad(parent);
}
+
+ 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;
}