summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/layout/call_detail.xml237
-rw-r--r--res/layout/call_detail_history_header.xml52
-rw-r--r--res/layout/call_detail_history_item.xml11
-rw-r--r--res/layout/call_log_list_item.xml4
-rw-r--r--res/layout/playback_layout.xml8
-rw-r--r--res/values/colors.xml2
-rw-r--r--res/values/dimens.xml10
-rw-r--r--res/values/strings.xml37
-rw-r--r--src/com/android/dialer/BackScrollManager.java89
-rw-r--r--src/com/android/dialer/CallDetailActivity.java443
-rw-r--r--src/com/android/dialer/calllog/CallDetailHistoryAdapter.java31
-rw-r--r--src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java6
-rw-r--r--tests/src/com/android/dialer/CallDetailActivityTest.java1
13 files changed, 213 insertions, 718 deletions
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index 53f6b8ddb..9ca30a898 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -13,35 +13,68 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:ex="http://schemas.android.com/apk/res-auto"
- android:id="@+id/call_detail"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="gone"
->
- <!--
- The list view is under everything.
- It contains a first header element which is hidden under the controls UI.
- When scrolling, the controls move up until the name bar hits the top.
- -->
- <ListView
- android:id="@+id/history"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_alignParentTop="true"
- />
+ android:layout_height="match_parent">
- <!-- All the controls which are part of the pinned header are in this layout. -->
- <RelativeLayout
- android:id="@+id/controls"
+ <LinearLayout
+ android:id="@+id/call_detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:background="@color/background_dialer_list_items"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
>
+ <!-- Caller information "card" -->
+ <LinearLayout
+ android:id="@+id/caller_information"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingStart="@dimen/call_detail_horizontal_margin"
+ android:paddingTop="@dimen/call_detail_top_margin"
+ android:paddingBottom="@dimen/call_detail_bottom_margin"
+ android:baselineAligned="false"
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:translationZ="@dimen/call_detail_translation_z"
+ android:focusable="true"
+ android:background="@color/background_dialer_white">
+
+ <QuickContactBadge
+ android:id="@+id/quick_contact_photo"
+ android:layout_width="@dimen/contact_photo_size"
+ android:layout_height="@dimen/contact_photo_size"
+ android:layout_alignParentStart="true"
+ android:focusable="true"
+ />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:gravity="center_vertical"
+ android:layout_marginStart="@dimen/call_detail_horizontal_margin"
+ >
+ <TextView
+ android:id="@+id/caller_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="?attr/call_log_primary_text_color"
+ android:textSize="@dimen/call_log_primary_text_size"
+ android:singleLine="true"
+ />
+ <TextView
+ android:id="@+id/caller_number"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="@dimen/call_log_secondary_text_size"
+ android:singleLine="true"
+ />
+ </LinearLayout>
+ </LinearLayout>
+
<FrameLayout
android:id="@+id/voicemail_status"
android:layout_width="match_parent"
@@ -49,157 +82,33 @@
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:visibility="gone"
- >
+ >
<include layout="@layout/call_log_voicemail_status"/>
</FrameLayout>
-
- <view
- class="com.android.contacts.common.widget.ProportionalLayout"
- android:id="@+id/contact_background_sizer"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_below="@id/voicemail_status"
- ex:ratio="0.5"
- ex:direction="widthToHeight"
- >
- <ImageView
- android:id="@+id/contact_background"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:adjustViewBounds="true"
- android:scaleType="centerCrop"
- />
- </view>
-
- <LinearLayout
- android:id="@+id/separator"
- android:layout_width="match_parent"
- android:layout_height="1dip"
- android:background="@color/background_dialer_light"
- android:layout_below="@+id/contact_background_sizer"
- />
- <View
- android:id="@+id/photo_text_bar"
- android:layout_width="match_parent"
- android:layout_height="42dip"
- android:background="#7F000000"
- android:layout_alignParentStart="true"
- android:layout_alignBottom="@id/contact_background_sizer"
- />
- <ImageView
- android:id="@+id/main_action"
- android:layout_width="wrap_content"
- android:layout_height="0dip"
- android:scaleType="center"
- android:layout_alignEnd="@id/photo_text_bar"
- android:layout_alignBottom="@id/photo_text_bar"
- android:layout_alignTop="@id/photo_text_bar"
- android:layout_marginEnd="@dimen/call_log_outer_margin"
- />
- <TextView
- android:id="@+id/header_text"
- android:layout_width="wrap_content"
- android:layout_height="0dip"
- android:layout_alignStart="@id/photo_text_bar"
- android:layout_toLeftOf="@id/main_action"
- android:layout_alignTop="@id/photo_text_bar"
- android:layout_alignBottom="@id/photo_text_bar"
- android:layout_marginEnd="@dimen/call_log_inner_margin"
- android:layout_marginStart="@dimen/call_detail_contact_name_margin"
- android:gravity="center_vertical"
- android:textColor="?attr/call_log_header_color"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:singleLine="true"
- />
- <ImageButton
- android:id="@+id/main_action_push_layer"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignStart="@id/contact_background_sizer"
- android:layout_alignTop="@id/contact_background_sizer"
- android:layout_alignEnd="@id/contact_background_sizer"
- android:layout_alignBottom="@id/contact_background_sizer"
- android:background="?android:attr/selectableItemBackground"
- />
<LinearLayout
android:id="@+id/voicemail_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/separator"
- android:paddingBottom="@dimen/call_detail_button_spacing">
+ android:orientation="horizontal"
+ android:paddingBottom="@dimen/call_detail_button_spacing"
+ android:visibility="gone"
+ >
<!-- The voicemail fragment will be put here. -->
</LinearLayout>
- <FrameLayout
- android:id="@+id/call_and_sms"
- android:layout_width="match_parent"
- android:layout_height="@dimen/call_log_list_item_height"
- android:layout_marginBottom="@dimen/call_detail_button_spacing"
- android:layout_below="@id/voicemail_container"
- android:gravity="center_vertical"
- android:background="@color/background_dialer_list_items"
- >
-
- <LinearLayout
- android:id="@+id/call_and_sms_main_action"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:focusable="true"
- android:background="?android:attr/selectableItemBackground"
- >
-
- <LinearLayout
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:paddingStart="@dimen/call_log_indent_margin"
- android:orientation="vertical"
- android:gravity="center_vertical"
- >
-
- <TextView android:id="@+id/call_and_sms_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingEnd="@dimen/call_log_icon_margin"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?attr/call_log_primary_text_color"
- android:singleLine="true"
- android:ellipsize="end"
- />
- <TextView android:id="@+id/call_and_sms_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingEnd="@dimen/call_log_icon_margin"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?attr/call_log_primary_text_color"
- android:textAllCaps="true"
- android:singleLine="true"
- android:ellipsize="end"
- />
- </LinearLayout>
+ <!--
+ The list view is under everything.
+ It contains a first header element which is hidden under the controls UI.
+ When scrolling, the controls move up until the name bar hits the top.
+ -->
+ <ListView
+ android:id="@+id/history"
+ android:layout_width="match_parent"
+ android:layout_height="fill_parent"
+ />
- <View android:id="@+id/call_and_sms_divider"
- android:layout_width="1px"
- android:layout_height="32dip"
- android:background="@color/background_dialer_light"
- android:layout_gravity="center_vertical"
- />
- <ImageView android:id="@+id/call_and_sms_icon"
- android:layout_width="@color/call_log_voicemail_highlight_color"
- android:layout_height="match_parent"
- android:paddingStart="@dimen/call_log_inner_margin"
- android:paddingEnd="@dimen/call_log_outer_margin"
- android:gravity="center"
- android:scaleType="centerInside"
- android:focusable="true"
- android:background="?android:attr/selectableItemBackground"
- />
- </LinearLayout>
- </FrameLayout>
- </RelativeLayout>
+ </LinearLayout>
<!--
Used to hide the UI when playing a voicemail and the proximity sensor
is detecting something near the screen.
@@ -208,10 +117,10 @@
android:id="@+id/blank"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_alignParentStart="true"
- android:layout_alignParentTop="true"
android:background="@android:color/black"
android:visibility="gone"
android:clickable="true"
- />
+ android:layout_alignParentStart="true"
+ android:layout_alignParentTop="true"
+ />
</RelativeLayout>
diff --git a/res/layout/call_detail_history_header.xml b/res/layout/call_detail_history_header.xml
index 40f943b1e..b4b63fb35 100644
--- a/res/layout/call_detail_history_header.xml
+++ b/res/layout/call_detail_history_header.xml
@@ -14,48 +14,16 @@
limitations under the License.
-->
-<!-- This layout is supposed to match the content of the controls in call_detail.xml -->
-<LinearLayout
+<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ex="http://schemas.android.com/apk/res-auto"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <!-- Contact photo. -->
- <view
- class="com.android.contacts.common.widget.ProportionalLayout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_below="@id/voicemail_status"
- ex:ratio="0.5"
- ex:direction="widthToHeight"
- >
- <!-- Proportional layout requires a view in it. -->
- <View
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- />
- </view>
- <!-- Separator line -->
- <View
- android:layout_width="match_parent"
- android:layout_height="1dip"
- />
- <!-- Voicemail controls -->
- <!-- TODO: Make the height be based on a constant. -->
- <View
- android:id="@+id/header_voicemail_container"
- android:layout_width="match_parent"
- android:layout_height="140dip"
- android:layout_marginBottom="@dimen/call_detail_button_spacing"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/call_detail_header_top_margin"
+ android:paddingStart="@dimen/call_detail_horizontal_margin"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="@dimen/call_log_secondary_text_size"
+ android:fontFamily="sans-serif-medium"
+ android:singleLine="true"
+ android:text="@string/call_detail_list_header"
/>
- <!-- Call and SMS -->
- <View
- android:id="@+id/header_call_and_sms_container"
- android:layout_width="match_parent"
- android:layout_height="@dimen/call_log_list_item_height"
- />
-
-</LinearLayout>
diff --git a/res/layout/call_detail_history_item.xml b/res/layout/call_detail_history_item.xml
index 5b3fff712..cc06d2151 100644
--- a/res/layout/call_detail_history_item.xml
+++ b/res/layout/call_detail_history_item.xml
@@ -18,10 +18,9 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:minHeight="@dimen/call_log_list_item_height"
android:paddingTop="@dimen/call_log_inner_margin"
android:paddingBottom="@dimen/call_log_inner_margin"
- android:paddingStart="@dimen/call_log_indent_margin"
+ android:paddingStart="@dimen/call_detail_horizontal_margin"
android:paddingEnd="@dimen/call_log_outer_margin"
android:orientation="vertical"
android:background="@color/background_dialer_list_items"
@@ -43,22 +42,22 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/call_log_icon_margin"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?attr/call_log_secondary_text_color"
+ android:textColor="?attr/call_log_primary_text_color"
+ android:textSize="@dimen/call_log_primary_text_size"
/>
</LinearLayout>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="@dimen/call_log_secondary_text_size"
/>
<TextView
android:id="@+id/duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="@dimen/call_log_secondary_text_size"
/>
</LinearLayout>
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 411af70e7..3748967f6 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -64,8 +64,8 @@
android:nextFocusLeft="@+id/quick_contact_photo" >
<QuickContactBadge
android:id="@+id/quick_contact_photo"
- android:layout_width="@dimen/call_log_list_contact_photo_size"
- android:layout_height="@dimen/call_log_list_contact_photo_size"
+ android:layout_width="@dimen/contact_photo_size"
+ android:layout_height="@dimen/contact_photo_size"
android:nextFocusRight="@id/primary_action_view"
android:layout_alignParentStart="true"
android:focusable="true"
diff --git a/res/layout/playback_layout.xml b/res/layout/playback_layout.xml
index 01ed2e919..aa3ab4788 100644
--- a/res/layout/playback_layout.xml
+++ b/res/layout/playback_layout.xml
@@ -18,7 +18,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/background_dialer_light"
+ android:background="@color/background_dialer_list_items"
>
<!-- Mute, playback, trash buttons. -->
<LinearLayout
@@ -33,7 +33,6 @@
android:layout_height="58dip"
android:layout_marginEnd="@dimen/call_detail_button_spacing"
android:layout_weight="1"
- android:background="@color/background_dialer_list_items"
>
<ImageButton
android:id="@+id/playback_start_stop"
@@ -41,6 +40,7 @@
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_hold_pause"
+ android:contentDescription="@string/voicemail_play_start_pause"
/>
</LinearLayout>
<LinearLayout
@@ -64,7 +64,6 @@
android:layout_height="80dip"
android:layout_below="@id/buttons_linear_layout"
android:layout_marginTop="@dimen/call_detail_button_spacing"
- android:background="@color/background_dialer_list_items"
>
<!-- SeekBar left-right margin decreased from redlines 72dip by 8dip to account for
half thumb width (thumb is 16dip).
@@ -117,6 +116,7 @@
android:paddingTop="29dip"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
+ android:contentDescription="@string/voicemail_play_slower"
/>
<ImageButton
android:id="@+id/rate_increase_button"
@@ -128,11 +128,11 @@
android:paddingTop="29dip"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
+ android:contentDescription="@string/voicemail_play_faster"
/>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
- android:background="@color/background_dialer_light"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 2031f0f74..771d187f6 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -39,6 +39,8 @@
<!-- Standard color for selected items. -->
<color name="item_selected">#660099cc</color>
+ <!-- White background for dialer -->
+ <color name="background_dialer_white">#ffffff</color>
<!-- Background color of new dialer activity -->
<color name="background_dialer_light">#fbfbfb</color>
<!-- Background color of dialer list items (contacts, call log entries) -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 5cf216c7e..4a6ec836e 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -31,9 +31,15 @@
<dimen name="call_log_indent_margin">24dip</dimen>
<dimen name="call_log_name_margin_bottom">2dp</dimen>
<dimen name="call_log_list_item_height">56dip</dimen>
- <dimen name="call_log_list_contact_photo_size">40dip</dimen>
- <dimen name="call_detail_contact_name_margin">24dip</dimen>
+
+ <!-- Size of contact photos in the call log and call details. -->
+ <dimen name="contact_photo_size">40dp</dimen>
<dimen name="call_detail_button_spacing">2dip</dimen>
+ <dimen name="call_detail_horizontal_margin">16dp</dimen>
+ <dimen name="call_detail_top_margin">36dp</dimen>
+ <dimen name="call_detail_bottom_margin">32dp</dimen>
+ <dimen name="call_detail_header_top_margin">24dp</dimen>
+ <dimen name="call_detail_translation_z">0.5dp</dimen>
<!-- Match call_button_height to Phone's dimens/in_call_end_button_height -->
<dimen name="call_button_height">74dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8f083c885..5c7eb68ee 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -694,4 +694,41 @@
<!-- String used as a header in the call log above calls which ocurred more than a week ago.
[CHAR LIMIT=65] -->
<string name="call_log_header_other">Other</string>
+
+ <!-- String a header on the call details screen. Appears above the list calls to or from a
+ particular number.
+ [CHAR LIMIT=65] -->
+ <string name="call_detail_list_header">Call List</string>
+
+ <!-- String describing the "speaker on" button on the playback control used to listen to a
+ voicemail message. When speaker is on, playback of the voicemail will occur through the
+ phone speaker.
+ Note: AccessibilityServices uses this attribute to announce the purpose of the button.
+ [CHAR LIMIT=NONE] -->
+ <string name="voicemail_speaker_on">Turn speaker on.</string>
+
+ <!-- String describing the "speaker off" button on the playback control used to listen to a
+ voicemail message. When speaker is off, playback of the voicemail will occur through the
+ phone earpiece.
+ Note: AccessibilityServices uses this attribute to announce the purpose of the button.
+ [CHAR LIMIT=NONE] -->
+ <string name="voicemail_speaker_off">Turn speaker off.</string>
+
+ <!-- String describing the "play faster" button in the playback control used to listen to a
+ voicemail message. Speeds up playback of the voicemail message.
+ Note: AccessibilityServices uses this attribute to announce the purpose of the button.
+ [CHAR LIMIT=NONE] -->
+ <string name="voicemail_play_faster">Play faster.</string>
+
+ <!-- String describing the "play slower" button in the playback control used to listen to a
+ voicemail message. Slows down playback of the voicemail message.
+ Note: AccessibilityServices uses this attribute to announce the purpose of the button.
+ [CHAR LIMIT=NONE] -->
+ <string name="voicemail_play_slower">Play slower.</string>
+
+ <!-- String describing the "play/pause" button in the playback control used to listen to a
+ voicemail message. Starts playback or pauses ongoing playback.
+ Note: AccessibilityServices uses this attribute to announce the purpose of the button.
+ [CHAR LIMIT=NONE] -->
+ <string name="voicemail_play_start_pause">Start or pause playback.</string>
</resources>
diff --git a/src/com/android/dialer/BackScrollManager.java b/src/com/android/dialer/BackScrollManager.java
deleted file mode 100644
index 57287022a..000000000
--- a/src/com/android/dialer/BackScrollManager.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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;
-
-import android.view.View;
-import android.widget.AbsListView;
-import android.widget.ListView;
-
-/**
- * Handles scrolling back of a list tied to a header.
- * <p>
- * This is used to implement a header that scrolls up with the content of a list to be partially
- * obscured.
- */
-public class BackScrollManager {
- /** Defines the header to be scrolled. */
- public interface ScrollableHeader {
- /** Sets the offset by which to scroll. */
- public void setOffset(int offset);
- /** Gets the maximum offset that should be applied to the header. */
- public int getMaximumScrollableHeaderOffset();
- }
-
- private final ScrollableHeader mHeader;
- private final ListView mListView;
-
- private final AbsListView.OnScrollListener mScrollListener =
- new AbsListView.OnScrollListener() {
- @Override
- public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
- int totalItemCount) {
- if (firstVisibleItem != 0) {
- // The first item is not shown, the header should be pinned at the top.
- mHeader.setOffset(mHeader.getMaximumScrollableHeaderOffset());
- return;
- }
-
- View firstVisibleItemView = view.getChildAt(firstVisibleItem);
- if (firstVisibleItemView == null) {
- return;
- }
- // We scroll the header up, but at most pin it to the top of the screen.
- int offset = Math.min(
- (int) -view.getChildAt(firstVisibleItem).getY(),
- mHeader.getMaximumScrollableHeaderOffset());
- mHeader.setOffset(offset);
- }
-
- @Override
- public void onScrollStateChanged(AbsListView view, int scrollState) {
- // Nothing to do here.
- }
- };
-
- /**
- * Creates a new instance of a {@link BackScrollManager} that connected the header and the list
- * view.
- */
- public static void bind(ScrollableHeader header, ListView listView) {
- BackScrollManager backScrollManager = new BackScrollManager(header, listView);
- backScrollManager.bind();
- }
-
- private BackScrollManager(ScrollableHeader header, ListView listView) {
- mHeader = header;
- mListView = listView;
- }
-
- private void bind() {
- mListView.setOnScrollListener(mScrollListener);
- // We disable the scroll bar because it would otherwise be incorrect because of the hidden
- // header.
- mListView.setVerticalScrollBarEnabled(false);
- }
-}
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index 098e9882e..695f8aa01 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -17,53 +17,37 @@
package com.android.dialer;
import android.app.Activity;
-import android.app.LoaderManager.LoaderCallbacks;
-import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
-import android.content.Loader;
import android.content.res.Resources;
import android.database.Cursor;
-import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.CallLog;
-import android.provider.ContactsContract;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.DisplayNameSources;
-import android.provider.ContactsContract.Intents.Insert;
import android.provider.VoicemailContract.Voicemails;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
-import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
-import android.widget.ImageButton;
-import android.widget.ImageView;
import android.widget.ListView;
+import android.widget.QuickContactBadge;
import android.widget.TextView;
import android.widget.Toast;
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.CallUtil;
-import com.android.contacts.common.ClipboardUtils;
import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.GeoUtil;
-import com.android.contacts.common.model.Contact;
-import com.android.contacts.common.model.ContactLoader;
-import com.android.contacts.common.util.PhoneNumberHelper;
-import com.android.contacts.common.util.UriUtils;
-import com.android.dialer.BackScrollManager.ScrollableHeader;
import com.android.dialer.calllog.CallDetailHistoryAdapter;
import com.android.dialer.calllog.CallTypeHelper;
import com.android.dialer.calllog.ContactInfo;
@@ -119,12 +103,9 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
private CallTypeHelper mCallTypeHelper;
private PhoneNumberDisplayHelper mPhoneNumberHelper;
- private PhoneCallDetailsHelper mPhoneCallDetailsHelper;
- private TextView mHeaderTextView;
- private View mHeaderOverlayView;
- private ImageView mMainActionView;
- private ImageButton mMainActionPushLayerView;
- private ImageView mContactBackgroundView;
+ private QuickContactBadge mQuickContactBadge;
+ private TextView mCallerName;
+ private TextView mCallerNumber;
private AsyncTaskExecutor mAsyncTaskExecutor;
private ContactInfoHelper mContactInfoHelper;
@@ -154,15 +135,6 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
private ProximitySensorManager mProximitySensorManager;
private final ProximitySensorListener mProximitySensorListener = new ProximitySensorListener();
- /**
- * The action mode used when the phone number is selected. This will be non-null only when the
- * phone number is selected.
- */
- private ActionMode mPhoneNumberActionMode;
-
- private CharSequence mPhoneNumberLabelToCopy;
- private CharSequence mPhoneNumberToCopy;
-
/** Listener to changes in the proximity sensor state. */
private class ProximitySensorListener implements ProximitySensorManager.Listener {
/** Used to show a blank view and hide the action bar. */
@@ -232,69 +204,6 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
static final int GEOCODED_LOCATION_COLUMN_INDEX = 5;
static final int NUMBER_PRESENTATION_COLUMN_INDEX = 6;
- private final View.OnClickListener mPrimaryActionListener = new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (finishPhoneNumerSelectedActionModeIfShown()) {
- return;
- }
- DialerUtils.startActivityWithErrorToast(CallDetailActivity.this,
- ((ViewEntry) view.getTag()).primaryIntent);
- }
- };
-
- private final View.OnClickListener mSecondaryActionListener = new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (finishPhoneNumerSelectedActionModeIfShown()) {
- return;
- }
- DialerUtils.startActivityWithErrorToast(CallDetailActivity.this,
- ((ViewEntry) view.getTag()).secondaryIntent);
- }
- };
-
- private final View.OnLongClickListener mPrimaryLongClickListener =
- new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- if (finishPhoneNumerSelectedActionModeIfShown()) {
- return true;
- }
- startPhoneNumberSelectedActionMode(v);
- return true;
- }
- };
-
- private final LoaderCallbacks<Contact> mLoaderCallbacks = new LoaderCallbacks<Contact>() {
- @Override
- public void onLoaderReset(Loader<Contact> loader) {
- }
-
- @Override
- public void onLoadFinished(Loader<Contact> loader, Contact data) {
- final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
- intent.setType(Contacts.CONTENT_ITEM_TYPE);
- if (data.getDisplayNameSource() >= DisplayNameSources.ORGANIZATION) {
- intent.putExtra(Insert.NAME, data.getDisplayName());
- }
- intent.putExtra(Insert.DATA, data.getContentValues());
- bindContactPhotoAction(intent, R.drawable.ic_add_contact_holo_dark,
- getString(R.string.description_add_contact));
- }
-
- @Override
- public Loader<Contact> onCreateLoader(int id, Bundle args) {
- final Uri contactUri = args.getParcelable(BUNDLE_CONTACT_URI_EXTRA);
- if (contactUri == null) {
- Log.wtf(TAG, "No contact lookup uri provided.");
- }
- return new ContactLoader(CallDetailActivity.this, contactUri,
- false /* loadGroupMetaData */, false /* loadInvitableAccountTypes */,
- false /* postViewNotification */, true /* computeFormattedPhoneNumber */);
- }
- };
-
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -307,18 +216,15 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
mCallTypeHelper = new CallTypeHelper(getResources());
mPhoneNumberHelper = new PhoneNumberDisplayHelper(mResources);
- mPhoneCallDetailsHelper = new PhoneCallDetailsHelper(mResources, mCallTypeHelper,
- new PhoneNumberUtilsWrapper());
mVoicemailStatusHelper = new VoicemailStatusHelperImpl();
mAsyncQueryHandler = new CallDetailActivityQueryHandler(this);
- mHeaderTextView = (TextView) findViewById(R.id.header_text);
- mHeaderOverlayView = findViewById(R.id.photo_text_bar);
mStatusMessageView = findViewById(R.id.voicemail_status);
mStatusMessageText = (TextView) findViewById(R.id.voicemail_status_message);
mStatusMessageAction = (TextView) findViewById(R.id.voicemail_status_action);
- mMainActionView = (ImageView) findViewById(R.id.main_action);
- mMainActionPushLayerView = (ImageButton) findViewById(R.id.main_action_push_layer);
- mContactBackgroundView = (ImageView) findViewById(R.id.contact_background);
+ mQuickContactBadge = (QuickContactBadge) findViewById(R.id.quick_contact_photo);
+ mQuickContactBadge.setOverlay(null);
+ mCallerName = (TextView) findViewById(R.id.caller_name);
+ mCallerNumber = (TextView) findViewById(R.id.caller_number);
mDefaultCountryIso = GeoUtil.getCurrentCountryIso(this);
mContactPhotoManager = ContactPhotoManager.getInstance(this);
mProximitySensorManager = new ProximitySensorManager(this, mProximitySensorListener);
@@ -475,9 +381,6 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
final Uri contactUri = firstDetails.contactUri;
final Uri photoUri = firstDetails.photoUri;
- // Set the details header, based on the first phone call.
- mPhoneCallDetailsHelper.setCallDetailsHeader(mHeaderTextView, firstDetails);
-
// Cache the details about the phone number.
final boolean canPlaceCallsTo =
PhoneNumberUtilsWrapper.canPlaceCallsTo(mNumber, numberPresentation);
@@ -485,73 +388,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
final boolean isVoicemailNumber = phoneUtils.isVoicemailNumber(mNumber);
final boolean isSipNumber = phoneUtils.isSipNumber(mNumber);
- // Let user view contact details if they exist, otherwise add option to create new
- // contact from this number.
- final Intent mainActionIntent;
- final int mainActionIcon;
- final String mainActionDescription;
-
- final CharSequence nameOrNumber;
- if (!TextUtils.isEmpty(firstDetails.name)) {
- nameOrNumber = firstDetails.name;
- } else {
- nameOrNumber = firstDetails.number;
- }
-
- boolean skipBind = false;
-
- if (contactUri != null && !UriUtils.isEncodedContactUri(contactUri)) {
- mainActionIntent = new Intent(Intent.ACTION_VIEW, contactUri);
- // This will launch People's detail contact screen, so we probably want to
- // treat it as a separate People task.
- mainActionIntent.setFlags(
- Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- mainActionIcon = R.drawable.ic_contacts_holo_dark;
- mainActionDescription =
- getString(R.string.description_view_contact, nameOrNumber);
- } else if (UriUtils.isEncodedContactUri(contactUri)) {
- final Bundle bundle = new Bundle(1);
- bundle.putParcelable(BUNDLE_CONTACT_URI_EXTRA, contactUri);
- getLoaderManager().initLoader(LOADER_ID, bundle, mLoaderCallbacks);
- mainActionIntent = null;
- mainActionIcon = R.drawable.ic_add_contact_holo_dark;
- mainActionDescription = getString(R.string.description_add_contact);
- skipBind = true;
- } else if (isVoicemailNumber) {
- mainActionIntent = null;
- mainActionIcon = 0;
- mainActionDescription = null;
- } else if (isSipNumber) {
- // TODO: This item is currently disabled for SIP addresses, because
- // the Insert.PHONE extra only works correctly for PSTN numbers.
- //
- // To fix this for SIP addresses, we need to:
- // - define ContactsContract.Intents.Insert.SIP_ADDRESS, and use it here if
- // the current number is a SIP address
- // - update the contacts UI code to handle Insert.SIP_ADDRESS by
- // updating the SipAddress field
- // and then we can remove the "!isSipNumber" check above.
- mainActionIntent = null;
- mainActionIcon = 0;
- mainActionDescription = null;
- } else if (canPlaceCallsTo) {
- mainActionIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
- mainActionIntent.setType(Contacts.CONTENT_ITEM_TYPE);
- mainActionIntent.putExtra(Insert.PHONE, mNumber);
- mainActionIcon = R.drawable.ic_add_contact_holo_dark;
- mainActionDescription = getString(R.string.description_add_contact);
- } else {
- // If we cannot call the number, when we probably cannot add it as a contact
- // either. This is usually the case of private, unknown, or payphone numbers.
- mainActionIntent = null;
- mainActionIcon = 0;
- mainActionDescription = null;
- }
-
- if (!skipBind) {
- bindContactPhotoAction(mainActionIntent, mainActionIcon,
- mainActionDescription);
- }
+ final CharSequence callLocationOrType = getNumberTypeOrLocation(firstDetails);
final CharSequence displayNumber =
mPhoneNumberHelper.getDisplayNumber(
@@ -559,39 +396,18 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
firstDetails.numberPresentation,
firstDetails.formattedNumber);
- // This action allows to call the number that places the call.
- if (canPlaceCallsTo) {
- ViewEntry entry = new ViewEntry(
- getString(R.string.menu_callNumber,
- forceLeftToRight(displayNumber)),
- CallUtil.getCallIntent(mNumber),
- getString(R.string.description_call, nameOrNumber));
-
- // Only show a label if the number is shown and it is not a SIP address.
- if (!TextUtils.isEmpty(firstDetails.name)
- && !TextUtils.isEmpty(firstDetails.number)
- && !PhoneNumberHelper.isUriNumber(firstDetails.number.toString())) {
- entry.label = Phone.getTypeLabel(mResources, firstDetails.numberType,
- firstDetails.numberLabel);
- }
-
- // The secondary action allows to send an SMS to the number that placed the
- // call.
- if (phoneUtils.canSendSmsTo(mNumber, numberPresentation)) {
- entry.setSecondaryAction(
- R.drawable.ic_text_holo_light,
- new Intent(Intent.ACTION_SENDTO,
- Uri.fromParts("sms", mNumber, null)),
- getString(R.string.description_send_text_message, nameOrNumber));
+ if (!TextUtils.isEmpty(firstDetails.name)) {
+ mCallerName.setText(firstDetails.name);
+ mCallerNumber.setText(callLocationOrType + " " + displayNumber);
+ } else {
+ mCallerName.setText(displayNumber);
+ if (!TextUtils.isEmpty(callLocationOrType)) {
+ mCallerNumber.setText(callLocationOrType);
+ mCallerNumber.setVisibility(View.VISIBLE);
+ } else {
+ mCallerNumber.setVisibility(View.GONE);
}
- configureCallButton(entry);
- mPhoneNumberToCopy = displayNumber;
- mPhoneNumberLabelToCopy = entry.label;
- } else {
- disableCallButton();
- mPhoneNumberToCopy = null;
- mPhoneNumberLabelToCopy = null;
}
mHasEditNumberBeforeCallOption =
@@ -603,39 +419,10 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
ListView historyList = (ListView) findViewById(R.id.history);
historyList.setAdapter(
new CallDetailHistoryAdapter(CallDetailActivity.this, mInflater,
- mCallTypeHelper, details, hasVoicemail(), canPlaceCallsTo,
- findViewById(R.id.controls)));
- BackScrollManager.bind(
- new ScrollableHeader() {
- private View mControls = findViewById(R.id.controls);
- private View mPhoto = findViewById(R.id.contact_background_sizer);
- private View mHeader = findViewById(R.id.photo_text_bar);
- private View mSeparator = findViewById(R.id.separator);
-
- @Override
- public void setOffset(int offset) {
- mControls.setY(-offset);
- }
-
- @Override
- public int getMaximumScrollableHeaderOffset() {
- // We can scroll the photo out, but we should keep the header if
- // present.
- if (mHeader.getVisibility() == View.VISIBLE) {
- return mPhoto.getHeight() - mHeader.getHeight();
- } else {
- // If the header is not present, we should also scroll out the
- // separator line.
- return mPhoto.getHeight() + mSeparator.getHeight();
- }
- }
- },
- historyList);
-
- final String displayNameForDefaultImage = TextUtils.isEmpty(firstDetails.name) ?
- displayNumber.toString() : firstDetails.name.toString();
-
- final String lookupKey = ContactInfoHelper.getLookupKeyFromUri(contactUri);
+ mCallTypeHelper, details));
+
+ String lookupKey = contactUri == null ? null
+ : ContactInfoHelper.getLookupKeyFromUri(contactUri);
final boolean isBusiness = mContactInfoHelper.isBusiness(firstDetails.sourceType);
@@ -644,35 +431,37 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
isBusiness ? ContactPhotoManager.TYPE_BUSINESS :
ContactPhotoManager.TYPE_DEFAULT;
- loadContactPhotos(photoUri, displayNameForDefaultImage, lookupKey, contactType);
+ String nameForDefaultImage;
+ if (TextUtils.isEmpty(firstDetails.name)) {
+ nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(firstDetails.number,
+ firstDetails.numberPresentation,
+ firstDetails.formattedNumber).toString();
+ } else {
+ nameForDefaultImage = firstDetails.name.toString();
+ }
+
+ loadContactPhotos(
+ contactUri, photoUri, nameForDefaultImage, lookupKey, contactType);
findViewById(R.id.call_detail).setVisibility(View.VISIBLE);
}
- }
- mAsyncTaskExecutor.submit(Tasks.UPDATE_PHONE_CALL_DETAILS, new UpdateContactDetailsTask());
- }
- private void bindContactPhotoAction(final Intent actionIntent, int actionIcon,
- String actionDescription) {
- if (actionIntent == null) {
- mMainActionView.setVisibility(View.INVISIBLE);
- mMainActionPushLayerView.setVisibility(View.GONE);
- mHeaderTextView.setVisibility(View.INVISIBLE);
- mHeaderOverlayView.setVisibility(View.INVISIBLE);
- } else {
- mMainActionView.setVisibility(View.VISIBLE);
- mMainActionView.setImageResource(actionIcon);
- mMainActionPushLayerView.setVisibility(View.VISIBLE);
- mMainActionPushLayerView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- DialerUtils.startActivityWithErrorToast(CallDetailActivity.this, actionIntent,
- R.string.add_contact_not_available);
+ /**
+ * Determines the location geocode text for a call, or the phone number type
+ * (if available).
+ *
+ * @param details The call details.
+ * @return The phone number type or location.
+ */
+ private CharSequence getNumberTypeOrLocation(PhoneCallDetails details) {
+ if (!TextUtils.isEmpty(details.name)) {
+ return Phone.getTypeLabel(mResources, details.numberType,
+ details.numberLabel);
+ } else {
+ return details.geocode;
}
- });
- mMainActionPushLayerView.setContentDescription(actionDescription);
- mHeaderTextView.setVisibility(View.VISIBLE);
- mHeaderOverlayView.setVisibility(View.VISIBLE);
+ }
}
+ mAsyncTaskExecutor.submit(Tasks.UPDATE_PHONE_CALL_DETAILS, new UpdateContactDetailsTask());
}
/** Return the phone call details for a given call log URI. */
@@ -743,12 +532,18 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
}
/** Load the contact photos and places them in the corresponding views. */
- private void loadContactPhotos(Uri photoUri, String displayName, String lookupKey,
- int contactType) {
+ private void loadContactPhotos(Uri contactUri, Uri photoUri, String displayName,
+ String lookupKey, int contactType) {
+
final DefaultImageRequest request = new DefaultImageRequest(displayName, lookupKey,
- contactType, false);
- mContactPhotoManager.loadPhoto(mContactBackgroundView, photoUri,
- mContactBackgroundView.getWidth(), true, false /* isCircular */, request);
+ contactType, true /* isCircular */);
+
+ mQuickContactBadge.assignContactUri(contactUri);
+ mQuickContactBadge.setContentDescription(
+ mResources.getString(R.string.description_contact_details, displayName));
+
+ mContactPhotoManager.loadDirectoryPhoto(mQuickContactBadge, photoUri,
+ false /* darkTheme */, true /* isCircular */, request);
}
static final class ViewEntry {
@@ -778,48 +573,6 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
}
}
- /** Disables the call button area, e.g., for private numbers. */
- private void disableCallButton() {
- findViewById(R.id.call_and_sms).setVisibility(View.GONE);
- }
-
- /** Configures the call button area using the given entry. */
- private void configureCallButton(ViewEntry entry) {
- View convertView = findViewById(R.id.call_and_sms);
- convertView.setVisibility(View.VISIBLE);
-
- ImageView icon = (ImageView) convertView.findViewById(R.id.call_and_sms_icon);
- View divider = convertView.findViewById(R.id.call_and_sms_divider);
- TextView text = (TextView) convertView.findViewById(R.id.call_and_sms_text);
-
- View mainAction = convertView.findViewById(R.id.call_and_sms_main_action);
- mainAction.setOnClickListener(mPrimaryActionListener);
- mainAction.setTag(entry);
- mainAction.setContentDescription(entry.primaryDescription);
- mainAction.setOnLongClickListener(mPrimaryLongClickListener);
-
- if (entry.secondaryIntent != null) {
- icon.setOnClickListener(mSecondaryActionListener);
- icon.setImageResource(entry.secondaryIcon);
- icon.setVisibility(View.VISIBLE);
- icon.setTag(entry);
- icon.setContentDescription(entry.secondaryDescription);
- divider.setVisibility(View.VISIBLE);
- } else {
- icon.setVisibility(View.GONE);
- divider.setVisibility(View.GONE);
- }
- text.setText(entry.text);
-
- TextView label = (TextView) convertView.findViewById(R.id.call_and_sms_label);
- if (TextUtils.isEmpty(entry.label)) {
- label.setVisibility(View.GONE);
- } else {
- label.setText(entry.label);
- label.setVisibility(View.VISIBLE);
- }
- }
-
protected void updateVoicemailStatusMessage(Cursor statusCursor) {
if (statusCursor == null) {
mStatusMessageView.setVisibility(View.GONE);
@@ -901,7 +654,8 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
public void onPostExecute(Void result) {
finish();
}
- });
+ }
+ );
}
public void onMenuEditNumberBeforeCall(MenuItem menuItem) {
@@ -917,20 +671,13 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
getContentResolver().delete(voicemailUri, null, null);
return null;
}
+
@Override
public void onPostExecute(Void result) {
finish();
}
- });
- }
-
- /** Invoked when the user presses the home button in the action bar. */
- private void onHomeSelected() {
- Intent intent = new Intent(Intent.ACTION_VIEW, Calls.CONTENT_URI);
- // This will open the call log even if the detail view has been opened directly.
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent);
- finish();
+ }
+ );
}
@Override
@@ -951,70 +698,10 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
mProximitySensorManager.disable(waitForFarState);
}
- /**
- * If the phone number is selected, unselect it and return {@code true}.
- * Otherwise, just {@code false}.
- */
- private boolean finishPhoneNumerSelectedActionModeIfShown() {
- if (mPhoneNumberActionMode == null) return false;
- mPhoneNumberActionMode.finish();
- return true;
- }
-
- private void startPhoneNumberSelectedActionMode(View targetView) {
- mPhoneNumberActionMode = startActionMode(new PhoneNumberActionModeCallback(targetView));
- }
-
private void closeSystemDialogs() {
sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
}
- private class PhoneNumberActionModeCallback implements ActionMode.Callback {
- private final View mTargetView;
- private final Drawable mOriginalViewBackground;
-
- public PhoneNumberActionModeCallback(View targetView) {
- mTargetView = targetView;
-
- // Highlight the phone number view. Remember the old background, and put a new one.
- mOriginalViewBackground = mTargetView.getBackground();
- mTargetView.setBackgroundColor(getResources().getColor(R.color.item_selected));
- }
-
- @Override
- public boolean onCreateActionMode(ActionMode mode, Menu menu) {
- if (TextUtils.isEmpty(mPhoneNumberToCopy)) return false;
-
- getMenuInflater().inflate(R.menu.call_details_cab, menu);
- return true;
- }
-
- @Override
- public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
- return true;
- }
-
- @Override
- public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
- switch (item.getItemId()) {
- case R.id.copy_phone_number:
- ClipboardUtils.copyText(CallDetailActivity.this, mPhoneNumberLabelToCopy,
- mPhoneNumberToCopy, true);
- mode.finish(); // Close the CAB
- return true;
- }
- return false;
- }
-
- @Override
- public void onDestroyActionMode(ActionMode mode) {
- mPhoneNumberActionMode = null;
-
- // Restore the view background.
- mTargetView.setBackground(mOriginalViewBackground);
- }
- }
-
/** Returns the given text, forced to be left-to-right. */
private static CharSequence forceLeftToRight(CharSequence text) {
StringBuilder sb = new StringBuilder();
diff --git a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java
index 8af3b82bb..67cadb135 100644
--- a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java
+++ b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java
@@ -41,34 +41,13 @@ public class CallDetailHistoryAdapter extends BaseAdapter {
private final LayoutInflater mLayoutInflater;
private final CallTypeHelper mCallTypeHelper;
private final PhoneCallDetails[] mPhoneCallDetails;
- /** Whether the voicemail controls are shown. */
- private final boolean mShowVoicemail;
- /** Whether the call and SMS controls are shown. */
- private final boolean mShowCallAndSms;
- /** The controls that are shown on top of the history list. */
- private final View mControls;
- /** The listener to changes of focus of the header. */
- private View.OnFocusChangeListener mHeaderFocusChangeListener =
- new View.OnFocusChangeListener() {
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- // When the header is focused, focus the controls above it instead.
- if (hasFocus) {
- mControls.requestFocus();
- }
- }
- };
public CallDetailHistoryAdapter(Context context, LayoutInflater layoutInflater,
- CallTypeHelper callTypeHelper, PhoneCallDetails[] phoneCallDetails,
- boolean showVoicemail, boolean showCallAndSms, View controls) {
+ CallTypeHelper callTypeHelper, PhoneCallDetails[] phoneCallDetails) {
mContext = context;
mLayoutInflater = layoutInflater;
mCallTypeHelper = callTypeHelper;
mPhoneCallDetails = phoneCallDetails;
- mShowVoicemail = showVoicemail;
- mShowCallAndSms = showCallAndSms;
- mControls = controls;
}
@Override
@@ -117,14 +96,6 @@ public class CallDetailHistoryAdapter extends BaseAdapter {
final View header = convertView == null
? mLayoutInflater.inflate(R.layout.call_detail_history_header, parent, false)
: convertView;
- // Voicemail controls are only shown in the main UI if there is a voicemail.
- View voicemailContainer = header.findViewById(R.id.header_voicemail_container);
- voicemailContainer.setVisibility(mShowVoicemail ? View.VISIBLE : View.GONE);
- // Call and SMS controls are only shown in the main UI if there is a known number.
- View callAndSmsContainer = header.findViewById(R.id.header_call_and_sms_container);
- callAndSmsContainer.setVisibility(mShowCallAndSms ? View.VISIBLE : View.GONE);
- header.setFocusable(true);
- header.setOnFocusChangeListener(mHeaderFocusChangeListener);
return header;
}
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java b/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
index 826dec074..33ae5c8b4 100644
--- a/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
+++ b/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
@@ -423,8 +423,14 @@ public class VoicemailPlaybackFragment extends Fragment {
getAudioManager().setSpeakerphoneOn(on);
if (on) {
mPlaybackSpeakerphone.setImageResource(R.drawable.ic_speakerphone_on);
+ // Speaker is now on, tapping button will turn it off.
+ mPlaybackSpeakerphone.setContentDescription(
+ mApplicationContext.getString(R.string.voicemail_speaker_off));
} else {
mPlaybackSpeakerphone.setImageResource(R.drawable.ic_speakerphone_off);
+ // Speaker is now off, tapping button will turn it on.
+ mPlaybackSpeakerphone.setContentDescription(
+ mApplicationContext.getString(R.string.voicemail_speaker_on));
}
}
diff --git a/tests/src/com/android/dialer/CallDetailActivityTest.java b/tests/src/com/android/dialer/CallDetailActivityTest.java
index 1ad17c4f4..1e16fe427 100644
--- a/tests/src/com/android/dialer/CallDetailActivityTest.java
+++ b/tests/src/com/android/dialer/CallDetailActivityTest.java
@@ -219,7 +219,6 @@ public class CallDetailActivityTest extends ActivityInstrumentationTestCase2<Cal
mFakeAsyncTaskExecutor.runTask(PREPARE_MEDIA_PLAYER);
mTestUtils.clickButton(mActivityUnderTest, R.id.playback_speakerphone);
mTestUtils.clickButton(mActivityUnderTest, R.id.playback_start_stop);
- mTestUtils.clickButton(mActivityUnderTest, R.id.call_and_sms_main_action);
Thread.sleep(2000);
// TODO: Suppressed the test for now, because I'm looking for an easy way to say "the audio
// is not playing at this point", and I can't find it without doing dirty things.