Merge "Grab audio focus when listening to voicemail." into mnc-dev
diff --git a/res/drawable-hdpi/ic_more_horiz_24dp.png b/res/drawable-hdpi/ic_more_horiz_24dp.png
new file mode 100644
index 0000000..ebfcb6f
--- /dev/null
+++ b/res/drawable-hdpi/ic_more_horiz_24dp.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_report_problem_24dp.png b/res/drawable-hdpi/ic_report_problem_24dp.png
new file mode 100644
index 0000000..cebb1c2
--- /dev/null
+++ b/res/drawable-hdpi/ic_report_problem_24dp.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_videocam_wht_24dp.png b/res/drawable-hdpi/ic_videocam_24dp.png
similarity index 100%
rename from res/drawable-hdpi/ic_videocam_wht_24dp.png
rename to res/drawable-hdpi/ic_videocam_24dp.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_voicemail_24dp.png b/res/drawable-hdpi/ic_voicemail_24dp.png
new file mode 100644
index 0000000..03a62e1
--- /dev/null
+++ b/res/drawable-hdpi/ic_voicemail_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_more_horiz_24dp.png b/res/drawable-mdpi/ic_more_horiz_24dp.png
new file mode 100644
index 0000000..8c0be8a
--- /dev/null
+++ b/res/drawable-mdpi/ic_more_horiz_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_report_problem_24dp.png b/res/drawable-mdpi/ic_report_problem_24dp.png
new file mode 100644
index 0000000..04365b9
--- /dev/null
+++ b/res/drawable-mdpi/ic_report_problem_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_videocam_wht_24dp.png b/res/drawable-mdpi/ic_videocam_24dp.png
similarity index 100%
rename from res/drawable-mdpi/ic_videocam_wht_24dp.png
rename to res/drawable-mdpi/ic_videocam_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_voicemail_24dp.png b/res/drawable-mdpi/ic_voicemail_24dp.png
new file mode 100644
index 0000000..e5aa7db
--- /dev/null
+++ b/res/drawable-mdpi/ic_voicemail_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_more_horiz_24dp.png b/res/drawable-xhdpi/ic_more_horiz_24dp.png
new file mode 100644
index 0000000..dbb87ca
--- /dev/null
+++ b/res/drawable-xhdpi/ic_more_horiz_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_report_problem_24dp.png b/res/drawable-xhdpi/ic_report_problem_24dp.png
new file mode 100644
index 0000000..a43fa3c
--- /dev/null
+++ b/res/drawable-xhdpi/ic_report_problem_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_videocam_wht_24dp.png b/res/drawable-xhdpi/ic_videocam_24dp.png
similarity index 100%
rename from res/drawable-xhdpi/ic_videocam_wht_24dp.png
rename to res/drawable-xhdpi/ic_videocam_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_voicemail_24dp.png b/res/drawable-xhdpi/ic_voicemail_24dp.png
new file mode 100644
index 0000000..59126d7
--- /dev/null
+++ b/res/drawable-xhdpi/ic_voicemail_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_more_horiz_24dp.png b/res/drawable-xxhdpi/ic_more_horiz_24dp.png
new file mode 100644
index 0000000..2036a9c
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_more_horiz_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_report_problem_24dp.png b/res/drawable-xxhdpi/ic_report_problem_24dp.png
new file mode 100644
index 0000000..807b9fa
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_report_problem_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_videocam_wht_24dp.png b/res/drawable-xxhdpi/ic_videocam_24dp.png
similarity index 100%
rename from res/drawable-xxhdpi/ic_videocam_wht_24dp.png
rename to res/drawable-xxhdpi/ic_videocam_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_voicemail_24dp.png b/res/drawable-xxhdpi/ic_voicemail_24dp.png
new file mode 100644
index 0000000..28b8e93
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_voicemail_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_more_horiz_24dp.png b/res/drawable-xxxhdpi/ic_more_horiz_24dp.png
new file mode 100644
index 0000000..535f087
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_more_horiz_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_report_problem_24dp.png b/res/drawable-xxxhdpi/ic_report_problem_24dp.png
new file mode 100644
index 0000000..8683a2e
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_report_problem_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_videocam_24dp.png b/res/drawable-xxxhdpi/ic_videocam_24dp.png
new file mode 100644
index 0000000..ed20c07
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_videocam_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_voicemail_24dp.png b/res/drawable-xxxhdpi/ic_voicemail_24dp.png
new file mode 100644
index 0000000..820ff50
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_voicemail_24dp.png
Binary files differ
diff --git a/res/drawable/call_log_action_border.xml b/res/drawable/call_log_action_border.xml
new file mode 100644
index 0000000..fbb3559
--- /dev/null
+++ b/res/drawable/call_log_action_border.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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
+ -->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:left="-1dp" android:right="-1dp" android:bottom="-1dp">
+ <shape android:shape="rectangle">
+ <stroke android:width="1dp" android:color="@color/call_log_action_divider" />
+ </shape>
+ </item>
+</layer-list>
diff --git a/res/layout/call_log_fragment.xml b/res/layout/call_log_fragment.xml
index cee6af1..a5a3072 100644
--- a/res/layout/call_log_fragment.xml
+++ b/res/layout/call_log_fragment.xml
@@ -41,14 +41,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_dialer_call_log"
- android:padding="8dp" />
+ android:paddingStart="@dimen/call_log_horizontal_margin"
+ android:paddingEnd="@dimen/call_log_horizontal_margin" />
<include
android:id="@+id/empty_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
layout="@layout/empty_list_view"
- android:visibility="gone"/>
+ android:visibility="gone" />
</FrameLayout>
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index a0ed5c7..af8cb8b 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -35,127 +35,132 @@
android:paddingTop="@dimen/call_log_day_group_padding_top"
android:paddingBottom="@dimen/call_log_day_group_padding_bottom" />
- <!-- Linear layout to separate the primary area containing the contact badge and caller
- information and the secondary action (call details / play voicemail). -->
<android.support.v7.widget.CardView
android:id="@+id/call_log_row"
style="@style/CallLogCardStyle">
- <!-- Primary area containing the contact badge and caller information -->
<LinearLayout
- android:id="@+id/primary_action_view"
- android:background="?android:attr/selectableItemBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingStart="@dimen/call_log_start_margin"
- android:paddingEnd="@dimen/call_log_outer_margin"
- android:paddingTop="@dimen/call_log_outer_margin"
- android:paddingBottom="@dimen/call_log_outer_margin"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- android:focusable="true"
- android:nextFocusRight="@+id/call_back_action"
- android:nextFocusLeft="@+id/quick_contact_photo" >
+ android:orientation="vertical">
- <QuickContactBadge
- android:id="@+id/quick_contact_photo"
- android:layout_width="@dimen/contact_photo_size"
- android:layout_height="@dimen/contact_photo_size"
- android:paddingTop="2dp"
- android:nextFocusRight="@id/primary_action_view"
- android:layout_gravity="top"
- android:focusable="true" />
-
+ <!-- Primary area containing the contact badge and caller information -->
<LinearLayout
- android:layout_width="0dp"
+ android:id="@+id/primary_action_view"
+ android:background="?android:attr/selectableItemBackground"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical"
+ android:paddingStart="@dimen/call_log_start_margin"
+ android:paddingEnd="@dimen/call_log_outer_margin"
+ android:paddingTop="@dimen/call_log_vertical_padding"
+ android:paddingBottom="@dimen/call_log_vertical_padding"
+ android:orientation="horizontal"
android:gravity="center_vertical"
- android:layout_marginStart="@dimen/call_log_start_margin">
+ android:focusable="true"
+ android:nextFocusRight="@+id/call_back_action"
+ android:nextFocusLeft="@+id/quick_contact_photo" >
- <TextView
- android:id="@+id/name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/call_log_name_margin_bottom"
- android:layout_marginEnd="@dimen/call_log_icon_margin"
- android:textColor="?attr/call_log_primary_text_color"
- android:textSize="@dimen/call_log_primary_text_size"
- android:singleLine="true" />
-
- <TextView
- android:id="@+id/voicemail_transcription"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="@dimen/call_log_icon_margin"
- android:textColor="?attr/call_log_secondary_text_color"
- android:textSize="@dimen/call_log_secondary_text_size"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:visibility="gone" />
+ <QuickContactBadge
+ android:id="@+id/quick_contact_photo"
+ android:layout_width="@dimen/contact_photo_size"
+ android:layout_height="@dimen/contact_photo_size"
+ android:paddingTop="2dp"
+ android:nextFocusRight="@id/primary_action_view"
+ android:layout_gravity="top"
+ android:focusable="true" />
<LinearLayout
- android:id="@+id/call_type"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <view
- class="com.android.dialer.calllog.CallTypeIconsView"
- android:id="@+id/call_type_icons"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="@dimen/call_log_icon_margin"
- android:layout_gravity="center_vertical" />
+ android:layout_weight="1"
+ android:orientation="vertical"
+ android:gravity="center_vertical"
+ android:layout_marginStart="@dimen/call_log_list_item_info_margin_start">
<TextView
- android:id="@+id/call_location_and_date"
+ android:id="@+id/name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/call_log_name_margin_bottom"
+ android:layout_marginEnd="@dimen/call_log_icon_margin"
+ android:textColor="?attr/call_log_primary_text_color"
+ android:textSize="@dimen/call_log_primary_text_size"
+ android:singleLine="true" />
+
+ <TextView
+ android:id="@+id/voicemail_transcription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/call_log_icon_margin"
- android:layout_gravity="center_vertical"
android:textColor="?attr/call_log_secondary_text_color"
android:textSize="@dimen/call_log_secondary_text_size"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:visibility="gone" />
+
+ <LinearLayout
+ android:id="@+id/call_type"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <view
+ class="com.android.dialer.calllog.CallTypeIconsView"
+ android:id="@+id/call_type_icons"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/call_log_icon_margin"
+ android:layout_gravity="center_vertical" />
+
+ <TextView
+ android:id="@+id/call_location_and_date"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/call_log_icon_margin"
+ android:layout_gravity="center_vertical"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="@dimen/call_log_secondary_text_size"
+ android:singleLine="true" />
+
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/call_account_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/call_log_icon_margin"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="@dimen/call_log_secondary_text_size"
+ android:visibility="gone"
android:singleLine="true" />
</LinearLayout>
- <TextView
- android:id="@+id/call_account_label"
+ <ImageView
+ android:id="@+id/call_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/call_log_icon_margin"
- android:textColor="?attr/call_log_secondary_text_color"
- android:textSize="@dimen/call_log_secondary_text_size"
- android:visibility="gone"
- android:singleLine="true" />
+ android:background="?android:attr/selectableItemBackgroundBorderless"
+ android:src="@drawable/ic_card_phone"
+ android:tint="@color/recent_call_log_item_phone_icon_tint"
+ android:alpha="0.3"
+ android:contentDescription="@string/description_call_log_call_action"
+ android:visibility="gone" />
</LinearLayout>
- <ImageView
- android:id="@+id/call_icon"
- android:layout_width="wrap_content"
+ <!-- Viewstub with additional expandable actions for a call log entry -->
+ <ViewStub android:id="@+id/call_log_entry_actions_stub"
+ android:inflatedId="@+id/call_log_entry_actions"
+ android:layout="@layout/call_log_list_item_actions"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_marginEnd="@dimen/call_log_icon_margin"
- android:background="?android:attr/selectableItemBackgroundBorderless"
- android:src="@drawable/ic_card_phone"
- android:tint="@color/recent_call_log_item_phone_icon_tint"
- android:alpha="0.3"
- android:contentDescription="@string/description_call_log_call_action"
- android:visibility="gone" />
+ android:layout_gravity="bottom" />
</LinearLayout>
- <!-- Viewstub with additional expandable actions for a call log entry -->
- <ViewStub android:id="@+id/call_log_entry_actions_stub"
- android:inflatedId="@+id/call_log_entry_actions"
- android:layout="@layout/call_log_list_item_actions"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
-
</android.support.v7.widget.CardView>
</LinearLayout>
diff --git a/res/layout/call_log_list_item_actions.xml b/res/layout/call_log_list_item_actions.xml
index 8ef92bf..a10b47f 100644
--- a/res/layout/call_log_list_item_actions.xml
+++ b/res/layout/call_log_list_item_actions.xml
@@ -23,44 +23,88 @@
android:visibility="visible"
android:importantForAccessibility="1">
- <!-- Temporary border spacer. -->
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:layout_weight="1"
- android:background="#eeeeee" />
-
- <TextView
+ <LinearLayout
android:id="@+id/video_call_action"
- style="@style/CallLogActionsStyle"
- android:background="?android:attr/selectableItemBackground"
- android:text="@string/call_log_action_video_call"
- android:nextFocusLeft="@+id/primary_action_view"
- android:nextFocusRight="@+id/voicemail_action" />
+ style="@style/CallLogActionStyle">
- <TextView
+ <ImageView
+ style="@style/CallLogActionIconStyle"
+ android:src="@drawable/ic_videocam_24dp" />
+
+ <TextView
+ style="@style/CallLogActionTextStyle"
+ android:text="@string/call_log_action_video_call" />
+
+ </LinearLayout>
+
+ <LinearLayout
android:id="@+id/voicemail_action"
- style="@style/CallLogActionsStyle"
- android:background="?android:attr/selectableItemBackground"
- android:text="@string/call_log_action_voicemail"
- android:nextFocusLeft="@+id/video_call_action"
- android:nextFocusRight="@+id/details_action" />
+ style="@style/CallLogActionStyle">
- <TextView
+ <ImageView
+ style="@style/CallLogActionIconStyle"
+ android:src="@drawable/ic_voicemail_24dp" />
+
+ <TextView
+ style="@style/CallLogActionTextStyle"
+ android:text="@string/call_log_action_voicemail" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/create_new_contact_action"
+ style="@style/CallLogActionStyle">
+
+ <ImageView
+ style="@style/CallLogActionIconStyle"
+ android:src="@drawable/ic_person_add_24dp" />
+
+ <TextView
+ style="@style/CallLogActionTextStyle"
+ android:text="@string/search_shortcut_create_new_contact" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/add_to_existing_contact_action"
+ style="@style/CallLogActionStyle">
+
+ <ImageView
+ style="@style/CallLogActionIconStyle"
+ android:src="@drawable/ic_person_24dp" />
+
+ <TextView
+ style="@style/CallLogActionTextStyle"
+ android:text="@string/search_shortcut_add_to_existing_contact" />
+
+ </LinearLayout>
+
+ <LinearLayout
android:id="@+id/details_action"
- style="@style/CallLogActionsStyle"
- android:background="?android:attr/selectableItemBackground"
- android:text="@string/call_log_action_details"
- android:nextFocusLeft="@+id/voicemail_action"
- android:nextFocusRight="@+id/report_action" />
+ style="@style/CallLogActionStyle">
- <TextView
+ <ImageView
+ style="@style/CallLogActionIconStyle"
+ android:src="@drawable/ic_more_horiz_24dp" />
+
+ <TextView
+ style="@style/CallLogActionTextStyle"
+ android:text="@string/call_log_action_details" />
+
+ </LinearLayout>
+
+ <LinearLayout
android:id="@+id/report_action"
- style="@style/CallLogActionsStyle"
- android:background="?android:attr/selectableItemBackground"
- android:text="@string/call_log_action_report"
- android:nextFocusLeft="@+id/details_action"
- android:nextFocusRight="@+id/primary_action_view"
- android:visibility="gone" />
+ style="@style/CallLogActionStyle">
+
+ <ImageView
+ style="@style/CallLogActionIconStyle"
+ android:src="@drawable/ic_report_problem_24dp" />
+
+ <TextView
+ style="@style/CallLogActionTextStyle"
+ android:text="@string/call_log_action_report" />
+
+ </LinearLayout>
</LinearLayout>
diff --git a/res/layout/lists_fragment.xml b/res/layout/lists_fragment.xml
index bcf414b..1942a96 100644
--- a/res/layout/lists_fragment.xml
+++ b/res/layout/lists_fragment.xml
@@ -32,7 +32,8 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_height_large"
- android:background="@color/actionbar_background_color" />
+ android:background="@color/actionbar_background_color"
+ android:elevation="@dimen/tab_elevation" />
<com.android.contacts.common.list.ViewPagerTabs
android:id="@+id/lists_pager_header"
diff --git a/res/layout/search_edittext.xml b/res/layout/search_edittext.xml
index 93a3c75..61406a1 100644
--- a/res/layout/search_edittext.xml
+++ b/res/layout/search_edittext.xml
@@ -19,7 +19,7 @@
android:paddingStart="@dimen/search_box_left_padding"
android:paddingEnd="@dimen/search_box_right_padding"
android:gravity="center_vertical"
- android:orientation="horizontal" >
+ android:orientation="horizontal">
<ImageView
android:id="@+id/search_magnifying_glass"
@@ -28,29 +28,20 @@
android:layout_margin="@dimen/search_box_icon_margin"
android:padding="@dimen/search_box_search_icon_padding"
android:src="@drawable/ic_ab_search"
- android:background="?android:attr/selectableItemBackgroundBorderless"
android:importantForAccessibility="no"
android:tint="@color/searchbox_icon_tint" />
- <!-- Portion of the search box that starts a search when clicked -->
- <LinearLayout
+ <TextView
android:id="@+id/search_box_start_search"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
- android:gravity="center_vertical" >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="@dimen/search_box_collapsed_text_margin_left"
- android:textSize="@dimen/search_collapsed_text_size"
- android:fontFamily="@string/search_font_family"
- android:textColorHint="@color/searchbox_hint_text_color"
- android:gravity="center_vertical"
- android:hint="@string/dialer_hint_find_contact" />
-
- </LinearLayout>
+ android:layout_marginLeft="@dimen/search_box_collapsed_text_margin_left"
+ android:textSize="@dimen/search_collapsed_text_size"
+ android:fontFamily="@string/search_font_family"
+ android:textColorHint="@color/searchbox_hint_text_color"
+ android:gravity="center_vertical"
+ android:hint="@string/dialer_hint_find_contact" />
<ImageView
android:id="@+id/voice_search_button"
@@ -60,16 +51,15 @@
android:src="@drawable/ic_voice_search"
android:clickable="true"
android:contentDescription="@string/description_start_voice_search"
- android:background="?android:attr/selectableItemBackground"
+ android:background="?android:attr/selectableItemBackgroundBorderless"
android:tint="@color/searchbox_icon_tint" />
-
<ImageButton
android:id="@+id/dialtacts_options_menu_button"
android:layout_width="@dimen/search_box_icon_size"
android:layout_height="@dimen/search_box_icon_size"
android:layout_margin="@dimen/search_box_icon_margin"
- android:background="?android:attr/selectableItemBackground"
+ android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_overflow_menu"
android:contentDescription="@string/action_menu_overflow_description"
android:tint="@color/searchbox_icon_tint" />
diff --git a/res/layout/show_call_history_list_item.xml b/res/layout/show_call_history_list_item.xml
new file mode 100644
index 0000000..1264894
--- /dev/null
+++ b/res/layout/show_call_history_list_item.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/CallLogCardStyle"
+ android:layout_height="40dp"
+ android:clickable="true"
+ android:foreground="?android:attr/selectableItemBackground">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="@string/show_call_history" />
+
+</android.support.v7.widget.CardView>
+
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 25f203d..86ac9be 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -18,7 +18,7 @@
<!-- Primary text color in the Dialer -->
<color name="dialtacts_primary_text_color">#333333</color>
<!-- Secondary text color in the Dialer -->
- <color name="dialtacts_secondary_text_color">#737373</color>
+ <color name="dialtacts_secondary_text_color">#636363</color>
<color name="dialer_red_highlight_color">#ff1744</color>
<color name="dialer_green_highlight_color">#00c853</color>
@@ -100,4 +100,5 @@
<color name="floating_action_button_touch_tint">#80ffffff</color>
+ <color name="call_log_action_divider">#eeeeee</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 502b21a..b36b9d6 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -22,15 +22,19 @@
<dimen name="remove_text_size">16dp</dimen>
<!-- Call Log -->
- <dimen name="call_log_call_action_size">32dip</dimen>
+ <dimen name="call_log_horizontal_margin">8dp</dimen>
+ <dimen name="call_log_call_action_size">32dp</dimen>
<dimen name="call_log_call_action_width">54dp</dimen>
- <dimen name="call_log_icon_margin">4dip</dimen>
- <dimen name="call_log_inner_margin">13dip</dimen>
+ <dimen name="call_log_icon_margin">4dp</dimen>
+ <dimen name="call_log_inner_margin">13dp</dimen>
<dimen name="call_log_outer_margin">8dp</dimen>
- <dimen name="call_log_start_margin">16dp</dimen>
- <dimen name="call_log_indent_margin">24dip</dimen>
+ <dimen name="call_log_start_margin">8dp</dimen>
+ <dimen name="call_log_indent_margin">24dp</dimen>
<dimen name="call_log_name_margin_bottom">2dp</dimen>
- <dimen name="call_log_list_item_height">56dip</dimen>
+ <dimen name="call_log_vertical_padding">12dp</dimen>
+ <dimen name="call_log_list_item_height">56dp</dimen>
+ <dimen name="call_log_list_item_info_margin_start">16dp</dimen>
+ <dimen name="show_call_history_list_item_height">72dp</dimen>
<!-- Size of contact photos in the call log and call details. -->
<dimen name="contact_photo_size">40dp</dimen>
@@ -100,11 +104,10 @@
<dimen name="search_box_elevation">3dp</dimen>
<dimen name="call_log_action_height">48dp</dimen>
+ <dimen name="call_log_action_icon_margin_start">16dp</dimen>
+ <dimen name="call_log_action_icon_dimen">24dp</dimen>
<dimen name="call_log_action_horizontal_padding">24dp</dimen>
- <!-- Left-padding for the call log action buttons - ensures the buttons align with the text
- to the right of the contact badge. Adjust when any of the following change:
- call_log_action_horizontal_padding
- call_log_list_contact_photo_size -->
+
<dimen name="call_log_actions_left_padding">64dp</dimen>
<dimen name="call_log_primary_text_size">14sp</dimen>
<dimen name="call_log_secondary_text_size">14sp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4ee5b45..79c441d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -512,8 +512,8 @@
<!-- Shortcut item used to make a video call directly from search. -->
<string name="search_shortcut_make_video_call">Make video call</string>
- <!-- Title for the recent calls footer that brings users to the full call history when clicked -->
- <string name="recents_footer_text">View full call history</string>
+ <!-- Title for the call log list item that brings users to the full call history when clicked -->
+ <string name="show_call_history">View full call history</string>
<!-- Number of missed calls shown on call card [CHAR LIMIT=40] -->
<string name="num_missed_calls"><xliff:g id="number">%s</xliff:g> new missed calls</string>
@@ -585,26 +585,53 @@
action triggers a return call to the named user.
Note: AccessibilityServices uses this attribute to announce the purpose of the button.
[CHAR LIMIT=NONE] -->
- <string name="description_call_action">Call <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g></string>
+ <string name="description_call_action">
+ Call <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g>
+ </string>
<!-- String describing the "video call" action for an entry in the call log. The video call
action triggers a return video call to the named person/number.
Note: AccessibilityServices uses this attribute to announce the purpose of the button.
[CHAR LIMIT=NONE] -->
- <string name="description_video_call_action">Video call to <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g>.</string>
+ <string name="description_video_call_action">
+ Video call <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g>.
+ </string>
<!-- String describing the "listen" action for an entry in the call log. The listen
action is shown for call log entries representing a voicemail message and this button
triggers playing back the voicemail.
Note: AccessibilityServices uses this attribute to announce the purpose of the button.
[CHAR LIMIT=NONE] -->
- <string name="description_voicemail_action">Listen to voicemail from <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g></string>
+ <string name="description_voicemail_action">
+ Listen to voicemail from <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g>
+ </string>
+
+ <!-- Description for the "create new contact" action for an entry in the call log. This action
+ opens a screen for creating a new contact for this name or number. [CHAR LIMIT=NONE] -->
+ <string name="description_create_new_contact_action">
+ Create contact for <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g>
+ </string>
+
+ <!-- Description for the "add to existing contact" action for an entry in the call log. This
+ action opens a screen for adding this name or number to an existing contact.
+ [CHAR LIMIT=NONE] -->
+ <string name="description_add_to_existing_contact_action">
+ Add <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g> to existing contact
+ </string>
<!-- String describing the "details" action for an entry in the call log. The details action
displays the call details screen for an entry in the call log. This shows the calls to
and from the specified number associated with the call log entry.
[CHAR LIMIT=NONE] -->
- <string name="description_details_action">Call details for <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g></string>
+ <string name="description_details_action">
+ Call details for <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g>
+ </string>
+
+ <!-- Description for the "report" action for an entry in the call log. This action reports that
+ the phone number lookup performed for the entry was inaccurate. [CHAR LIMIT=NONE] -->
+ <string name="description_report_action">
+ Report <xliff:g id="nameOrNumber" example="John Smith">^1</xliff:g>
+ </string>
<!-- Toast message which appears when a call log entry is deleted.
[CHAR LIMIT=NONE] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index dacf6a4..dab5c6a 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -158,10 +158,18 @@
<item name="android:overScrollMode">always</item>
</style>
- <style name="CallLogActionsStyle">
+ <style name="CallLogActionStyle">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">@dimen/call_log_action_height</item>
- <item name="android:gravity">start|center_vertical</item>
+ <item name="android:background">@drawable/call_log_action_border</item>
+ <item name="android:foreground">?android:attr/selectableItemBackground</item>
+ <item name="android:orientation">horizontal</item>
+ <item name="android:gravity">center_vertical</item>
+ </style>
+
+ <style name="CallLogActionTextStyle">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
<item name="android:paddingStart">@dimen/call_log_action_horizontal_padding</item>
<item name="android:paddingEnd">@dimen/call_log_action_horizontal_padding</item>
<item name="android:textColor">?attr/call_log_secondary_text_color</item>
@@ -169,6 +177,15 @@
<item name="android:fontFamily">"sans-serif-medium"</item>
<item name="android:focusable">true</item>
<item name="android:singleLine">true</item>
+ <item name="android:importantForAccessibility">no</item>
+ </style>
+
+ <style name="CallLogActionIconStyle">
+ <item name="android:layout_width">@dimen/call_log_action_icon_dimen</item>
+ <item name="android:layout_height">@dimen/call_log_action_icon_dimen</item>
+ <item name="android:layout_marginStart">@dimen/call_log_action_icon_margin_start</item>
+ <item name="android:tint">?attr/call_log_secondary_text_color</item>
+ <item name="android:importantForAccessibility">no</item>
</style>
<style name="DismissButtonStyle">
@@ -198,7 +215,7 @@
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_margin">4dp</item>
<item name="android:baselineAligned">false</item>
- <item name="cardCornerRadius">4dp</item>
+ <item name="cardCornerRadius">2dp</item>
<item name="cardBackgroundColor">@color/background_dialer_call_log_list_item</item>
</style>
</resources>
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index dbcfa64..7a23944 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -55,6 +55,7 @@
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.CallUtil;
import com.android.dialer.calllog.CallDetailHistoryAdapter;
+import com.android.dialer.calllog.CallLogNotificationsService;
import com.android.dialer.calllog.CallTypeHelper;
import com.android.dialer.calllog.ContactInfo;
import com.android.dialer.calllog.ContactInfoHelper;
@@ -280,6 +281,9 @@
values.put(Voicemails.IS_READ, true);
getContentResolver().update(voicemailUri, values,
Voicemails.IS_READ + " = 0", null);
+ Intent intent = new Intent(getBaseContext(), CallLogNotificationsService.class);
+ intent.setAction(CallLogNotificationsService.ACTION_MARK_NEW_VOICEMAILS_AS_OLD);
+ getBaseContext().startService(intent);
return null;
}
});
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 167c131..cccc06e 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -165,6 +165,15 @@
*/
private Animation mSlideOut;
+ AnimationListenerAdapter mSlideInListener = new AnimationListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ if (!isInSearchUi()) {
+ enterSearchUi(true /* isSmartDial */, mSearchQuery, false);
+ }
+ }
+ };
+
/**
* Listener for after slide out animation completes on dialer fragment.
*/
@@ -198,11 +207,6 @@
private boolean mIsLandscape;
/**
- * The position of the currently selected tab in the attached {@link ListsFragment}.
- */
- private int mCurrentTabPosition = 0;
-
- /**
* True if the dialpad is only temporarily showing due to being in call
*/
private boolean mInCallDialpadUp;
@@ -298,7 +302,7 @@
final boolean sameSearchMode = (mIsDialpadShown && mInDialpadSearch) ||
(!mIsDialpadShown && mInRegularSearch);
if (!sameSearchMode) {
- enterSearchUi(mIsDialpadShown, mSearchQuery);
+ enterSearchUi(mIsDialpadShown, mSearchQuery, true /* animate */);
}
}
@@ -323,7 +327,8 @@
public void onClick(View v) {
if (!isInSearchUi()) {
mActionBarController.onSearchBoxTapped();
- enterSearchUi(false /* smartDialSearch */, mSearchView.getText().toString());
+ enterSearchUi(false /* smartDialSearch */, mSearchView.getText().toString(),
+ true /* animate */);
}
}
};
@@ -410,9 +415,8 @@
// Add the favorites fragment but only if savedInstanceState is null. Otherwise the
// fragment manager is responsible for recreating it.
if (savedInstanceState == null) {
- mListsFragment = new ListsFragment();
getFragmentManager().beginTransaction()
- .add(R.id.dialtacts_frame, mListsFragment, TAG_FAVORITES_FRAGMENT)
+ .add(R.id.dialtacts_frame, new ListsFragment(), TAG_FAVORITES_FRAGMENT)
.commit();
} else {
mSearchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY);
@@ -437,6 +441,7 @@
mSlideIn.setInterpolator(AnimUtils.EASE_IN);
mSlideOut.setInterpolator(AnimUtils.EASE_OUT);
+ mSlideIn.setAnimationListener(mSlideInListener);
mSlideOut.setAnimationListener(mSlideOutListener);
mParentLayout = (FrameLayout) findViewById(R.id.dialtacts_mainlayout);
@@ -581,7 +586,9 @@
public void onClick(View view) {
switch (view.getId()) {
case R.id.floating_action_button:
- if (!mIsDialpadShown) {
+ if (mListsFragment.getTabPosition() == ListsFragment.TAB_INDEX_ALL_CONTACTS) {
+ sendAddNewContactIntent();
+ } else if (!mIsDialpadShown) {
mInCallDialpadUp = false;
showDialpadFragment(true);
}
@@ -609,17 +616,13 @@
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_history:
- showCallHistory();
+ // Use explicit CallLogActivity intent instead of ACTION_VIEW +
+ // CONTENT_TYPE, so that we always open our call log from our dialer
+ final Intent intent = new Intent(this, CallLogActivity.class);
+ startActivity(intent);
break;
case R.id.menu_add_contact:
- try {
- startActivity(new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI));
- } catch (ActivityNotFoundException e) {
- Toast toast = Toast.makeText(this,
- R.string.add_contact_not_available,
- Toast.LENGTH_SHORT);
- toast.show();
- }
+ sendAddNewContactIntent();
break;
case R.id.menu_import_export:
// We hard-code the "contactsAreAvailable" argument because doing it properly would
@@ -690,9 +693,7 @@
}
mActionBarController.onDialpadUp();
- if (!isInSearchUi()) {
- enterSearchUi(true /* isSmartDial */, mSearchQuery);
- }
+ mListsFragment.getView().animate().alpha(0).withLayer();
}
/**
@@ -906,7 +907,7 @@
/**
* Shows the search fragment
*/
- private void enterSearchUi(boolean smartDialSearch, String query) {
+ private void enterSearchUi(boolean smartDialSearch, String query, boolean animate) {
if (mStateSaved || getFragmentManager().isDestroyed()) {
// Weird race condition where fragment is doing work after the activity is destroyed
// due to talkback being on (b/10209937). Just return since we can't do any
@@ -935,7 +936,11 @@
mInRegularSearch = !smartDialSearch;
SearchFragment fragment = (SearchFragment) getFragmentManager().findFragmentByTag(tag);
- transaction.setCustomAnimations(android.R.animator.fade_in, 0);
+ if (animate) {
+ transaction.setCustomAnimations(android.R.animator.fade_in, 0);
+ } else {
+ transaction.setTransition(FragmentTransaction.TRANSIT_NONE);
+ }
if (fragment == null) {
if (smartDialSearch) {
fragment = new SmartDialSearchFragment();
@@ -949,10 +954,14 @@
// DialtactsActivity will provide the options menu
fragment.setHasOptionsMenu(false);
fragment.setShowEmptyListForNullQuery(true);
- fragment.setQueryString(query, false /* delaySelection */);
+ if (!smartDialSearch) {
+ fragment.setQueryString(query, false /* delaySelection */);
+ }
transaction.commit();
- mListsFragment.getView().animate().alpha(0).withLayer();
+ if (animate) {
+ mListsFragment.getView().animate().alpha(0).withLayer();
+ }
mListsFragment.setUserVisibleHint(false);
}
@@ -1094,6 +1103,17 @@
return intent;
}
+ private void sendAddNewContactIntent() {
+ try {
+ startActivity(new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI));
+ } catch (ActivityNotFoundException e) {
+ Toast toast = Toast.makeText(this,
+ R.string.add_contact_not_available,
+ Toast.LENGTH_SHORT);
+ toast.show();
+ }
+ }
+
private boolean canIntentBeHandled(Intent intent) {
final PackageManager packageManager = getPackageManager();
final List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(intent,
@@ -1101,14 +1121,6 @@
return resolveInfo != null && resolveInfo.size() > 0;
}
- @Override
- public void showCallHistory() {
- // Use explicit CallLogActivity intent instead of ACTION_VIEW +
- // CONTENT_TYPE, so that we always open our call log from our dialer
- final Intent intent = new Intent(this, CallLogActivity.class);
- startActivity(intent);
- }
-
/**
* Called when the user has long-pressed a contact tile to start a drag operation.
*/
@@ -1194,22 +1206,26 @@
} else if (position != ListsFragment.TAB_INDEX_SPEED_DIAL) {
mFloatingActionButtonController.onPageScrolled(1);
}
+
+ if (position == ListsFragment.TAB_INDEX_ALL_CONTACTS) {
+ mFloatingActionButtonController.changeIcon(
+ getResources().getDrawable(R.drawable.ic_person_add_24dp),
+ getResources().getString(R.string.search_shortcut_create_new_contact));
+ } else {
+ mFloatingActionButtonController.changeIcon(
+ getResources().getDrawable(R.drawable.fab_ic_dial),
+ getResources().getString(R.string.action_menu_dialpad_button));
+ }
}
@Override
public void onPageSelected(int position) {
- position = mListsFragment.getRtlPosition(position);
- mCurrentTabPosition = position;
}
@Override
public void onPageScrollStateChanged(int state) {
}
- private TelephonyManager getTelephonyManager() {
- return (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
- }
-
private TelecomManager getTelecomManager() {
return (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
}
@@ -1249,7 +1265,8 @@
* @param animate Whether or not to animate the transition.
*/
private void updateFloatingActionButtonControllerAlignment(boolean animate) {
- int align = (!mIsLandscape && mCurrentTabPosition == ListsFragment.TAB_INDEX_SPEED_DIAL) ?
+ int align = (!mIsLandscape &&
+ mListsFragment.getTabPosition() == ListsFragment.TAB_INDEX_SPEED_DIAL) ?
FloatingActionButtonController.ALIGN_MIDDLE :
FloatingActionButtonController.ALIGN_END;
mFloatingActionButtonController.align(align, 0 /* offsetX */, 0 /* offsetY */, animate);
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index f2a84c9..ee83c2e 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -21,7 +21,6 @@
import android.content.res.Resources;
import android.database.Cursor;
import android.net.Uri;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.telecom.PhoneAccountHandle;
import android.telephony.PhoneNumberUtils;
@@ -78,6 +77,8 @@
public void onReportButtonClick(String number);
}
+ private static final int VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM = 10;
+
/** Constant used to indicate no row is expanded. */
private static final long NONE_EXPANDED = -1;
@@ -89,6 +90,8 @@
protected ContactInfoCache mContactInfoCache;
+ private boolean mShowCallHistoryListItem = false;
+
/**
* Tracks the currently expanded call log row.
*/
@@ -254,6 +257,9 @@
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ if (viewType == VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM) {
+ return ShowCallHistoryViewHolder.create(mContext, parent);
+ }
return createCallLogEntryViewHolder(parent);
}
@@ -287,6 +293,10 @@
* @param count the number of entries in the current item, greater than 1 if it is a group
*/
public void onBindViewHolder(ViewHolder viewHolder, int position) {
+ if (getItemViewType(position) == VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM) {
+ return;
+ }
+
Cursor c = (Cursor) getItem(position);
if (c == null) {
return;
@@ -370,7 +380,7 @@
final PhoneCallDetails details;
- views.reported = info.isBadData;
+ views.info = info;
// The entry can only be reported as invalid if it has a valid ID and the source of the
// entry supports marking entries as invalid.
@@ -403,7 +413,6 @@
views.setPhoto(photoId, photoUri, lookupUri, nameForDefaultImage, isVoicemailNumber,
mContactInfoHelper.isBusiness(info.sourceType));
- views.quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);
views.updateCallButton();
@@ -414,6 +423,23 @@
}
}
+ @Override
+ public int getItemCount() {
+ return super.getItemCount() + (mShowCallHistoryListItem ? 1 : 0);
+ }
+
+ @Override
+ public int getItemViewType(int position) {
+ if (position == getItemCount() - 1 && mShowCallHistoryListItem) {
+ return VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM;
+ }
+ return super.getItemViewType(position);
+ }
+
+ public void setShowCallHistoryListItem(boolean show) {
+ mShowCallHistoryListItem = show;
+ }
+
/**
* Retrieves the day group of the previous call in the call log. Used to determine if the day
* group has changed and to trigger display of the day group text.
@@ -603,7 +629,7 @@
private void handleRowExpanded(View view, boolean forceExpand) {
final CallLogListItemViewHolder views = (CallLogListItemViewHolder) view.getTag();
- if (forceExpand && isExpanded(views.rowId)) {
+ if (views == null || (forceExpand && isExpanded(views.rowId))) {
return;
}
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 4f4fc1b..85fca91 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -77,6 +77,11 @@
private static final String KEY_LOG_LIMIT = "log_limit";
private static final String KEY_DATE_LIMIT = "date_limit";
+ // No limit specified for the number of logs to show; use the CallLogQueryHandler's default.
+ private static final int NO_LOG_LIMIT = -1;
+ // No date-based filtering.
+ private static final int NO_DATE_LIMIT = 0;
+
private RecyclerView mRecyclerView;
private LinearLayoutManager mLayoutManager;
private CallLogAdapter mAdapter;
@@ -123,18 +128,18 @@
// Log limit - if no limit is specified, then the default in {@link CallLogQueryHandler}
// will be used.
- private int mLogLimit = -1;
+ private int mLogLimit = NO_LOG_LIMIT;
// Date limit (in millis since epoch) - when non-zero, only calls which occurred on or after
// the date filter are included. If zero, no date-based filtering occurs.
- private long mDateLimit = 0;
+ private long mDateLimit = NO_DATE_LIMIT;
public CallLogFragment() {
- this(CallLogQueryHandler.CALL_TYPE_ALL, -1);
+ this(CallLogQueryHandler.CALL_TYPE_ALL, NO_LOG_LIMIT);
}
public CallLogFragment(int filterType) {
- this(filterType, -1);
+ this(filterType, NO_LOG_LIMIT);
}
public CallLogFragment(int filterType, int logLimit) {
@@ -150,7 +155,7 @@
* @param dateLimit limits results to calls occurring on or after the specified date.
*/
public CallLogFragment(int filterType, long dateLimit) {
- this(filterType, -1, dateLimit);
+ this(filterType, NO_LOG_LIMIT, dateLimit);
}
/**
@@ -278,6 +283,9 @@
String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity());
mAdapter = ObjectFactory.newCallLogAdapter(getActivity(), this,
new ContactInfoHelper(getActivity(), currentCountryIso), this);
+ if (mLogLimit != NO_LOG_LIMIT || mDateLimit != NO_DATE_LIMIT) {
+ mAdapter.setShowCallHistoryListItem(true);
+ }
mRecyclerView.setAdapter(mAdapter);
mVoicemailStatusHelper = new VoicemailStatusHelperImpl();
diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java
index 0e94ef4..7ec6752 100644
--- a/src/com/android/dialer/calllog/CallLogListItemHelper.java
+++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java
@@ -99,9 +99,23 @@
TextUtils.expandTemplate(
mResources.getString(R.string.description_voicemail_action), nameOrNumber));
+ views.createNewContactButtonView.setContentDescription(
+ TextUtils.expandTemplate(
+ mResources.getString(R.string.description_create_new_contact_action),
+ nameOrNumber));
+
+ views.addToExistingContactButtonView.setContentDescription(
+ TextUtils.expandTemplate(
+ mResources.getString(R.string.description_add_to_existing_contact_action),
+ nameOrNumber));
+
views.detailsButtonView.setContentDescription(
TextUtils.expandTemplate(
mResources.getString(R.string.description_details_action), nameOrNumber));
+
+ views.reportButtonView.setContentDescription(
+ TextUtils.expandTemplate(
+ mResources.getString(R.string.description_report_action), nameOrNumber));
}
/**
diff --git a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
index 3652900..4fa6561 100644
--- a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
+++ b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
@@ -21,6 +21,7 @@
import android.content.Intent;
import android.net.Uri;
import android.provider.CallLog.Calls;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.telecom.PhoneAccountHandle;
@@ -36,6 +37,7 @@
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.testing.NeededForTesting;
+import com.android.contacts.common.util.UriUtils;
import com.android.dialer.PhoneCallDetailsHelper;
import com.android.dialer.PhoneCallDetailsViews;
import com.android.dialer.R;
@@ -62,16 +64,16 @@
public final CardView callLogEntryView;
/** The actionable view which places a call to the number corresponding to the call log row. */
public final View callActionView;
+
/** The view containing call log item actions. Null until the ViewStub is inflated. */
public View actionsView;
- /** The "video call" action button - assigned only when the action section is expanded. */
- public TextView videoCallButtonView;
- /** The "voicemail" action button - assigned only when the action section is expanded. */
- public TextView voicemailButtonView;
- /** The "details" action button - assigned only when the action section is expanded. */
- public TextView detailsButtonView;
- /** The "report" action button. */
- public TextView reportButtonView;
+ /** The button views below are assigned only when the action section is expanded. */
+ public View videoCallButtonView;
+ public View voicemailButtonView;
+ public View createNewContactButtonView;
+ public View addToExistingContactButtonView;
+ public View detailsButtonView;
+ public View reportButtonView;
/**
* The row Id for the first call associated with the call log entry. Used as a key for the
@@ -123,16 +125,16 @@
public CharSequence nameOrNumber;
/**
- * Whether or not the item has been reported by user as incorrect.
- */
- public boolean reported;
-
- /**
* Whether or not the contact info can be marked as invalid from the source where
* it was obtained.
*/
public boolean canBeReportedAsInvalid;
+ /**
+ * The contact info for the contact displayed in this list item.
+ */
+ public ContactInfo info;
+
private static final int VOICEMAIL_TRANSCRIPTION_MAX_LINES = 10;
private final Context mContext;
@@ -176,6 +178,8 @@
phoneCallDetailsViews.nameView.setElegantTextHeight(false);
phoneCallDetailsViews.callLocationAndDate.setElegantTextHeight(false);
+ quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);
+
if (callActionView != null) {
callActionView.setOnClickListener(mActionListener);
}
@@ -217,19 +221,33 @@
}
if (videoCallButtonView == null) {
- videoCallButtonView = (TextView) actionsView.findViewById(R.id.video_call_action);
+ videoCallButtonView = actionsView.findViewById(R.id.video_call_action);
+ videoCallButtonView.setOnClickListener(mActionListener);
}
if (voicemailButtonView == null) {
- voicemailButtonView = (TextView) actionsView.findViewById(R.id.voicemail_action);
+ voicemailButtonView = actionsView.findViewById(R.id.voicemail_action);
+ voicemailButtonView.setOnClickListener(mActionListener);
+ }
+
+ if (createNewContactButtonView == null) {
+ createNewContactButtonView = actionsView.findViewById(R.id.create_new_contact_action);
+ createNewContactButtonView.setOnClickListener(mActionListener);
+ }
+
+ if (addToExistingContactButtonView == null) {
+ addToExistingContactButtonView =
+ actionsView.findViewById(R.id.add_to_existing_contact_action);
+ addToExistingContactButtonView.setOnClickListener(mActionListener);
}
if (detailsButtonView == null) {
- detailsButtonView = (TextView) actionsView.findViewById(R.id.details_action);
+ detailsButtonView = actionsView.findViewById(R.id.details_action);
+ detailsButtonView.setOnClickListener(mActionListener);
}
if (reportButtonView == null) {
- reportButtonView = (TextView) actionsView.findViewById(R.id.report_action);
+ reportButtonView = actionsView.findViewById(R.id.report_action);
reportButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -287,7 +305,6 @@
phoneCallDetailsViews.callTypeIcons.isVideoShown()) {
videoCallButtonView.setTag(IntentProvider.getReturnVideoCallIntentProvider(number));
videoCallButtonView.setVisibility(View.VISIBLE);
- videoCallButtonView.setOnClickListener(mActionListener);
} else {
videoCallButtonView.setTag(null);
videoCallButtonView.setVisibility(View.GONE);
@@ -295,7 +312,6 @@
// For voicemail calls, show the "VOICEMAIL" action button; hide otherwise.
if (callType == Calls.VOICEMAIL_TYPE) {
- voicemailButtonView.setOnClickListener(mActionListener);
voicemailButtonView.setTag(
IntentProvider.getPlayVoicemailIntentProvider(rowId, voicemailUri));
voicemailButtonView.setVisibility(View.VISIBLE);
@@ -305,15 +321,27 @@
voicemailButtonView.setTag(null);
voicemailButtonView.setVisibility(View.GONE);
- detailsButtonView.setOnClickListener(mActionListener);
detailsButtonView.setTag(
IntentProvider.getCallDetailIntentProvider(rowId, callIds, null));
+ }
- if (canBeReportedAsInvalid && !reported) {
- reportButtonView.setVisibility(View.VISIBLE);
- } else {
- reportButtonView.setVisibility(View.GONE);
- }
+ if (canBeReportedAsInvalid && !info.isBadData) {
+ reportButtonView.setVisibility(View.VISIBLE);
+ } else {
+ reportButtonView.setVisibility(View.GONE);
+ }
+
+ if (UriUtils.isEncodedContactUri(info.lookupUri)) {
+ createNewContactButtonView.setTag(IntentProvider.getAddContactIntentProvider(
+ info.lookupUri, info.name, info.number, info.type, true /* isNewContact */));
+ createNewContactButtonView.setVisibility(View.VISIBLE);
+
+ addToExistingContactButtonView.setTag(IntentProvider.getAddContactIntentProvider(
+ info.lookupUri, info.name, info.number, info.type, false /* isNewContact */));
+ addToExistingContactButtonView.setVisibility(View.VISIBLE);
+ } else {
+ createNewContactButtonView.setVisibility(View.GONE);
+ addToExistingContactButtonView.setVisibility(View.GONE);
}
mCallLogListItemHelper.setActionContentDescriptions(this);
@@ -341,29 +369,6 @@
actionsView.setVisibility(View.GONE);
}
}
-
- if (actionsView != null) {
- final ViewTreeObserver observer = callLogEntryView.getViewTreeObserver();
- observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
- @Override
- public boolean onPreDraw() {
- ViewTreeObserver vto = observer;
- if (!vto.isAlive()) {
- vto = actionsView.getViewTreeObserver();
- }
- vto.removeOnPreDrawListener(this);
-
- // TODO: Animate, instead of immediately resizing.
- int currentHeight = primaryActionView.getHeight();
- int actionsHeight = actionsView.getVisibility() == View.VISIBLE
- ? actionsView.getHeight() : 0;
- callLogEntryView.getLayoutParams().height = currentHeight + actionsHeight;
- callLogEntryView.requestLayout();
-
- return false;
- }
- });
- }
}
public void expandVoicemailTranscriptionView(boolean isExpanded) {
diff --git a/src/com/android/dialer/calllog/CallLogNotificationsService.java b/src/com/android/dialer/calllog/CallLogNotificationsService.java
index ccd9335..2e0e502 100644
--- a/src/com/android/dialer/calllog/CallLogNotificationsService.java
+++ b/src/com/android/dialer/calllog/CallLogNotificationsService.java
@@ -56,7 +56,7 @@
*/
public static final String EXTRA_NEW_VOICEMAIL_URI = "NEW_VOICEMAIL_URI";
- private CallLogQueryHandler mCallLogQueryHandler;
+ private VoicemailQueryHandler mVoicemailQueryHandler;
public CallLogNotificationsService() {
super("CallLogNotificationsService");
@@ -65,7 +65,7 @@
@Override
public void onCreate() {
super.onCreate();
- mCallLogQueryHandler = new CallLogQueryHandler(getContentResolver(), null /*listener*/);
+ mVoicemailQueryHandler = new VoicemailQueryHandler(this, getContentResolver());
}
@Override
@@ -74,8 +74,9 @@
Log.d(TAG, "onHandleIntent: could not handle null intent");
return;
}
+
if (ACTION_MARK_NEW_VOICEMAILS_AS_OLD.equals(intent.getAction())) {
- mCallLogQueryHandler.markNewVoicemailsAsOld();
+ mVoicemailQueryHandler.markNewVoicemailsAsOld();
} else if (ACTION_UPDATE_NOTIFICATIONS.equals(intent.getAction())) {
Uri voicemailUri = (Uri) intent.getParcelableExtra(EXTRA_NEW_VOICEMAIL_URI);
DefaultVoicemailNotifier.getInstance(this).updateNotification(voicemailUri);
diff --git a/src/com/android/dialer/calllog/CallLogQueryHandler.java b/src/com/android/dialer/calllog/CallLogQueryHandler.java
index 761c8e0..7eb5f8a 100644
--- a/src/com/android/dialer/calllog/CallLogQueryHandler.java
+++ b/src/com/android/dialer/calllog/CallLogQueryHandler.java
@@ -20,8 +20,6 @@
import android.content.ContentResolver;
import android.content.ContentValues;
import android.database.Cursor;
-import android.database.MatrixCursor;
-import android.database.MergeCursor;
import android.database.sqlite.SQLiteDatabaseCorruptException;
import android.database.sqlite.SQLiteDiskIOException;
import android.database.sqlite.SQLiteException;
@@ -35,7 +33,6 @@
import android.provider.VoicemailContract.Voicemails;
import android.util.Log;
-import com.android.common.io.MoreCloseables;
import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler;
import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
@@ -55,12 +52,10 @@
private static final int QUERY_CALLLOG_TOKEN = 54;
/** The token for the query to mark all missed calls as old after seeing the call log. */
private static final int UPDATE_MARK_AS_OLD_TOKEN = 55;
- /** The token for the query to mark all new voicemails as old. */
- private static final int UPDATE_MARK_VOICEMAILS_AS_OLD_TOKEN = 56;
/** The token for the query to mark all missed calls as read after seeing the call log. */
- private static final int UPDATE_MARK_MISSED_CALL_AS_READ_TOKEN = 57;
+ private static final int UPDATE_MARK_MISSED_CALL_AS_READ_TOKEN = 56;
/** The token for the query to fetch voicemail status messages. */
- private static final int QUERY_VOICEMAIL_STATUS_TOKEN = 58;
+ private static final int QUERY_VOICEMAIL_STATUS_TOKEN = 57;
private final int mLogLimit;
@@ -195,22 +190,6 @@
values, where.toString(), null);
}
- /** Updates all new voicemails to mark them as old. */
- public void markNewVoicemailsAsOld() {
- // Mark all "new" voicemails as not new anymore.
- StringBuilder where = new StringBuilder();
- where.append(Calls.NEW);
- where.append(" = 1 AND ");
- where.append(Calls.TYPE);
- where.append(" = ?");
-
- ContentValues values = new ContentValues(1);
- values.put(Calls.NEW, "0");
-
- startUpdate(UPDATE_MARK_VOICEMAILS_AS_OLD_TOKEN, null, Calls.CONTENT_URI_WITH_VOICEMAIL,
- values, where.toString(), new String[]{ Integer.toString(Calls.VOICEMAIL_TYPE) });
- }
-
/** Updates all missed calls to mark them as read. */
public void markMissedCallsAsRead() {
// Mark all "new" calls as not new anymore.
@@ -227,7 +206,8 @@
}
@Override
- protected synchronized void onNotNullableQueryComplete(int token, Object cookie, Cursor cursor) {
+ protected synchronized void onNotNullableQueryComplete(int token, Object cookie,
+ Cursor cursor) {
if (cursor == null) {
return;
}
@@ -274,7 +254,7 @@
void onVoicemailStatusFetched(Cursor statusCursor);
/**
- * Called when {@link CallLogQueryHandler#fetchCalls(int)}complete.
+ * Called when {@link CallLogQueryHandler#fetchCalls(int)} complete.
* Returns true if takes ownership of cursor.
*/
boolean onCallsFetched(Cursor combinedCursor);
diff --git a/src/com/android/dialer/calllog/CallTypeIconsView.java b/src/com/android/dialer/calllog/CallTypeIconsView.java
index ef729ae..31d4f4b 100644
--- a/src/com/android/dialer/calllog/CallTypeIconsView.java
+++ b/src/com/android/dialer/calllog/CallTypeIconsView.java
@@ -208,7 +208,7 @@
// We want the video call icon to be the same height as the call arrows, while keeping
// the same width aspect ratio.
Bitmap videoIcon = BitmapFactory.decodeResource(context.getResources(),
- R.drawable.ic_videocam_wht_24dp);
+ R.drawable.ic_videocam_24dp);
int scaledHeight = missed.getIntrinsicHeight();
int scaledWidth = (int) ((float) videoIcon.getWidth() *
((float) missed.getIntrinsicHeight() /
diff --git a/src/com/android/dialer/calllog/IntentProvider.java b/src/com/android/dialer/calllog/IntentProvider.java
index 73c7e82..4be2d1c 100644
--- a/src/com/android/dialer/calllog/IntentProvider.java
+++ b/src/com/android/dialer/calllog/IntentProvider.java
@@ -135,26 +135,33 @@
/**
* Retrieves an add contact intent for the given contact and phone call details.
- *
- * @param info The contact info.
- * @param details The phone call details.
*/
public static IntentProvider getAddContactIntentProvider(
- final ContactInfo info, final PhoneCallDetails details) {
+ final Uri lookupUri,
+ final CharSequence name,
+ final CharSequence number,
+ final int numberType,
+ final boolean isNewContact) {
return new IntentProvider() {
@Override
public Intent getIntent(Context context) {
Contact contactToSave = null;
- if (info.lookupUri != null) {
- contactToSave = ContactLoader.parseEncodedContactEntity(info.lookupUri);
+ if (lookupUri != null) {
+ contactToSave = ContactLoader.parseEncodedContactEntity(lookupUri);
}
if (contactToSave != null) {
// Populate the intent with contact information stored in the lookup URI.
// Note: This code mirrors code in Contacts/QuickContactsActivity.
- final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
- intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
+ final Intent intent;
+ if (isNewContact) {
+ intent = new Intent(
+ Intent.ACTION_INSERT, ContactsContract.Contacts.CONTENT_URI);
+ } else {
+ intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
+ intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
+ }
ArrayList<ContentValues> values = contactToSave.getContentValues();
// Only pre-fill the name field if the provided display name is an nickname
@@ -189,9 +196,16 @@
return intent;
} else {
// If no lookup uri is provided, rely on the available phone number and name.
- return DialtactsActivity.getAddToContactIntent(details.name,
- details.number,
- details.numberType);
+ if (isNewContact) {
+ return DialtactsActivity.getAddToContactIntent(name, number, numberType);
+ } else {
+ Intent intent = new Intent(
+ Intent.ACTION_INSERT, ContactsContract.Contacts.CONTENT_URI);
+ intent.putExtra(ContactsContract.Intents.Insert.NAME, name);
+ intent.putExtra(ContactsContract.Intents.Insert.PHONE, number);
+ intent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, numberType);
+ return intent;
+ }
}
}
};
diff --git a/src/com/android/dialer/calllog/ShowCallHistoryViewHolder.java b/src/com/android/dialer/calllog/ShowCallHistoryViewHolder.java
new file mode 100644
index 0000000..af36a4d
--- /dev/null
+++ b/src/com/android/dialer/calllog/ShowCallHistoryViewHolder.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 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.calllog;
+
+import android.content.Context;
+import android.content.Intent;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.android.dialer.R;
+
+public final class ShowCallHistoryViewHolder extends RecyclerView.ViewHolder {
+
+ private ShowCallHistoryViewHolder(final Context context, View view) {
+ super(view);
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ final Intent intent = new Intent(context, CallLogActivity.class);
+ context.startActivity(intent);
+ }
+ });
+ }
+
+ public static ShowCallHistoryViewHolder create(Context context, ViewGroup parent) {
+ LayoutInflater inflater = LayoutInflater.from(context);
+ View view = inflater.inflate(R.layout.show_call_history_list_item, parent, false);
+ return new ShowCallHistoryViewHolder(context, view);
+ }
+}
diff --git a/src/com/android/dialer/calllog/VoicemailQueryHandler.java b/src/com/android/dialer/calllog/VoicemailQueryHandler.java
new file mode 100644
index 0000000..26f9bd1
--- /dev/null
+++ b/src/com/android/dialer/calllog/VoicemailQueryHandler.java
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+package com.android.dialer.calllog;
+
+import android.content.AsyncQueryHandler;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Intent;
+import android.provider.CallLog.Calls;
+import android.util.Log;
+
+/**
+ * Handles asynchronous queries to the call log for voicemail.
+ */
+public class VoicemailQueryHandler extends AsyncQueryHandler {
+ private static final String TAG = "VoicemailQueryHandler";
+
+ /** The token for the query to mark all new voicemails as old. */
+ private static final int UPDATE_MARK_VOICEMAILS_AS_OLD_TOKEN = 50;
+ private Context mContext;
+
+ public VoicemailQueryHandler(Context context, ContentResolver contentResolver) {
+ super(contentResolver);
+ mContext = context;
+ }
+
+ /** Updates all new voicemails to mark them as old. */
+ public void markNewVoicemailsAsOld() {
+ // Mark all "new" voicemails as not new anymore.
+ StringBuilder where = new StringBuilder();
+ where.append(Calls.NEW);
+ where.append(" = 1 AND ");
+ where.append(Calls.TYPE);
+ where.append(" = ?");
+
+ ContentValues values = new ContentValues(1);
+ values.put(Calls.NEW, "0");
+
+ startUpdate(UPDATE_MARK_VOICEMAILS_AS_OLD_TOKEN, null, Calls.CONTENT_URI_WITH_VOICEMAIL,
+ values, where.toString(), new String[]{ Integer.toString(Calls.VOICEMAIL_TYPE) });
+ }
+
+ @Override
+ protected void onUpdateComplete(int token, Object cookie, int result) {
+ if (token == UPDATE_MARK_VOICEMAILS_AS_OLD_TOKEN) {
+ if (mContext != null) {
+ Intent serviceIntent = new Intent(mContext, CallLogNotificationsService.class);
+ serviceIntent.setAction(CallLogNotificationsService.ACTION_UPDATE_NOTIFICATIONS);
+ mContext.startService(serviceIntent);
+ } else {
+ Log.w(TAG, "Unknown update completed: ignoring: " + token);
+ }
+ }
+ }
+}
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index d8b507e..6a66eb3 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -399,7 +399,7 @@
final View floatingActionButtonContainer =
fragmentView.findViewById(R.id.dialpad_floating_action_button_container);
- final View floatingActionButton =
+ final ImageButton floatingActionButton =
(ImageButton) fragmentView.findViewById(R.id.dialpad_floating_action_button);
floatingActionButton.setOnClickListener(this);
mFloatingActionButtonController = new FloatingActionButtonController(getActivity(),
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java
index f22a5d1..6e30af2 100644
--- a/src/com/android/dialer/list/ListsFragment.java
+++ b/src/com/android/dialer/list/ListsFragment.java
@@ -60,7 +60,6 @@
"key_last_dismissed_call_shortcut_date";
public interface HostInterface {
- public void showCallHistory();
public ActionBarController getActionBarController();
}
@@ -80,6 +79,11 @@
private int[] mTabIcons;
/**
+ * The position of the currently selected tab.
+ */
+ private int mTabPosition = TAB_INDEX_SPEED_DIAL;
+
+ /**
* Call shortcuts older than this date (persisted in shared preferences) will not show up in
* at the top of the screen
*/
@@ -226,6 +230,8 @@
@Override
public void onPageSelected(int position) {
+ mTabPosition = getRtlPosition(position);
+
final int count = mOnPageChangeListeners.size();
for (int i = 0; i < count; i++) {
mOnPageChangeListeners.get(i).onPageSelected(position);
@@ -241,6 +247,10 @@
}
}
+ public int getTabPosition() {
+ return mTabPosition;
+ }
+
public void showRemoveView(boolean show) {
mRemoveViewContent.setVisibility(show ? View.VISIBLE : View.GONE);
mRemoveView.setAlpha(show ? 0 : 1);
diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java
index 3c55bc0..6c70458 100644
--- a/src/com/android/dialer/list/RegularSearchListAdapter.java
+++ b/src/com/android/dialer/list/RegularSearchListAdapter.java
@@ -68,7 +68,9 @@
@Override
public void setQueryString(String queryString) {
- final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString());
+ // Don't show actions if the query string contains a letter.
+ final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString())
+ && hasDigitsInQueryString();
boolean changed = false;
changed |= setShortcutEnabled(SHORTCUT_DIRECT_CALL, showNumberShortcuts);
changed |= setShortcutEnabled(SHORTCUT_SEND_SMS_MESSAGE, showNumberShortcuts);
@@ -79,4 +81,18 @@
}
super.setQueryString(queryString);
}
+
+ /**
+ * Whether there is at least one digit in the query string.
+ */
+ private boolean hasDigitsInQueryString() {
+ String queryString = getQueryString();
+ int length = queryString.length();
+ for (int i = 0; i < length; i++) {
+ if (Character.isDigit(queryString.charAt(i))) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java
index b84d8ab..d54053b 100644
--- a/src/com/android/dialer/settings/DialerSettingsActivity.java
+++ b/src/com/android/dialer/settings/DialerSettingsActivity.java
@@ -77,16 +77,16 @@
phoneAccountSettingsHeader.intent = phoneAccountSettingsIntent;
target.add(phoneAccountSettingsHeader);
}
- }
- if (telephonyManager.isTtyModeSupported()
- || telephonyManager.isHearingAidCompatibilitySupported()) {
- Header accessibilitySettingsHeader = new Header();
- Intent accessibilitySettingsIntent =
- new Intent(TelecomManager.ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS);
- accessibilitySettingsHeader.titleRes = R.string.accessibility_settings_title;
- accessibilitySettingsHeader.intent = accessibilitySettingsIntent;
- target.add(accessibilitySettingsHeader);
+ if (telephonyManager.isTtyModeSupported()
+ || telephonyManager.isHearingAidCompatibilitySupported()) {
+ Header accessibilitySettingsHeader = new Header();
+ Intent accessibilitySettingsIntent =
+ new Intent(TelecomManager.ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS);
+ accessibilitySettingsHeader.titleRes = R.string.accessibility_settings_title;
+ accessibilitySettingsHeader.intent = accessibilitySettingsIntent;
+ target.add(accessibilitySettingsHeader);
+ }
}
}
diff --git a/src/com/android/dialer/widget/SearchEditTextLayout.java b/src/com/android/dialer/widget/SearchEditTextLayout.java
index f22a3be..f1fa986 100644
--- a/src/com/android/dialer/widget/SearchEditTextLayout.java
+++ b/src/com/android/dialer/widget/SearchEditTextLayout.java
@@ -20,6 +20,9 @@
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.util.AttributeSet;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
@@ -123,6 +126,21 @@
}
});
+ mSearchView.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ mClearButtonView.setVisibility(TextUtils.isEmpty(s) ? View.GONE : View.VISIBLE);
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ }
+ });
+
findViewById(R.id.search_close_button).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -177,6 +195,7 @@
mIsFadedOut = true;
}
}
+
public void expand(boolean animate, boolean requestFocus) {
updateVisibility(true /* isExpand */);
@@ -245,7 +264,11 @@
// TODO: Prevents keyboard from jumping up in landscape mode after exiting the
// SearchFragment when the query string is empty. More elegant fix?
//mExpandedSearchBox.setVisibility(expandedViewVisibility);
- mClearButtonView.setVisibility(expandedViewVisibility);
+ if (TextUtils.isEmpty(mSearchView.getText())) {
+ mClearButtonView.setVisibility(View.GONE);
+ } else {
+ mClearButtonView.setVisibility(expandedViewVisibility);
+ }
}
private void prepareAnimator(final boolean expand) {