diff options
author | Yorke Lee <yorkelee@google.com> | 2013-08-08 16:09:47 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-08-08 16:09:47 -0700 |
commit | cfcc9cf838964c2563bff182204733f8fe7772ee (patch) | |
tree | d7995697e59e81cdb8264d007aa82b1039c0490f | |
parent | 4ffa6da530089895c915cc82ec17e96e2f41e672 (diff) | |
parent | 8898cd0577d41cfa4e6acf785c9e904bd71fbdfd (diff) |
am 8898cd05: Removing and renaming classes from Dialer
* commit '8898cd0577d41cfa4e6acf785c9e904bd71fbdfd':
Removing and renaming classes from Dialer
26 files changed, 354 insertions, 1390 deletions
diff --git a/res/layout-land/dialpad_fragment.xml b/res/layout-land/dialpad_fragment.xml index 658a03b7b..b3945f61e 100644 --- a/res/layout-land/dialpad_fragment.xml +++ b/res/layout-land/dialpad_fragment.xml @@ -84,9 +84,9 @@ <View android:layout_width="match_parent" android:layout_height="@dimen/dialpad_button_margin" - android:layout_above="@id/dialButton" + android:layout_above="@+id/dialButton" android:background="#33000000" /> - <ImageButton android:id="@+id/dialButton" + <ImageButton android:id="@id/dialButton" android:layout_width="match_parent" android:layout_height="@dimen/call_button_height" android:layout_alignParentBottom="true" diff --git a/res/layout/dialpad.xml b/res/layout/dialpad.xml index f9a078543..60240bc3f 100644 --- a/res/layout/dialpad.xml +++ b/res/layout/dialpad.xml @@ -26,74 +26,86 @@ android:paddingStart="5dip" android:paddingEnd="5dip" android:paddingBottom="10dip" - android:background="@drawable/dialpad_background" + android:stretchColumns="0,1,2" android:layoutDirection="ltr" > <TableRow - android:layout_height="0px" - android:layout_weight="1"> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/one" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_1_wht" - android:contentDescription="@string/description_image_button_one" /> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/two" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_2_wht" - android:contentDescription="@string/description_image_button_two" /> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/three" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_3_wht" - android:contentDescription="@string/description_image_button_three" /> + android:layout_height="0px" + android:layout_weight="1"> + <com.android.dialer.dialpad.DialpadKeyButton + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/one" + style="@style/DialtactsDialpadButtonStyle" + android:clickable="true" > + <TextView + android:id="@+id/dialpad_key_number" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@color/dialpad_primary_text_color" + android:textSize="@dimen/dialpad_key_numbers_size" + android:fontFamily="sans-serif-light" + android:layout_centerInParent="true" /> + <ImageView + android:id="@+id/dialpad_key_voicemail" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_dial_action_vm" + android:paddingRight="11dp" + android:layout_alignBaseline="@id/dialpad_key_number" + android:baselineAlignBottom="true" + android:layout_alignParentRight="true" /> + </com.android.dialer.dialpad.DialpadKeyButton> + <include layout="@layout/dialpad_key" android:id="@+id/two"/> + <include layout="@layout/dialpad_key" android:id="@+id/three"/> </TableRow> <TableRow - android:layout_height="0px" - android:layout_weight="1"> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/four" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_4_wht" - android:contentDescription="@string/description_image_button_four" /> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/five" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_5_wht" - android:contentDescription="@string/description_image_button_five" /> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/six" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_6_wht" - android:contentDescription="@string/description_image_button_six" /> + android:layout_height="0px" + android:layout_weight="1"> + <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 - android:layout_height="0px" - android:layout_weight="1"> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/seven" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_7_wht" - android:contentDescription="@string/description_image_button_seven" /> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/eight" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_8_wht" - android:contentDescription="@string/description_image_button_eight" /> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/nine" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_9_wht" - android:contentDescription="@string/description_image_button_nine" /> + android:layout_height="0px" + android:layout_weight="1"> + <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 - android:layout_height="0px" - android:layout_weight="1"> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/star" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_star_wht" - android:contentDescription="@string/description_image_button_star" /> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/zero" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_0_wht" - android:contentDescription="@string/description_image_button_zero" /> - <com.android.dialer.dialpad.DialpadImageButton - android:id="@+id/pound" style="@style/DialtactsDialpadButtonStyle" - android:src="@drawable/dial_num_pound_wht" - android:contentDescription="@string/description_image_button_pound" /> + android:layout_height="0px" + android:layout_weight="1"> + <com.android.dialer.dialpad.DialpadKeyButton + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/star" + style="@style/DialtactsDialpadButtonStyle" + android:clickable="true" > + <TextView + android:id="@id/dialpad_key_number" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@color/dialpad_secondary_text_color" + android:textSize="@dimen/dialpad_key_special_characters_size" + android:fontFamily="sans-serif-light" + android:layout_centerInParent="true" /> + </com.android.dialer.dialpad.DialpadKeyButton> + <include layout="@layout/dialpad_key" android:id="@+id/zero"/> + <com.android.dialer.dialpad.DialpadKeyButton + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/pound" + style="@style/DialtactsDialpadButtonStyle" + android:clickable="true" > + <TextView + android:id="@id/dialpad_key_number" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@color/dialpad_secondary_text_color" + android:textSize="@dimen/dialpad_key_special_characters_size" + android:fontFamily="sans-serif-light" + android:layout_centerInParent="true" /> + </com.android.dialer.dialpad.DialpadKeyButton> </TableRow> </TableLayout> diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml index f3bd2a213..178e33b8e 100644 --- a/res/layout/dialpad_fragment.xml +++ b/res/layout/dialpad_fragment.xml @@ -13,108 +13,110 @@ See the License for the specific language governing permissions and limitations under the License. --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/top" +<view class="com.android.dialer.dialpad.DialpadFragment$DialpadSlidingLinearLayout" + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" - android:paddingStart="@dimen/dialpad_horizontal_margin" - android:paddingEnd="@dimen/dialpad_horizontal_margin" - android:layoutDirection="ltr" > - - <!-- Text field and possibly soft menu button above the keypad where - the digits are displayed. --> + android:orientation="vertical" > + <!-- spacer view --> + <Space + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" /> <LinearLayout - android:id="@+id/digits_container" + android:id="@+id/top" android:layout_width="match_parent" - android:layout_height="0px" - android:layout_weight="@integer/dialpad_layout_weight_digits" - android:layout_marginTop="@dimen/dialpad_vertical_margin" - android:gravity="center" - android:background="@drawable/dialpad_background" > - - <com.android.dialer.dialpad.DigitsEditText - android:id="@+id/digits" - android:layout_width="0dip" - android:layout_weight="1" - android:layout_height="match_parent" - android:gravity="center" - android:textAppearance="@style/DialtactsDigitsTextAppearance" - android:textColor="?android:attr/textColorPrimary" - android:nextFocusRight="@+id/overflow_menu" - android:background="@android:color/transparent" /> + android:layout_height="0dp" + android:layout_weight="2" + android:orientation="vertical" + android:paddingStart="@dimen/dialpad_horizontal_margin" + android:paddingEnd="@dimen/dialpad_horizontal_margin" + android:layoutDirection="ltr" + android:background="@color/background_dialpad" > - <ImageButton - android:id="@+id/deleteButton" - android:layout_width="56dip" - android:layout_height="match_parent" - android:layout_gravity="center_vertical" - android:gravity="center" - android:state_enabled="false" - android:background="?android:attr/selectableItemBackground" - android:contentDescription="@string/description_delete_button" - android:src="@drawable/ic_dial_action_delete" /> - </LinearLayout> - <!-- Smart dial suggestion section. - sp is used here for this layout instead of dp in order for it to resize as - appropriate when the font size increases. This is a one-time exception that is - ok in this case because there is space for the suggestion strip to expand. --> - <RelativeLayout - android:id="@+id/dialpad_smartdial_container" - android:layout_width="match_parent" - android:layout_height="50sp" - android:layout_marginTop="@dimen/dialpad_vertical_margin"> - <View - android:id="@+id/dialpad_smartdial_list_background" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@drawable/dialpad_background"> - </View> + <!-- Text field and possibly soft menu button above the keypad where + the digits are displayed. --> <LinearLayout - android:id="@+id/dialpad_smartdial_list" + android:id="@+id/digits_container" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal" - android:gravity="center"> - </LinearLayout> - </RelativeLayout> + android:layout_height="0px" + android:layout_weight="@integer/dialpad_layout_weight_digits_new" + android:layout_marginTop="@dimen/dialpad_vertical_margin" + android:gravity="center" > - <!-- Keypad section --> - <include layout="@layout/dialpad" /> + <com.android.dialer.dialpad.DigitsEditText + android:id="@+id/digits" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="match_parent" + android:gravity="center" + android:textAppearance="@style/DialtactsDigitsTextAppearance" + android:textColor="@color/dialpad_text_color" + android:nextFocusRight="@+id/overflow_menu" + android:background="@android:color/transparent" /> - <View style="@style/DialpadHorizontalSeparator"/> + <ImageButton + android:id="@+id/deleteButton" + android:layout_width="56dip" + android:layout_height="match_parent" + android:layout_gravity="center_vertical" + android:gravity="center" + android:state_enabled="false" + android:background="?android:attr/selectableItemBackground" + android:contentDescription="@string/description_delete_button" + android:src="@drawable/ic_dial_action_delete" /> + </LinearLayout> - <!-- left and right paddings will be modified by the code. See DialpadFragment. --> - <FrameLayout - android:id="@+id/dialButtonContainer" - android:layout_width="match_parent" - android:layout_height="0px" - android:layout_weight="@integer/dialpad_layout_weight_additional_buttons" - android:layout_gravity="center_horizontal" - android:background="@drawable/dialpad_background"> + <!-- Keypad section --> + <include layout="@layout/dialpad" /> - <ImageButton - android:id="@+id/dialButton" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="center" - android:state_enabled="false" - android:background="@drawable/btn_call" - android:contentDescription="@string/description_dial_button" - android:src="@drawable/ic_dial_action_call" /> + <View style="@style/DialpadHorizontalSeparator"/> - </FrameLayout> + <LinearLayout + android:id="@+id/dialButtonContainer" + android:layout_width="match_parent" + android:layout_height="0px" + android:layout_weight="@integer/dialpad_layout_weight_additional_buttons" + android:layout_gravity="center_horizontal" + android:background="@color/dialpad_primary_text_color"> + <ImageButton + android:id="@+id/call_history_on_dialpad_button" + android:layout_height="@dimen/fake_action_bar_height" + android:layout_width="@dimen/fake_menu_button_min_width" + android:layout_gravity="bottom|start" + android:background="@drawable/btn_call" + android:contentDescription="@string/action_menu_call_history_description" + android:src="@drawable/ic_menu_history_lt"/> + <ImageButton + android:id="@+id/dialButton" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="match_parent" + android:layout_gravity="center" + android:state_enabled="false" + android:background="@drawable/btn_call" + android:contentDescription="@string/description_dial_button" + android:src="@drawable/ic_dial_action_call" /> + <ImageButton + android:id="@+id/overflow_menu_on_dialpad" + android:layout_height="@dimen/fake_action_bar_height" + android:layout_width="@dimen/fake_menu_button_min_width" + android:layout_gravity="bottom|end" + android:background="@drawable/btn_call" + android:src="@drawable/ic_menu_overflow_lt" + android:contentDescription="@string/action_menu_overflow_description" /> + </LinearLayout> - <!-- "Dialpad chooser" UI, shown only when the user brings up the - Dialer while a call is already in progress. - When this UI is visible, the other Dialer elements - (the textfield/button and the dialpad) are hidden. --> - <ListView android:id="@+id/dialpadChooser" - android:layout_width="match_parent" - android:layout_height="1dip" - android:layout_weight="1" - /> + <!-- "Dialpad chooser" UI, shown only when the user brings up the + Dialer while a call is already in progress. + When this UI is visible, the other Dialer elements + (the textfield/button and the dialpad) are hidden. --> + <ListView android:id="@+id/dialpadChooser" + android:layout_width="match_parent" + android:layout_height="1dip" + android:layout_weight="1" + /> -</LinearLayout> + </LinearLayout> +</view> diff --git a/res/layout/dialpad_smartdial_item.xml b/res/layout/dialpad_smartdial_item.xml deleted file mode 100644 index 32d801e80..000000000 --- a/res/layout/dialpad_smartdial_item.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2012 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. ---> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="0dp" - android:layout_weight="1" - android:layout_height="match_parent" - android:layout_marginTop="2dp" - android:layout_marginBottom="2dp" - android:background="?android:attr/selectableItemBackground"> - - <com.android.dialer.dialpad.SmartDialTextView - android:id="@+id/contact_name" - android:layout_width="match_parent" - android:layout_height="28sp" - android:padding="@dimen/smartdial_suggestions_padding" - android:textColor="@color/smartdial_name_primary_text_color" - android:textSize="16sp" - android:singleLine="true" - android:ellipsize="none" - android:gravity="center" - /> - <com.android.dialer.dialpad.SmartDialTextView - android:id="@+id/contact_number" - android:layout_width="match_parent" - android:layout_height="16sp" - android:textColor="@color/smartdial_number_primary_text_color" - android:textSize="13sp" - android:gravity="center" - /> -</LinearLayout> diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml index 079ce37d1..580e0bf43 100644 --- a/res/layout/dialtacts_activity.xml +++ b/res/layout/dialtacts_activity.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2006 The Android Open Source Project +<!-- Copyright (C) 2013 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. @@ -13,35 +13,66 @@ See the License for the specific language governing permissions and limitations under the License. --> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginTop="?android:attr/actionBarSize" - android:id="@+id/dialtacts_frame" + android:focusable="true" + android:focusableInTouchMode="true" + android:clipChildren="false" + android:id="@+id/dialtacts_container" > - <android.support.v4.view.ViewPager - android:id="@+id/pager" + <!-- Overlapping dialpad fragment is inserted here --> + <LinearLayout android:layout_width="match_parent" - android:layout_height="match_parent" /> - - <ImageButton - android:id="@+id/searchButton" - android:layout_width="wrap_content" - android:layout_height="?android:attr/actionBarSize" - android:layout_gravity="bottom|start" - android:state_enabled="false" - android:background="?android:attr/selectableItemBackground" - android:contentDescription="@string/description_search_button" - android:src="@drawable/ic_dial_action_search"/> - - <ImageButton - android:id="@+id/overflow_menu" - android:layout_width="wrap_content" - android:layout_height="?android:attr/actionBarSize" - android:layout_gravity="bottom|end" - android:src="@drawable/ic_menu_overflow" - android:contentDescription="@string/action_menu_overflow_description" - android:nextFocusLeft="@id/digits" - android:background="?android:attr/selectableItemBackground"/> + android:layout_height="match_parent" + android:clipChildren="false" + android:orientation="vertical" > + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="23dp" + android:id="@+id/search_view_container" + android:background="@color/searchbox_background_color" + android:orientation="horizontal" + android:gravity="center_vertical"> + <EditText + android:id="@+id/search_view" + android:layout_width="0dp" + android:layout_height="56dp" + android:layout_weight="1" + android:inputType="textFilter"/> + <ImageView + android:id="@+id/search_close_button" + android:layout_height="40dp" + android:layout_width="40dp" + android:padding="6dp" + android:src="@drawable/ic_close_dk" + android:clickable="true" + android:background="?android:attr/selectableItemBackground" + android:visibility="gone" /> + <ImageView + android:id="@+id/voice_search_button" + android:layout_height="40dp" + android:layout_width="40dp" + android:padding="6dp" + android:src="@drawable/ic_voice_search" + android:clickable="true" + android:contentDescription="@string/description_start_voice_search" + android:background="?android:attr/selectableItemBackground" /> + </LinearLayout> + <FrameLayout + android:layout_height="0dp" + android:layout_weight="1" + android:layout_width="match_parent" + android:id="@+id/dialtacts_frame" + android:clipChildren="false"> + </FrameLayout> + <View + android:id="@+id/dialtacts_bottom_padding" + android:layout_width="match_parent" + android:layout_height="?android:attr/actionBarSize" + android:visibility="gone" /> + </LinearLayout> </FrameLayout> diff --git a/res/layout/dialtacts_custom_action_bar.xml b/res/layout/dialtacts_custom_action_bar.xml deleted file mode 100644 index c62e22596..000000000 --- a/res/layout/dialtacts_custom_action_bar.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?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. ---> - -<!-- Dimensions are set at runtime in ActionBarAdapter --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="0dip" - android:layout_height="0dip" - android:orientation="horizontal"> - - <SearchView - android:id="@+id/search_view" - android:layout_width="0px" - android:layout_height="match_parent" - android:layout_weight="1" - android:iconifiedByDefault="false" - android:inputType="textFilter" /> - - <ImageButton - android:id="@+id/search_option" - android:layout_width="wrap_content" - android:paddingStart="4dip" - android:paddingEnd="4dip" - android:layout_height="match_parent" - android:layout_alignParentEnd="true" - android:contentDescription="@string/action_menu_overflow_description" - android:importantForAccessibility="yes" - android:src="@drawable/ic_menu_overflow" - android:background="?android:attr/selectableItemBackground" - android:visibility="gone" /> - -</LinearLayout> diff --git a/res/layout/new_dialpad.xml b/res/layout/new_dialpad.xml deleted file mode 100644 index 60240bc3f..000000000 --- a/res/layout/new_dialpad.xml +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2006 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. --> -<TableLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/dialpad" - android:layout_width="match_parent" - android:layout_height="0px" - 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:stretchColumns="0,1,2" - android:layoutDirection="ltr" > - - <TableRow - android:layout_height="0px" - android:layout_weight="1"> - <com.android.dialer.dialpad.DialpadKeyButton - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/one" - style="@style/DialtactsDialpadButtonStyle" - android:clickable="true" > - <TextView - android:id="@+id/dialpad_key_number" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/dialpad_primary_text_color" - android:textSize="@dimen/dialpad_key_numbers_size" - android:fontFamily="sans-serif-light" - android:layout_centerInParent="true" /> - <ImageView - android:id="@+id/dialpad_key_voicemail" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_dial_action_vm" - android:paddingRight="11dp" - android:layout_alignBaseline="@id/dialpad_key_number" - android:baselineAlignBottom="true" - android:layout_alignParentRight="true" /> - </com.android.dialer.dialpad.DialpadKeyButton> - <include layout="@layout/dialpad_key" android:id="@+id/two"/> - <include layout="@layout/dialpad_key" android:id="@+id/three"/> - </TableRow> - - <TableRow - android:layout_height="0px" - android:layout_weight="1"> - <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 - android:layout_height="0px" - android:layout_weight="1"> - <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 - android:layout_height="0px" - android:layout_weight="1"> - <com.android.dialer.dialpad.DialpadKeyButton - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/star" - style="@style/DialtactsDialpadButtonStyle" - android:clickable="true" > - <TextView - android:id="@id/dialpad_key_number" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/dialpad_secondary_text_color" - android:textSize="@dimen/dialpad_key_special_characters_size" - android:fontFamily="sans-serif-light" - android:layout_centerInParent="true" /> - </com.android.dialer.dialpad.DialpadKeyButton> - <include layout="@layout/dialpad_key" android:id="@+id/zero"/> - <com.android.dialer.dialpad.DialpadKeyButton - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/pound" - style="@style/DialtactsDialpadButtonStyle" - android:clickable="true" > - <TextView - android:id="@id/dialpad_key_number" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/dialpad_secondary_text_color" - android:textSize="@dimen/dialpad_key_special_characters_size" - android:fontFamily="sans-serif-light" - android:layout_centerInParent="true" /> - </com.android.dialer.dialpad.DialpadKeyButton> - </TableRow> -</TableLayout> diff --git a/res/layout/new_dialpad_fragment.xml b/res/layout/new_dialpad_fragment.xml deleted file mode 100644 index f5565c726..000000000 --- a/res/layout/new_dialpad_fragment.xml +++ /dev/null @@ -1,122 +0,0 @@ -<?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. ---> -<view class="com.android.dialer.dialpad.DialpadFragment$DialpadSlidingLinearLayout" - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" > - <!-- spacer view --> - <Space - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" /> - <LinearLayout - android:id="@+id/top" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="2" - android:orientation="vertical" - android:paddingStart="@dimen/dialpad_horizontal_margin" - android:paddingEnd="@dimen/dialpad_horizontal_margin" - android:layoutDirection="ltr" - android:background="@color/background_dialpad" > - - - <!-- Text field and possibly soft menu button above the keypad where - the digits are displayed. --> - <LinearLayout - android:id="@+id/digits_container" - android:layout_width="match_parent" - android:layout_height="0px" - android:layout_weight="@integer/dialpad_layout_weight_digits_new" - android:layout_marginTop="@dimen/dialpad_vertical_margin" - android:gravity="center" > - - <com.android.dialer.dialpad.DigitsEditText - android:id="@+id/digits" - android:layout_width="0dip" - android:layout_weight="1" - android:layout_height="match_parent" - android:gravity="center" - android:textAppearance="@style/DialtactsDigitsTextAppearance" - android:textColor="@color/dialpad_text_color" - android:nextFocusRight="@+id/overflow_menu" - android:background="@android:color/transparent" /> - - <ImageButton - android:id="@+id/deleteButton" - android:layout_width="56dip" - android:layout_height="match_parent" - android:layout_gravity="center_vertical" - android:gravity="center" - android:state_enabled="false" - android:background="?android:attr/selectableItemBackground" - android:contentDescription="@string/description_delete_button" - android:src="@drawable/ic_dial_action_delete" /> - </LinearLayout> - - <!-- Keypad section --> - <include layout="@layout/new_dialpad" /> - - <View style="@style/DialpadHorizontalSeparator"/> - - <LinearLayout - android:id="@+id/dialButtonContainer" - android:layout_width="match_parent" - android:layout_height="0px" - android:layout_weight="@integer/dialpad_layout_weight_additional_buttons" - android:layout_gravity="center_horizontal" - android:background="@color/dialpad_primary_text_color"> - <ImageButton - android:id="@+id/call_history_on_dialpad_button" - android:layout_height="@dimen/fake_action_bar_height" - android:layout_width="@dimen/fake_menu_button_min_width" - android:layout_gravity="bottom|start" - android:background="@drawable/btn_call" - android:contentDescription="@string/action_menu_call_history_description" - android:src="@drawable/ic_menu_history_lt"/> - <ImageButton - android:id="@+id/dialButton" - android:layout_width="0dp" - android:layout_weight="1" - android:layout_height="match_parent" - android:layout_gravity="center" - android:state_enabled="false" - android:background="@drawable/btn_call" - android:contentDescription="@string/description_dial_button" - android:src="@drawable/ic_dial_action_call" /> - <ImageButton - android:id="@+id/overflow_menu_on_dialpad" - android:layout_height="@dimen/fake_action_bar_height" - android:layout_width="@dimen/fake_menu_button_min_width" - android:layout_gravity="bottom|end" - android:background="@drawable/btn_call" - android:src="@drawable/ic_menu_overflow_lt" - android:contentDescription="@string/action_menu_overflow_description" /> - </LinearLayout> - - <!-- "Dialpad chooser" UI, shown only when the user brings up the - Dialer while a call is already in progress. - When this UI is visible, the other Dialer elements - (the textfield/button and the dialpad) are hidden. --> - <ListView android:id="@+id/dialpadChooser" - android:layout_width="match_parent" - android:layout_height="1dip" - android:layout_weight="1" - /> - - </LinearLayout> -</view> diff --git a/res/layout/new_dialtacts_activity.xml b/res/layout/new_dialtacts_activity.xml deleted file mode 100644 index b9d417b36..000000000 --- a/res/layout/new_dialtacts_activity.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2013 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" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:focusable="true" - android:focusableInTouchMode="true" - android:clipChildren="false" - android:id="@+id/dialtacts_container" - > - <!-- Overlapping dialpad fragment is inserted here --> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:clipChildren="false" - android:orientation="vertical" > - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="23dp" - android:id="@+id/search_view_container" - android:background="@color/searchbox_background_color" - android:orientation="horizontal" - android:gravity="center_vertical"> - <EditText - android:id="@+id/search_view" - android:layout_width="0dp" - android:layout_height="56dp" - android:layout_weight="1" - android:inputType="textFilter"/> - <ImageView - android:id="@+id/search_close_button" - android:layout_height="40dp" - android:layout_width="40dp" - android:padding="6dp" - android:src="@drawable/ic_close_dk" - android:clickable="true" - android:background="?android:attr/selectableItemBackground" - android:visibility="gone" /> - <ImageView - android:id="@+id/voice_search_button" - android:layout_height="40dp" - android:layout_width="40dp" - android:padding="6dp" - android:src="@drawable/ic_voice_search" - android:clickable="true" - android:contentDescription="@string/description_start_voice_search" - android:background="?android:attr/selectableItemBackground" /> - </LinearLayout> - <FrameLayout - android:layout_height="0dp" - android:layout_weight="1" - android:layout_width="match_parent" - android:id="@id/dialtacts_frame" - android:clipChildren="false"> - </FrameLayout> - <View - android:id="@+id/dialtacts_bottom_padding" - android:layout_width="match_parent" - android:layout_height="?android:attr/actionBarSize" - android:visibility="gone" /> - </LinearLayout> -</FrameLayout> diff --git a/res/layout/new_phone_favorites_fragment.xml b/res/layout/phone_favorites_fragment.xml index 2b6bbe447..2b6bbe447 100644 --- a/res/layout/new_phone_favorites_fragment.xml +++ b/res/layout/phone_favorites_fragment.xml diff --git a/res/menu/call_log_options.xml b/res/menu/call_log_options.xml index bf2973f6c..50b1cad5b 100644 --- a/res/menu/call_log_options.xml +++ b/res/menu/call_log_options.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2011 The Android Open Source Project +<!-- Copyright (C) 2013 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. @@ -14,38 +14,6 @@ limitations under the License. --> <menu xmlns:android="http://schemas.android.com/apk/res/android"> - - <item - android:id="@+id/show_all_calls" - android:title="@string/menu_show_all_calls" - android:showAsAction="never" - android:orderInCategory="1"/> - - <item - android:id="@+id/show_voicemails_only" - android:title="@string/menu_show_voicemails_only" - android:showAsAction="never" - android:orderInCategory="1"/> - - <item - android:id="@+id/show_missed_only" - android:title="@string/menu_show_missed_only" - android:showAsAction="never" - android:orderInCategory="1"/> - - <item - android:id="@+id/show_outgoing_only" - android:title="@string/menu_show_outgoing_only" - android:showAsAction="never" - android:orderInCategory="1"/> - - <item - android:id="@+id/show_incoming_only" - android:title="@string/menu_show_incoming_only" - android:showAsAction="never" - android:orderInCategory="1"/> - - <item android:id="@+id/delete_all" android:title="@string/recentCalls_deleteAll" diff --git a/res/menu/call_log_options_new.xml b/res/menu/call_log_options_new.xml deleted file mode 100644 index 50b1cad5b..000000000 --- a/res/menu/call_log_options_new.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2013 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. ---> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/delete_all" - android:title="@string/recentCalls_deleteAll" - android:showAsAction="never" - android:orderInCategory="1"/> -</menu> diff --git a/res/menu/dialpad_options.xml b/res/menu/dialpad_options.xml index 6dda8fc9a..0727dd57c 100644 --- a/res/menu/dialpad_options.xml +++ b/res/menu/dialpad_options.xml @@ -24,16 +24,9 @@ android:title="@string/add_2sec_pause" android:showAsAction="withText" android:orderInCategory="1" /> - <item android:id="@+id/menu_add_wait" android:title="@string/add_wait" android:showAsAction="withText" android:orderInCategory="1" /> - - <item - android:id="@+id/menu_call_settings_dialpad" - android:title="@string/call_settings" - android:showAsAction="withText" - android:orderInCategory="1" /> </menu> diff --git a/res/menu/dialpad_options_new.xml b/res/menu/dialpad_options_new.xml deleted file mode 100644 index 0727dd57c..000000000 --- a/res/menu/dialpad_options_new.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?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. ---> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/menu_add_contacts" - android:title="@string/recentCalls_addToContact" - android:showAsAction="withText" - android:orderInCategory="1" /> - <item - android:id="@+id/menu_2s_pause" - android:title="@string/add_2sec_pause" - android:showAsAction="withText" - android:orderInCategory="1" /> - <item - android:id="@+id/menu_add_wait" - android:title="@string/add_wait" - android:showAsAction="withText" - android:orderInCategory="1" /> -</menu> diff --git a/res/menu/dialtacts_options.xml b/res/menu/dialtacts_options.xml index 8eaa91552..b30697956 100644 --- a/res/menu/dialtacts_options.xml +++ b/res/menu/dialtacts_options.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2011 The Android Open Source Project +<!-- Copyright (C) 2013 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. @@ -15,38 +15,16 @@ --> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item - android:id="@+id/search_on_action_bar" - android:title="@string/menu_search" - android:icon="@drawable/ic_dial_action_search" - android:showAsAction="ifRoom" /> - - <!-- This should come after the other menus in CallLog and Dialpad --> - <item - android:id="@+id/menu_call_settings" - android:title="@string/call_settings" - android:showAsAction="withText" - android:orderInCategory="2" /> - + android:id="@+id/menu_import_export" + android:title="@string/menu_import_export" /> <item - android:id="@+id/filter_option" - android:title="@string/menu_contacts_filter" - android:showAsAction="withText" /> - + android:id="@+id/menu_clear_frequents" + android:title="@string/menu_clear_frequents" /> <item android:id="@+id/add_contact" - android:icon="@drawable/ic_add_contact_holo_dark" - android:title="@string/menu_newContact" - android:showAsAction="ifRoom" /> - - <!-- Ugly hack: empty item never clickable. - This is for forcing search icon on left even when there's a single item - in the bottom ActionBar. - We intentionally don't use android:icon to avoid other issues around item with - a null icon. - - TODO: look for better idea. --> + android:title="@string/menu_newContact"/> <item - android:id="@+id/empty_right_menu_item" - android:actionLayout="@layout/empty2" - android:showAsAction="ifRoom" /> + android:id="@+id/menu_call_settings" + android:title="@string/call_settings" + android:orderInCategory="2" /> </menu> diff --git a/res/menu/dialtacts_options_new.xml b/res/menu/dialtacts_options_new.xml deleted file mode 100644 index b30697956..000000000 --- a/res/menu/dialtacts_options_new.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2013 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. ---> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/menu_import_export" - android:title="@string/menu_import_export" /> - <item - android:id="@+id/menu_clear_frequents" - android:title="@string/menu_clear_frequents" /> - <item - android:id="@+id/add_contact" - android:title="@string/menu_newContact"/> - <item - android:id="@+id/menu_call_settings" - android:title="@string/call_settings" - android:orderInCategory="2" /> -</menu> diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 89e5b5a6b..726c17687 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -71,7 +71,7 @@ import com.android.dialer.calllog.CallLogActivity; import com.android.dialer.dialpad.DialpadFragment; import com.android.dialer.dialpad.SmartDialNameMatcher; import com.android.dialer.interactions.PhoneNumberInteraction; -import com.android.dialer.list.NewPhoneFavoriteFragment; +import com.android.dialer.list.PhoneFavoriteFragment; import com.android.dialer.list.OnListFragmentScrolledListener; import com.android.dialer.list.ShowAllContactsFragment; import com.android.dialer.list.SmartDialSearchFragment; @@ -88,7 +88,7 @@ import java.util.ArrayList; public class DialtactsActivity extends TransactionSafeActivity implements View.OnClickListener, DialpadFragment.OnDialpadQueryChangedListener, PopupMenu.OnMenuItemClickListener, OnListFragmentScrolledListener, - NewPhoneFavoriteFragment.OnPhoneFavoriteFragmentStartedListener, + PhoneFavoriteFragment.OnPhoneFavoriteFragmentStartedListener, DialpadFragment.OnDialpadFragmentStartedListener { private static final String TAG = "DialtactsActivity"; @@ -124,7 +124,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O /** * The main fragment displaying the user's favorites and frequent contacts */ - private NewPhoneFavoriteFragment mPhoneFavoriteFragment; + private PhoneFavoriteFragment mPhoneFavoriteFragment; /** * Fragment containing the dialpad that slides into view @@ -134,7 +134,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O /** * Fragment for searching phone numbers using the alphanumeric keyboard. */ - private NewSearchFragment mRegularSearchFragment; + private SearchFragment mRegularSearchFragment; /** * Fragment for searching phone numbers using the dialpad. @@ -246,15 +246,15 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O final Intent intent = getIntent(); fixIntent(intent); - setContentView(R.layout.new_dialtacts_activity); + setContentView(R.layout.dialtacts_activity); getActionBar().hide(); if (savedInstanceState == null) { - mPhoneFavoriteFragment = new NewPhoneFavoriteFragment(); + mPhoneFavoriteFragment = new PhoneFavoriteFragment(); mPhoneFavoriteFragment.setListener(mPhoneFavoriteListener); - mRegularSearchFragment = new NewSearchFragment(); + mRegularSearchFragment = new SearchFragment(); mSmartDialSearchFragment = new SmartDialSearchFragment(); mDialpadFragment = new DialpadFragment(); mShowAllContactsFragment = new ShowAllContactsFragment(); @@ -284,11 +284,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O protected void onResume() { super.onResume(); final FragmentManager fm = getFragmentManager(); - mPhoneFavoriteFragment = (NewPhoneFavoriteFragment) fm.findFragmentByTag( + mPhoneFavoriteFragment = (PhoneFavoriteFragment) fm.findFragmentByTag( TAG_FAVORITES_FRAGMENT); mDialpadFragment = (DialpadFragment) fm.findFragmentByTag(TAG_DIALPAD_FRAGMENT); - mRegularSearchFragment = (NewSearchFragment) fm.findFragmentByTag( + mRegularSearchFragment = (SearchFragment) fm.findFragmentByTag( TAG_REGULAR_SEARCH_FRAGMENT); mRegularSearchFragment.setOnPhoneNumberPickerActionListener( mPhoneNumberPickerActionListener); @@ -311,7 +311,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onAttachFragment(Fragment fragment) { - if (fragment instanceof DialpadFragment || fragment instanceof NewSearchFragment + if (fragment instanceof DialpadFragment || fragment instanceof SearchFragment || fragment instanceof SmartDialSearchFragment || fragment instanceof ShowAllContactsFragment) { final FragmentTransaction transaction = getFragmentManager().beginTransaction(); @@ -369,7 +369,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O case R.id.overflow_menu: { final PopupMenu popupMenu = new PopupMenu(DialtactsActivity.this, view); final Menu menu = popupMenu.getMenu(); - popupMenu.inflate(R.menu.dialtacts_options_new); + popupMenu.inflate(R.menu.dialtacts_options); popupMenu.setOnMenuItemClickListener(this); popupMenu.show(); break; @@ -704,8 +704,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } } - private final NewPhoneFavoriteFragment.Listener mPhoneFavoriteListener = - new NewPhoneFavoriteFragment.Listener() { + private final PhoneFavoriteFragment.Listener mPhoneFavoriteListener = + new PhoneFavoriteFragment.Listener() { @Override public void onContactSelected(Uri contactUri) { PhoneNumberInteraction.startInteractionForPhoneCall( diff --git a/src/com/android/dialer/NewSearchFragment.java b/src/com/android/dialer/SearchFragment.java index e8e40d6aa..54d29d43f 100644 --- a/src/com/android/dialer/NewSearchFragment.java +++ b/src/com/android/dialer/SearchFragment.java @@ -25,11 +25,11 @@ import com.android.contacts.common.list.ContactListItemView; import com.android.contacts.common.list.PhoneNumberPickerFragment; import com.android.dialer.list.OnListFragmentScrolledListener; -public class NewSearchFragment extends PhoneNumberPickerFragment { +public class SearchFragment extends PhoneNumberPickerFragment { private OnListFragmentScrolledListener mActivityScrollListener; - public NewSearchFragment() { + public SearchFragment() { setDirectorySearchEnabled(true); } diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java index 39909a1f8..662614f95 100644 --- a/src/com/android/dialer/calllog/CallLogActivity.java +++ b/src/com/android/dialer/calllog/CallLogActivity.java @@ -151,7 +151,7 @@ public class CallLogActivity extends Activity { @Override public boolean onCreateOptionsMenu(Menu menu) { final MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.call_log_options_new, menu); + inflater.inflate(R.menu.call_log_options, menu); return true; } diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 76cca3362..3052c67f0 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -346,7 +346,7 @@ public class DialpadFragment extends Fragment @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { - final View fragmentView = inflater.inflate(R.layout.new_dialpad_fragment, container, + final View fragmentView = inflater.inflate(R.layout.dialpad_fragment, container, false); fragmentView.buildLayer(); @@ -938,7 +938,7 @@ public class DialpadFragment extends Fragment case R.id.overflow_menu_on_dialpad: { final PopupMenu popupMenu = new PopupMenu(getActivity(), view); final Menu menu = popupMenu.getMenu(); - popupMenu.inflate(R.menu.dialpad_options_new); + popupMenu.inflate(R.menu.dialpad_options); popupMenu.setOnMenuItemClickListener(this); setupMenuItems(menu); popupMenu.show(); diff --git a/src/com/android/dialer/dialpad/SmartDialEntry.java b/src/com/android/dialer/dialpad/SmartDialEntry.java deleted file mode 100644 index 9ff491293..000000000 --- a/src/com/android/dialer/dialpad/SmartDialEntry.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2012 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.dialer.dialpad; - -import android.net.Uri; - -import java.util.ArrayList; - -public class SmartDialEntry { - /** Display name for the contact. */ - public final CharSequence displayName; - public final Uri contactUri; - public final CharSequence phoneNumber; - - public final ArrayList<SmartDialMatchPosition> matchPositions; - public final SmartDialMatchPosition phoneNumberMatchPosition; - - public static final SmartDialEntry NULL = new SmartDialEntry("", Uri.EMPTY, "", - new ArrayList<SmartDialMatchPosition>(), null); - - public SmartDialEntry(CharSequence displayName, Uri contactUri, CharSequence phoneNumber, - ArrayList<SmartDialMatchPosition> matchPositions, - SmartDialMatchPosition phoneNumberMatchPosition) { - this.displayName = displayName; - this.contactUri = contactUri; - this.matchPositions = matchPositions; - this.phoneNumber = phoneNumber; - this.phoneNumberMatchPosition = phoneNumberMatchPosition; - } -} diff --git a/src/com/android/dialer/dialpad/SmartDialLoaderTask.java b/src/com/android/dialer/dialpad/SmartDialLoaderTask.java deleted file mode 100644 index 38a04ad8f..000000000 --- a/src/com/android/dialer/dialpad/SmartDialLoaderTask.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2012 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.dialer.dialpad; - -import android.content.Context; -import android.os.AsyncTask; -import android.provider.ContactsContract; -import android.provider.ContactsContract.Contacts; -import android.telephony.PhoneNumberUtils; - -import com.android.contacts.common.preference.ContactsPreferences; -import com.android.contacts.common.util.StopWatch; -import com.android.dialer.database.DialerDatabaseHelper; -import com.android.dialer.database.DialerDatabaseHelper.ContactNumber; - -import com.google.common.collect.Lists; - -import java.util.ArrayList; -import java.util.List; - -/** - * This task searches through the provided cache to return the top 3 contacts(ranked by confidence) - * that match the query, then passes it back to the {@link SmartDialLoaderCallback} through a - * callback function. - */ -public class SmartDialLoaderTask extends AsyncTask<String, Integer, List<SmartDialEntry>> { - private final String TAG = SmartDialLoaderTask.class.getSimpleName(); - - public interface SmartDialLoaderCallback { - void setSmartDialAdapterEntries(List<SmartDialEntry> list, String query); - } - - static private final boolean DEBUG = false; - - private final SmartDialLoaderCallback mCallback; - - private final DialerDatabaseHelper mDialerDatabaseHelper; - - private final String mQuery; - - private final SmartDialNameMatcher mNameMatcher; - - public SmartDialLoaderTask(SmartDialLoaderCallback callback, String query, Context context) { - this.mCallback = callback; - mDialerDatabaseHelper = DialerDatabaseHelper.getInstance(context); - this.mQuery = query; - this.mNameMatcher = new SmartDialNameMatcher(PhoneNumberUtils.normalizeNumber(query), - SmartDialPrefix.getMap()); - } - - @Override - protected List<SmartDialEntry> doInBackground(String... params) { - return getContactMatches(); - } - - @Override - protected void onPostExecute(List<SmartDialEntry> result) { - if (mCallback != null) { - mCallback.setSmartDialAdapterEntries(result, mQuery); - } - } - - /** - * Loads top visible contacts with phone numbers and check if their display names match the - * query. - */ - private ArrayList<SmartDialEntry> getContactMatches() { - - final StopWatch stopWatch = DEBUG ? StopWatch.start("Start Match") : null; - - final ArrayList<ContactNumber> allMatches = mDialerDatabaseHelper.getLooseMatches(mQuery, - mNameMatcher); - if (DEBUG) { - stopWatch.lap("Find matches"); - } - - final ArrayList<SmartDialEntry> candidates = Lists.newArrayList(); - for (ContactNumber contact : allMatches) { - final boolean matches = mNameMatcher.matches(contact.displayName); - candidates.add(new SmartDialEntry( - contact.displayName, - Contacts.getLookupUri(contact.id, contact.lookupKey), - contact.phoneNumber, - mNameMatcher.getMatchPositions(), - mNameMatcher.matchesNumber(contact.phoneNumber, mNameMatcher.getQuery()) - )); - } - if (DEBUG) { - stopWatch.stopAndLog(TAG + " Match Complete", 0); - } - return candidates; - } -} diff --git a/src/com/android/dialer/dialpad/SmartDialTextView.java b/src/com/android/dialer/dialpad/SmartDialTextView.java deleted file mode 100644 index 398f99ba5..000000000 --- a/src/com/android/dialer/dialpad/SmartDialTextView.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2012 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.dialer.dialpad; - -import android.content.Context; -import android.graphics.Paint; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.widget.TextView; - -import com.android.dialer.R; - -public class SmartDialTextView extends TextView { - - private final float mPadding; - private final float mExtraPadding; - - public SmartDialTextView(Context context) { - this(context, null); - } - - public SmartDialTextView(Context context, AttributeSet attrs) { - super(context, attrs); - mPadding = getResources().getDimension(R.dimen.smartdial_suggestions_padding); - mExtraPadding = getResources().getDimension(R.dimen.smartdial_suggestions_extra_padding); - } - - @Override - protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { - super.onTextChanged(text, start, lengthBefore, lengthAfter); - rescaleText(getWidth()); - } - - @Override - protected void onSizeChanged(int w, int h, int oldw, int oldh) { - super.onSizeChanged(w, h, oldw, oldh); - rescaleText(w); - } - - private void rescaleText(int w) { - if (w == 0) { - return; - } - setTextScaleX(1); - final Paint paint = getPaint(); - float width = w - 2 * mPadding - 2 * mExtraPadding; - - float ratio = width / paint.measureText(getText().toString()); - TextUtils.TruncateAt ellipsizeAt = null; - if (ratio < 1.0f) { - if (ratio < 0.8f) { - // If the text is too big to fit even after scaling to 80%, just ellipsize it - // instead. - ellipsizeAt = TextUtils.TruncateAt.END; - setTextScaleX(0.8f); - } else { - setTextScaleX(ratio); - } - } - setEllipsize(ellipsizeAt); - } -} diff --git a/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java deleted file mode 100644 index 3c3200407..000000000 --- a/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * Licensed to 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.dialer.list; - -import android.content.Context; -import android.content.res.Resources; -import android.database.DataSetObserver; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.FrameLayout; - -import com.android.dialer.R; -import com.android.dialer.calllog.CallLogAdapter; - -/** - * An adapter that combines items from {@link com.android.contacts.common.list.ContactTileAdapter} - * and {@link com.android.dialer.calllog.CallLogAdapter} into a single list. - */ -public class NewPhoneFavoriteMergedAdapter extends BaseAdapter { - - private class CustomDataSetObserver extends DataSetObserver { - @Override - public void onChanged() { - notifyDataSetChanged(); - } - } - - private static final String TAG = NewPhoneFavoriteMergedAdapter.class.getSimpleName(); - - private final PhoneFavoritesTileAdapter mContactTileAdapter; - private final CallLogAdapter mCallLogAdapter; - private final View mLoadingView; - private final View mShowAllContactsButton; - - private final int mCallLogPadding; - - private final Context mContext; - - private final DataSetObserver mObserver; - - public NewPhoneFavoriteMergedAdapter(Context context, - PhoneFavoritesTileAdapter contactTileAdapter, - View accountFilterHeaderContainer, - CallLogAdapter callLogAdapter, - View loadingView, - View showAllContactsButton) { - final Resources resources = context.getResources(); - mContext = context; - mCallLogPadding = resources.getDimensionPixelSize(R.dimen.recent_call_log_item_padding); - mContactTileAdapter = contactTileAdapter; - mCallLogAdapter = callLogAdapter; - - mObserver = new CustomDataSetObserver(); - mContactTileAdapter.registerDataSetObserver(mObserver); - mLoadingView = loadingView; - mShowAllContactsButton = showAllContactsButton; - } - - @Override - public boolean isEmpty() { - // This adapter will always contain at least the all contacts button - return false; - } - - @Override - public int getCount() { - return mContactTileAdapter.getCount() + mCallLogAdapter.getCount() + 1; - } - - @Override - public Object getItem(int position) { - final int callLogAdapterCount = mCallLogAdapter.getCount(); - - if (callLogAdapterCount > 0) { - if (position < callLogAdapterCount) { - return mCallLogAdapter.getItem(position); - } - // Set position to the position of the actual favorite contact in the favorites adapter - position = getAdjustedFavoritePosition(position, callLogAdapterCount); - } - return mContactTileAdapter.getItem(position); - } - - @Override - public long getItemId(int position) { - return position; - } - - @Override - public int getViewTypeCount() { - return (mContactTileAdapter.getViewTypeCount() + mCallLogAdapter.getViewTypeCount() + 1); - } - - @Override - public int getItemViewType(int position) { - final int callLogAdapterCount = mCallLogAdapter.getCount(); - - if (position < callLogAdapterCount) { - // View type of the call log adapter is the last view type of the contact tile adapter - // + 1 - return mContactTileAdapter.getViewTypeCount(); - } else if (position < getCount() - 1) { - return mContactTileAdapter.getItemViewType( - getAdjustedFavoritePosition(position, callLogAdapterCount)); - } else { - // View type of the show all contact button is the last view type of the contact tile - // adapter + 2 - return mContactTileAdapter.getViewTypeCount() + 1; - } - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - final int callLogAdapterCount = mCallLogAdapter.getCount(); - - if (position == getCount() - 1) { - return mShowAllContactsButton; - } - - if (callLogAdapterCount > 0) { - if (position == 0) { - final FrameLayout wrapper; - if (convertView == null) { - wrapper = new FrameLayout(mContext); - } else { - wrapper = (FrameLayout) convertView; - } - - // Special case wrapper view for the most recent call log item. This allows - // us to create a card-like effect for the more recent call log item in - // the PhoneFavoriteMergedAdapter, but keep the original look of the item in - // the CallLogAdapter. - final View view = mCallLogAdapter.getView(position, convertView == null ? - null : wrapper.getChildAt(0), parent); - wrapper.removeAllViews(); - view.setBackgroundResource(R.drawable.dialer_recent_card_bg); - - final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( - FrameLayout.LayoutParams.WRAP_CONTENT, - FrameLayout.LayoutParams.WRAP_CONTENT); - - params.setMarginsRelative(mCallLogPadding, mCallLogPadding, mCallLogPadding, - mCallLogPadding); - view.setLayoutParams(params); - wrapper.addView(view); - - return wrapper; - } - // Set position to the position of the actual favorite contact in the - // favorites adapter - position = getAdjustedFavoritePosition(position, callLogAdapterCount); - } - - // Favorites section - final View view = mContactTileAdapter.getView(position, convertView, parent); - if (position >= mContactTileAdapter.getMaxTiledRows()) { - final FrameLayout frameLayout = (FrameLayout) view; - final View child = frameLayout.getChildAt(0); - FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( - FrameLayout.LayoutParams.WRAP_CONTENT, - FrameLayout.LayoutParams.WRAP_CONTENT); - child.setLayoutParams(params); - } - return view; - } - - @Override - public boolean areAllItemsEnabled() { - // If "all" section is being loaded we'll show mLoadingView, which is not enabled. - // Otherwise check the all the other components in the ListView and return appropriate - // result. - return mCallLogAdapter.areAllItemsEnabled() && mContactTileAdapter.areAllItemsEnabled(); - } - - @Override - public boolean isEnabled(int position) { - final int callLogAdapterCount = mCallLogAdapter.getCount(); - if (position < callLogAdapterCount) { - return mCallLogAdapter.isEnabled(position); - } else { // For favorites section - return mContactTileAdapter.isEnabled( - getAdjustedFavoritePosition(position, callLogAdapterCount)); - } - } - - private int getAdjustedFavoritePosition(int position, int callLogAdapterCount) { - return position - callLogAdapterCount; - } -} diff --git a/src/com/android/dialer/list/NewPhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java index 58dac2fb6..64a9b84d2 100644 --- a/src/com/android/dialer/list/NewPhoneFavoriteFragment.java +++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java @@ -56,16 +56,15 @@ import com.android.dialer.calllog.CallLogQueryHandler; * {@link com.android.contacts.common.list.PhoneNumberListAdapter} into one unified list using {@link PhoneFavoriteMergedAdapter}. * A contact filter header is also inserted between those adapters' results. */ -public class NewPhoneFavoriteFragment extends Fragment implements OnItemClickListener, +public class PhoneFavoriteFragment extends Fragment implements OnItemClickListener, CallLogQueryHandler.Listener, CallLogAdapter.CallFetcher { - private static final String TAG = NewPhoneFavoriteFragment.class.getSimpleName(); + private static final String TAG = PhoneFavoriteFragment.class.getSimpleName(); private static final boolean DEBUG = false; /** * Used with LoaderManager. */ private static int LOADER_ID_CONTACT_TILE = 1; - private static int LOADER_ID_ALL_CONTACTS = 2; public interface OnPhoneFavoriteFragmentStartedListener { public void onPhoneFavoriteFragmentStarted(); @@ -134,7 +133,7 @@ public class NewPhoneFavoriteFragment extends Fragment implements OnItemClickLis private Listener mListener; private OnListFragmentScrolledListener mActivityScrollListener; - private NewPhoneFavoriteMergedAdapter mAdapter; + private PhoneFavoriteMergedAdapter mAdapter; private PhoneFavoritesTileAdapter mContactTileAdapter; private PhoneNumberListAdapter mAllContactsAdapter; @@ -203,7 +202,7 @@ public class NewPhoneFavoriteFragment extends Fragment implements OnItemClickLis public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View listLayout = inflater.inflate( - R.layout.new_phone_favorites_fragment, container, false); + R.layout.phone_favorites_fragment, container, false); mListView = (ListView) listLayout.findViewById(R.id.contact_tile_list); mListView.setItemsCanFocus(true); @@ -229,7 +228,7 @@ public class NewPhoneFavoriteFragment extends Fragment implements OnItemClickLis } }); - mAdapter = new NewPhoneFavoriteMergedAdapter(getActivity(), mContactTileAdapter, + mAdapter = new PhoneFavoriteMergedAdapter(getActivity(), mContactTileAdapter, mAccountFilterHeaderContainer, mCallLogAdapter, mLoadingView, mShowAllContactsButton); diff --git a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java index ba291a00f..0e5594ee5 100644 --- a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java +++ b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java @@ -23,19 +23,15 @@ import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.FrameLayout; -import android.widget.SectionIndexer; -import com.android.contacts.common.list.ContactEntryListAdapter; -import com.android.contacts.common.list.ContactListItemView; -import com.android.contacts.common.list.ContactTileAdapter; import com.android.dialer.R; +import com.android.dialer.calllog.CallLogAdapter; /** - * An adapter that combines items from {@link com.android.contacts.common.list.ContactTileAdapter} and - * {@link com.android.contacts.common.list.ContactEntryListAdapter} into a single list. In between those two results, - * an account filter header will be inserted. + * An adapter that combines items from {@link com.android.contacts.common.list.ContactTileAdapter} + * and {@link com.android.dialer.calllog.CallLogAdapter} into a single list. */ -public class PhoneFavoriteMergedAdapter extends BaseAdapter implements SectionIndexer { +public class PhoneFavoriteMergedAdapter extends BaseAdapter { private class CustomDataSetObserver extends DataSetObserver { @Override @@ -44,80 +40,60 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter implements SectionIn } } - private final ContactTileAdapter mContactTileAdapter; - private final ContactEntryListAdapter mContactEntryListAdapter; - private final View mAccountFilterHeaderContainer; + private static final String TAG = PhoneFavoriteMergedAdapter.class.getSimpleName(); + + private final PhoneFavoritesTileAdapter mContactTileAdapter; + private final CallLogAdapter mCallLogAdapter; private final View mLoadingView; + private final View mShowAllContactsButton; - private final int mItemPaddingLeft; - private final int mItemPaddingRight; + private final int mCallLogPadding; - // Make frequent header consistent with account filter header. - private final int mFrequentHeaderPaddingTop; + private final Context mContext; private final DataSetObserver mObserver; public PhoneFavoriteMergedAdapter(Context context, - ContactTileAdapter contactTileAdapter, + PhoneFavoritesTileAdapter contactTileAdapter, View accountFilterHeaderContainer, - ContactEntryListAdapter contactEntryListAdapter, - View loadingView) { - Resources resources = context.getResources(); - mItemPaddingLeft = resources.getDimensionPixelSize(R.dimen.detail_item_side_margin); - mItemPaddingRight = resources.getDimensionPixelSize(R.dimen.list_visible_scrollbar_padding); - mFrequentHeaderPaddingTop = resources.getDimensionPixelSize( - R.dimen.contact_browser_list_top_margin); + CallLogAdapter callLogAdapter, + View loadingView, + View showAllContactsButton) { + final Resources resources = context.getResources(); + mContext = context; + mCallLogPadding = resources.getDimensionPixelSize(R.dimen.recent_call_log_item_padding); mContactTileAdapter = contactTileAdapter; - mContactEntryListAdapter = contactEntryListAdapter; - - mAccountFilterHeaderContainer = accountFilterHeaderContainer; + mCallLogAdapter = callLogAdapter; mObserver = new CustomDataSetObserver(); mContactTileAdapter.registerDataSetObserver(mObserver); - mContactEntryListAdapter.registerDataSetObserver(mObserver); - mLoadingView = loadingView; + mShowAllContactsButton = showAllContactsButton; } @Override public boolean isEmpty() { - // Cannot use the super's method here because we add extra rows in getCount() to account - // for headers - return mContactTileAdapter.getCount() + mContactEntryListAdapter.getCount() == 0; + // This adapter will always contain at least the all contacts button + return false; } @Override public int getCount() { - final int contactTileAdapterCount = mContactTileAdapter.getCount(); - final int contactEntryListAdapterCount = mContactEntryListAdapter.getCount(); - if (mContactEntryListAdapter.isLoading()) { - // Hide "all" contacts during its being loaded. Instead show "loading" view. - // - // "+2" for mAccountFilterHeaderContainer and mLoadingView - return contactTileAdapterCount + 2; - } else { - // "+1" for mAccountFilterHeaderContainer - return contactTileAdapterCount + contactEntryListAdapterCount + 1; - } + return mContactTileAdapter.getCount() + mCallLogAdapter.getCount() + 1; } @Override public Object getItem(int position) { - final int contactTileAdapterCount = mContactTileAdapter.getCount(); - final int contactEntryListAdapterCount = mContactEntryListAdapter.getCount(); - if (position < contactTileAdapterCount) { // For "tile" and "frequent" sections - return mContactTileAdapter.getItem(position); - } else if (position == contactTileAdapterCount) { // For "all" section's account header - return mAccountFilterHeaderContainer; - } else { // For "all" section - if (mContactEntryListAdapter.isLoading()) { // "All" section is being loaded. - return mLoadingView; - } else { - // "-1" for mAccountFilterHeaderContainer - final int localPosition = position - contactTileAdapterCount - 1; - return mContactTileAdapter.getItem(localPosition); + final int callLogAdapterCount = mCallLogAdapter.getCount(); + + if (callLogAdapterCount > 0) { + if (position < callLogAdapterCount) { + return mCallLogAdapter.getItem(position); } + // Set position to the position of the actual favorite contact in the favorites adapter + position = getAdjustedFavoritePosition(position, callLogAdapterCount); } + return mContactTileAdapter.getItem(position); } @Override @@ -127,122 +103,80 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter implements SectionIn @Override public int getViewTypeCount() { - // "+2" for mAccountFilterHeaderContainer and mLoadingView - return (mContactTileAdapter.getViewTypeCount() - + mContactEntryListAdapter.getViewTypeCount() - + 2); + return (mContactTileAdapter.getViewTypeCount() + mCallLogAdapter.getViewTypeCount() + 1); } @Override public int getItemViewType(int position) { - final int contactTileAdapterCount = mContactTileAdapter.getCount(); - final int contactEntryListAdapterCount = mContactEntryListAdapter.getCount(); - // There should be four kinds of types that are usually used, and one more exceptional - // type (IGNORE_ITEM_VIEW_TYPE), which sometimes comes from mContactTileAdapter. - // - // The four ordinary view types have the index equal to or more than 0, and less than - // mContactTileAdapter.getViewTypeCount()+ mContactEntryListAdapter.getViewTypeCount() + 2. - // (See also this class's getViewTypeCount()) - // - // We have those values for: - // - The view types mContactTileAdapter originally has - // - The view types mContactEntryListAdapter originally has - // - mAccountFilterHeaderContainer ("all" section's account header), and - // - mLoadingView - // - // Those types should not be mixed, so we have a different range for each kinds of types: - // - Types for mContactTileAdapter ("tile" and "frequent" sections) - // They should have the index, >=0 and <mContactTileAdapter.getViewTypeCount() - // - // - Types for mContactEntryListAdapter ("all" sections) - // They should have the index, >=mContactTileAdapter.getViewTypeCount() and - // <(mContactTileAdapter.getViewTypeCount() + mContactEntryListAdapter.getViewTypeCount()) - // - // - Type for "all" section's account header - // It should have the exact index - // mContactTileAdapter.getViewTypeCount()+ mContactEntryListAdapter.getViewTypeCount() - // - // - Type for "loading" view used during "all" section is being loaded. - // It should have the exact index - // mContactTileAdapter.getViewTypeCount()+ mContactEntryListAdapter.getViewTypeCount() + 1 - // - // As an exception, IGNORE_ITEM_VIEW_TYPE (-1) will be remained as is, which will be used - // by framework's Adapter implementation and thus should be left as is. - if (position < contactTileAdapterCount) { // For "tile" and "frequent" sections - return mContactTileAdapter.getItemViewType(position); - } else if (position == contactTileAdapterCount) { // For "all" section's account header - return mContactTileAdapter.getViewTypeCount() - + mContactEntryListAdapter.getViewTypeCount(); - } else { // For "all" section - if (mContactEntryListAdapter.isLoading()) { // "All" section is being loaded. - return mContactTileAdapter.getViewTypeCount() - + mContactEntryListAdapter.getViewTypeCount() + 1; - } else { - // "-1" for mAccountFilterHeaderContainer - final int localPosition = position - contactTileAdapterCount - 1; - final int type = mContactEntryListAdapter.getItemViewType(localPosition); - // IGNORE_ITEM_VIEW_TYPE must be handled differently. - return (type < 0) ? type : type + mContactTileAdapter.getViewTypeCount(); - } + final int callLogAdapterCount = mCallLogAdapter.getCount(); + + if (position < callLogAdapterCount) { + // View type of the call log adapter is the last view type of the contact tile adapter + // + 1 + return mContactTileAdapter.getViewTypeCount(); + } else if (position < getCount() - 1) { + return mContactTileAdapter.getItemViewType( + getAdjustedFavoritePosition(position, callLogAdapterCount)); + } else { + // View type of the show all contact button is the last view type of the contact tile + // adapter + 2 + return mContactTileAdapter.getViewTypeCount() + 1; } } @Override public View getView(int position, View convertView, ViewGroup parent) { - final int contactTileAdapterCount = mContactTileAdapter.getCount(); - final int contactEntryListAdapterCount = mContactEntryListAdapter.getCount(); + final int callLogAdapterCount = mCallLogAdapter.getCount(); + + if (position == getCount() - 1) { + return mShowAllContactsButton; + } - // Obtain a View relevant for that position, and adjust its horizontal padding. Each - // View has different implementation, so we use different way to control those padding. - if (position < contactTileAdapterCount) { // For "tile" and "frequent" sections - final View view = mContactTileAdapter.getView(position, convertView, parent); - final int frequentHeaderPosition = mContactTileAdapter.getFrequentHeaderPosition(); - if (position < frequentHeaderPosition) { // "starred" contacts - // No padding adjustment. - } else if (position == frequentHeaderPosition) { - view.setPadding(mItemPaddingLeft, mFrequentHeaderPaddingTop, - mItemPaddingRight, view.getPaddingBottom()); - } else { - // Views for "frequent" contacts use FrameLayout's margins instead of padding. - final FrameLayout frameLayout = (FrameLayout) view; - final View child = frameLayout.getChildAt(0); - FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( + if (callLogAdapterCount > 0) { + if (position == 0) { + final FrameLayout wrapper; + if (convertView == null) { + wrapper = new FrameLayout(mContext); + } else { + wrapper = (FrameLayout) convertView; + } + + // Special case wrapper view for the most recent call log item. This allows + // us to create a card-like effect for the more recent call log item in + // the PhoneFavoriteMergedAdapter, but keep the original look of the item in + // the CallLogAdapter. + final View view = mCallLogAdapter.getView(position, convertView == null ? + null : wrapper.getChildAt(0), parent); + wrapper.removeAllViews(); + view.setBackgroundResource(R.drawable.dialer_recent_card_bg); + + final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); - params.setMargins(mItemPaddingLeft, 0, mItemPaddingRight, 0); - child.setLayoutParams(params); - } - return view; - } else if (position == contactTileAdapterCount) { // For "all" section's account header - mAccountFilterHeaderContainer.setPadding(mItemPaddingLeft, - mAccountFilterHeaderContainer.getPaddingTop(), - mItemPaddingRight, - mAccountFilterHeaderContainer.getPaddingBottom()); - // Show a single "No Contacts" label under the "all" section account header - // if no contacts are displayed. - mAccountFilterHeaderContainer.findViewById( - R.id.contact_list_all_empty).setVisibility( - contactEntryListAdapterCount == 0 ? View.VISIBLE : View.GONE); - return mAccountFilterHeaderContainer; - } else { // For "all" section - if (mContactEntryListAdapter.isLoading()) { // "All" section is being loaded. - mLoadingView.setPadding(mItemPaddingLeft, - mLoadingView.getPaddingTop(), - mItemPaddingRight, - mLoadingView.getPaddingBottom()); - return mLoadingView; - } else { - // "-1" for mAccountFilterHeaderContainer - final int localPosition = position - contactTileAdapterCount - 1; - final ContactListItemView itemView = (ContactListItemView) - mContactEntryListAdapter.getView(localPosition, convertView, null); - itemView.setPadding(mItemPaddingLeft, itemView.getPaddingTop(), - mItemPaddingRight, itemView.getPaddingBottom()); - itemView.setSelectionBoundsHorizontalMargin(mItemPaddingLeft, mItemPaddingRight); - return itemView; + params.setMarginsRelative(mCallLogPadding, mCallLogPadding, mCallLogPadding, + mCallLogPadding); + view.setLayoutParams(params); + wrapper.addView(view); + + return wrapper; } + // Set position to the position of the actual favorite contact in the + // favorites adapter + position = getAdjustedFavoritePosition(position, callLogAdapterCount); + } + + // Favorites section + final View view = mContactTileAdapter.getView(position, convertView, parent); + if (position >= mContactTileAdapter.getMaxTiledRows()) { + final FrameLayout frameLayout = (FrameLayout) view; + final View child = frameLayout.getChildAt(0); + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.WRAP_CONTENT, + FrameLayout.LayoutParams.WRAP_CONTENT); + child.setLayoutParams(params); } + return view; } @Override @@ -250,58 +184,21 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter implements SectionIn // If "all" section is being loaded we'll show mLoadingView, which is not enabled. // Otherwise check the all the other components in the ListView and return appropriate // result. - return !mContactEntryListAdapter.isLoading() - && (mContactTileAdapter.areAllItemsEnabled() - && mAccountFilterHeaderContainer.isEnabled() - && mContactEntryListAdapter.areAllItemsEnabled()); + return mCallLogAdapter.areAllItemsEnabled() && mContactTileAdapter.areAllItemsEnabled(); } @Override public boolean isEnabled(int position) { - final int contactTileAdapterCount = mContactTileAdapter.getCount(); - final int contactEntryListAdapterCount = mContactEntryListAdapter.getCount(); - if (position < contactTileAdapterCount) { // For "tile" and "frequent" sections - return mContactTileAdapter.isEnabled(position); - } else if (position == contactTileAdapterCount) { // For "all" section's account header - // This will be handled by View's onClick event instead of ListView's onItemClick event. - return false; - } else { // For "all" section - if (mContactEntryListAdapter.isLoading()) { // "All" section is being loaded. - return false; - } else { - // "-1" for mAccountFilterHeaderContainer - final int localPosition = position - contactTileAdapterCount - 1; - return mContactEntryListAdapter.isEnabled(localPosition); - } + final int callLogAdapterCount = mCallLogAdapter.getCount(); + if (position < callLogAdapterCount) { + return mCallLogAdapter.isEnabled(position); + } else { // For favorites section + return mContactTileAdapter.isEnabled( + getAdjustedFavoritePosition(position, callLogAdapterCount)); } } - @Override - public int getPositionForSection(int sectionIndex) { - final int contactTileAdapterCount = mContactTileAdapter.getCount(); - final int localPosition = mContactEntryListAdapter.getPositionForSection(sectionIndex); - return contactTileAdapterCount + 1 + localPosition; - } - - @Override - public int getSectionForPosition(int position) { - final int contactTileAdapterCount = mContactTileAdapter.getCount(); - if (position <= contactTileAdapterCount) { - return 0; - } else { - // "-1" for mAccountFilterHeaderContainer - final int localPosition = position - contactTileAdapterCount - 1; - return mContactEntryListAdapter.getSectionForPosition(localPosition); - } - } - - @Override - public Object[] getSections() { - return mContactEntryListAdapter.getSections(); - } - - public boolean shouldShowFirstScroller(int firstVisibleItem) { - final int contactTileAdapterCount = mContactTileAdapter.getCount(); - return firstVisibleItem > contactTileAdapterCount; + private int getAdjustedFavoritePosition(int position, int callLogAdapterCount) { + return position - callLogAdapterCount; } } |