diff options
-rw-r--r-- | InCallUI/res/layout/dialpad_incall.xml | 79 | ||||
-rw-r--r-- | InCallUI/res/layout/dialpad_key_incall.xml | 34 | ||||
-rw-r--r-- | InCallUI/res/layout/dtmf_twelve_key_dialer_view.xml | 35 | ||||
-rw-r--r-- | InCallUI/res/values/colors.xml | 2 | ||||
-rw-r--r-- | InCallUI/res/values/dimens.xml | 33 | ||||
-rw-r--r-- | InCallUI/res/values/styles.xml | 49 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/DialpadFragment.java | 58 |
7 files changed, 23 insertions, 267 deletions
diff --git a/InCallUI/res/layout/dialpad_incall.xml b/InCallUI/res/layout/dialpad_incall.xml deleted file mode 100644 index 96240004a..000000000 --- a/InCallUI/res/layout/dialpad_incall.xml +++ /dev/null @@ -1,79 +0,0 @@ -<?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:paddingBottom="@dimen/dialpad_bottom_padding" - android:paddingLeft="@dimen/dialpad_horizontal_padding" - android:paddingRight="@dimen/dialpad_horizontal_padding" - 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.contacts.common.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.contacts.common.dialpad.DialpadKeyButton> - <include layout="@layout/dialpad_key_incall" android:id="@+id/zero"/> - <com.android.contacts.common.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.contacts.common.dialpad.DialpadKeyButton> - </TableRow> -</TableLayout> diff --git a/InCallUI/res/layout/dialpad_key_incall.xml b/InCallUI/res/layout/dialpad_key_incall.xml deleted file mode 100644 index 8ce4b5135..000000000 --- a/InCallUI/res/layout/dialpad_key_incall.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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 fb3b66e99..cd9977eeb 100644 --- a/InCallUI/res/layout/dtmf_twelve_key_dialer_view.xml +++ b/InCallUI/res/layout/dtmf_twelve_key_dialer_view.xml @@ -20,43 +20,12 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - android:layout_marginTop="1dip" - android:background="@color/incall_dialpad_background" > + android:layout_marginTop="1dip" > <view class="com.android.incallui.DialpadFragment$HoverIgnoringLinearLayout" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" > - - <!-- 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). --> - <!-- Edit text background is fully transparent to get rid of its underline. --> - <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:background="@null" - android:paddingEnd="12dp" - android:paddingStart="12dp" - android:singleLine="true" - android:scrollHorizontally="true" - android:gravity="center" - android:freezesText="true" - 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"/> + <include layout="@layout/dialpad_view"/> </view> </view> diff --git a/InCallUI/res/values/colors.xml b/InCallUI/res/values/colors.xml index fd60bbb66..bd8832766 100644 --- a/InCallUI/res/values/colors.xml +++ b/InCallUI/res/values/colors.xml @@ -51,7 +51,7 @@ <color name="dialpad_digits_text_color">#000000</color> <color name="incall_dialpad_background">#ccffffff</color> - <color name="incall_dialpad_background_pressed">#33ffffff</color> + <color name="incall_dialpad_background_pressed">#ccaaaaaa</color> <!-- Button background color. --> <color name="button_background_color">@color/incall_background_color</color> diff --git a/InCallUI/res/values/dimens.xml b/InCallUI/res/values/dimens.xml index ae5f5a1dd..5152ea990 100644 --- a/InCallUI/res/values/dimens.xml +++ b/InCallUI/res/values/dimens.xml @@ -72,26 +72,6 @@ <dimen name="otalistenprogress_layout_marginTop">5dp</dimen> <dimen name="otasuccessfail_layout_marginTop">10dp</dimen> - - <!-- 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">36sp</dimen> - <dimen name="dialpad_digits_height">47dp</dimen> - - <!-- Just used in landscape mode --> - <dimen name="emergency_dialer_digits_height">0px</dimen> - <dimen name="dialpad_center_margin">3dp</dimen> - <dimen name="dialpad_button_margin">3dp</dimen> - - - <!-- Layout weight values for dialpad screen. These layouts will be used in one - LinearLayout (dialpad_fragment.xml), configuring dialpad screen's vertical - ratio. --> - <integer name="dialpad_layout_weight_digits">20</integer> - <integer name="dialpad_layout_weight_dialpad">65</integer> - <integer name="dialpad_layout_weight_additional_buttons">15</integer> - <!-- Dimension used to possibly down-scale high-res photo into what is suitable for notification's large icon. --> <dimen name="notification_icon_size">64dp</dimen> @@ -122,19 +102,6 @@ <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_bottom_padding">90dp</dimen> - <dimen name="dialpad_horizontal_padding">5dp</dimen> - <!-- Height of translucent shadow effect --> <dimen name="translucent_shadow_height">2dp</dimen> diff --git a/InCallUI/res/values/styles.xml b/InCallUI/res/values/styles.xml index b0f25ec51..13ba65e49 100644 --- a/InCallUI/res/values/styles.xml +++ b/InCallUI/res/values/styles.xml @@ -124,57 +124,10 @@ <item name="android:windowAnimationStyle">@style/InCallAnimationStyle</item> </style> - <style name="InCallDialpadTableRowStyle"> - <item name="android:layout_height">0dp</item> - <item name="android:layout_weight">1</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/incall_dialpad_key_colors</item> - <item name="android:focusable">true</item> - </style> - - <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"> <item name="android:layout_alignParentTop">true</item> </style> + <style name="SecondaryCallInfoSecondaryCallName"> <item name="android:layout_gravity">top|left</item> </style> diff --git a/InCallUI/src/com/android/incallui/DialpadFragment.java b/InCallUI/src/com/android/incallui/DialpadFragment.java index 236b38c9c..d22b9030c 100644 --- a/InCallUI/src/com/android/incallui/DialpadFragment.java +++ b/InCallUI/src/com/android/incallui/DialpadFragment.java @@ -17,7 +17,6 @@ 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; @@ -31,9 +30,11 @@ 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 com.android.contacts.common.dialpad.DialpadKeyButton; +import com.android.contacts.common.dialpad.DialpadView; + import java.util.HashMap; /** @@ -124,6 +125,8 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese // KeyListener used with the "dialpad digits" EditText widget. private DTMFKeyListener mDialerKeyListener; + private DialpadView mDialpadView; + /** * Our own key listener, specialized for dealing with DTMF codes. * 1. Ignore the backspace since it is irrelevant. @@ -432,15 +435,18 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese Bundle savedInstanceState) { final View parent = inflater.inflate( com.android.incallui.R.layout.dtmf_twelve_key_dialer_view, container, false); - mDtmfDialerField = (EditText) parent.findViewById(R.id.dtmfDialerField); + mDialpadView = (DialpadView) parent.findViewById(R.id.dialpad_view); + mDialpadView.setCanDigitsBeEdited(false); + mDialpadView.setBackgroundResource(R.color.incall_dialpad_background); + mDtmfDialerField = (EditText) parent.findViewById(R.id.digits); if (mDtmfDialerField != null) { mDialerKeyListener = new DTMFKeyListener(); mDtmfDialerField.setKeyListener(mDialerKeyListener); // remove the long-press context menus that support // the edit (copy / paste / select) functions. mDtmfDialerField.setLongClickable(false); - - setupKeypad(parent); + mDtmfDialerField.setElegantTextHeight(false); + configureKeypadListeners(mDialpadView); } final ViewTreeObserver vto = parent.getViewTreeObserver(); @@ -523,43 +529,17 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese } } - private void setupKeypad(View fragmentView) { + private void configureKeypadListeners(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; - TextView numberView; - TextView lettersView; - + DialpadKeyButton dialpadKey; 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])); - } + dialpadKey = (DialpadKeyButton) fragmentView.findViewById(buttonIds[i]); + dialpadKey.setBackgroundResource(R.drawable.incall_dialpad_key_colors); + dialpadKey.setOnTouchListener(this); + dialpadKey.setOnKeyListener(this); + dialpadKey.setOnHoverListener(this); + dialpadKey.setOnClickListener(this); } } } |