Updates to visual design.
- Use sizes from spec.
- Show only contact name in call details header.
- Add spacing between contact icons.
- Updates a few assets.
- Add contentDescription to a number of elements.
- Use @dimen instead of ?attr for dimensions.
Bug: 4989127
Bug: 4989128
Bug: 5039572
Bug: 5038409
Change-Id: I3a59af44c77f739185feef39afd57193b5e0176a
diff --git a/res/drawable-hdpi/ic_ab_dialer_holo_dark.png b/res/drawable-hdpi/ic_ab_dialer_holo_dark.png
new file mode 100644
index 0000000..ecfeb2d
--- /dev/null
+++ b/res/drawable-hdpi/ic_ab_dialer_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_minus_holo_dark.png b/res/drawable-hdpi/ic_minus_holo_dark.png
new file mode 100644
index 0000000..f228047
--- /dev/null
+++ b/res/drawable-hdpi/ic_minus_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_play_holo_dark.png b/res/drawable-hdpi/ic_play_holo_dark.png
index c8cd127..d5fd235 100644
--- a/res/drawable-hdpi/ic_play_holo_dark.png
+++ b/res/drawable-hdpi/ic_play_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_plus_holo_dark.png b/res/drawable-hdpi/ic_plus_holo_dark.png
new file mode 100644
index 0000000..d7b2804
--- /dev/null
+++ b/res/drawable-hdpi/ic_plus_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ab_dialer_holo_dark.png b/res/drawable-mdpi/ic_ab_dialer_holo_dark.png
new file mode 100644
index 0000000..51ad9e3
--- /dev/null
+++ b/res/drawable-mdpi/ic_ab_dialer_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_minus_holo_dark.png b/res/drawable-mdpi/ic_minus_holo_dark.png
new file mode 100644
index 0000000..a020991
--- /dev/null
+++ b/res/drawable-mdpi/ic_minus_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_play_holo_dark.png b/res/drawable-mdpi/ic_play_holo_dark.png
index ecce105..a31671d 100644
--- a/res/drawable-mdpi/ic_play_holo_dark.png
+++ b/res/drawable-mdpi/ic_play_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_plus_holo_dark.png b/res/drawable-mdpi/ic_plus_holo_dark.png
new file mode 100644
index 0000000..4f6397c
--- /dev/null
+++ b/res/drawable-mdpi/ic_plus_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ab_dialer_holo_dark.png b/res/drawable-xhdpi/ic_ab_dialer_holo_dark.png
new file mode 100644
index 0000000..3f43a82
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ab_dialer_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_minus_holo_dark.png b/res/drawable-xhdpi/ic_minus_holo_dark.png
new file mode 100644
index 0000000..0e95a6b
--- /dev/null
+++ b/res/drawable-xhdpi/ic_minus_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_play_holo_dark.png b/res/drawable-xhdpi/ic_play_holo_dark.png
index c97ca43..afa6bb0 100644
--- a/res/drawable-xhdpi/ic_play_holo_dark.png
+++ b/res/drawable-xhdpi/ic_play_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_plus_holo_dark.png b/res/drawable-xhdpi/ic_plus_holo_dark.png
new file mode 100644
index 0000000..b869bf9
--- /dev/null
+++ b/res/drawable-xhdpi/ic_plus_holo_dark.png
Binary files differ
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index c20df49..e6a685e 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -23,7 +23,7 @@
<LinearLayout
android:id="@+id/action_bar"
android:layout_width="match_parent"
- android:layout_height="?attr/call_detail_action_bar_height"
+ android:layout_height="@dimen/call_detail_action_bar_height"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:orientation="horizontal"
@@ -51,7 +51,7 @@
<ImageView
android:id="@+id/contact_background"
android:layout_width="match_parent"
- android:layout_height="?attr/call_detail_contact_background_height"
+ android:layout_height="@dimen/call_detail_contact_background_height"
android:layout_alignParentLeft="true"
android:layout_below="@id/voicemail_status"
android:adjustViewBounds="true"
@@ -73,7 +73,7 @@
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="?attr/call_detail_contact_background_overlay_height"
+ android:layout_height="@dimen/call_detail_contact_background_overlay_height"
android:background="#3F000000"
android:layout_alignParentLeft="true"
android:layout_alignBottom="@id/contact_background"
@@ -81,19 +81,21 @@
<RelativeLayout
android:id="@+id/contact_text"
android:layout_width="match_parent"
- android:layout_height="?attr/call_detail_contact_background_overlay_height"
+ android:layout_height="@dimen/call_detail_contact_background_overlay_height"
android:layout_alignParentLeft="true"
android:layout_alignBottom="@id/contact_background"
- android:paddingLeft="5dip"
+ android:paddingLeft="@dimen/call_detail_contact_name_margin"
>
<ImageView
android:id="@+id/main_action"
- android:layout_width="?attr/call_detail_action_icon_size"
+ android:layout_width="@dimen/call_log_call_action_size"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:scaleType="center"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
+ android:layout_marginRight="@dimen/call_log_outer_margin"
+ android:layout_marginLeft="@dimen/call_log_inner_margin"
/>
<RelativeLayout
android:layout_width="wrap_content"
diff --git a/res/layout/call_detail_history_item.xml b/res/layout/call_detail_history_item.xml
index 3b28cfc..069ade9 100644
--- a/res/layout/call_detail_history_item.xml
+++ b/res/layout/call_detail_history_item.xml
@@ -20,15 +20,15 @@
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:background="?attr/call_log_secondary_background_color"
- android:padding="5dip"
+ android:padding="@dimen/call_log_indent_margin"
>
- <ImageView
+ <FrameLayout
android:id="@+id/call_type_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
- android:layout_marginRight="5dip"
+ android:layout_marginRight="@dimen/call_log_icon_margin"
/>
<TextView
android:id="@+id/call_type_text"
diff --git a/res/layout/call_log_action_call.xml b/res/layout/call_log_action_call.xml
index 0f15a23..062af6a 100644
--- a/res/layout/call_log_action_call.xml
+++ b/res/layout/call_log_action_call.xml
@@ -19,35 +19,48 @@
<LinearLayout
android:id="@+id/divider"
android:layout_width="wrap_content"
- android:layout_height="?attr/call_log_list_contact_photo_size"
+ android:layout_height="wrap_content"
android:layout_alignParentRight="true"
+ android:layout_centerInParent="true"
android:orientation="horizontal"
>
<ImageView
- android:id="@+id/play_icon"
+ android:id="@+id/unheard_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginLeft="?attr/call_log_inner_margin"
+ android:layout_marginLeft="@dimen/call_log_inner_margin"
android:layout_gravity="center_vertical"
android:scaleType="center"
android:src="@drawable/ic_unheard_voicemail_holo_dark"
android:visibility="gone"
+ android:contentDescription="@string/description_call_log_unheard_voicemail"
/>
<View
android:layout_width="1px"
- android:layout_height="?attr/call_log_list_call_action_size"
+ android:layout_height="@dimen/call_log_call_action_size"
android:layout_gravity="center_vertical"
- android:layout_marginLeft="?attr/call_log_inner_margin"
+ android:layout_marginLeft="@dimen/call_log_inner_margin"
android:background="@drawable/ic_divider_dashed_holo_dark"
/>
<ImageView
android:id="@+id/call_icon"
- android:layout_width="?attr/call_log_list_call_action_size"
- android:layout_height="?attr/call_log_list_call_action_size"
- android:layout_marginLeft="?attr/call_log_inner_margin"
+ android:layout_width="@dimen/call_log_call_action_size"
+ android:layout_height="@dimen/call_log_call_action_size"
+ android:layout_marginLeft="@dimen/call_log_inner_margin"
android:layout_gravity="center_vertical"
android:scaleType="center"
- android:src="@drawable/ic_dial_action_call"
+ android:src="@drawable/ic_ab_dialer_holo_dark"
+ android:contentDescription="@string/description_call_log_call_button"
+ />
+ <ImageView
+ android:id="@+id/play_icon"
+ android:layout_width="@dimen/call_log_call_action_size"
+ android:layout_height="@dimen/call_log_call_action_size"
+ android:layout_marginLeft="@dimen/call_log_inner_margin"
+ android:layout_gravity="center_vertical"
+ android:scaleType="center"
+ android:src="@drawable/ic_play_holo_dark"
+ android:contentDescription="@string/description_call_log_play_button"
/>
</LinearLayout>
diff --git a/res/layout/call_log_contact_photo.xml b/res/layout/call_log_contact_photo.xml
index a9add82..91b0743 100644
--- a/res/layout/call_log_contact_photo.xml
+++ b/res/layout/call_log_contact_photo.xml
@@ -2,9 +2,9 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<QuickContactBadge
android:id="@+id/contact_photo"
- android:layout_width="?attr/call_log_list_contact_photo_size"
- android:layout_height="?attr/call_log_list_contact_photo_size"
+ android:layout_width="@dimen/call_log_list_contact_photo_size"
+ android:layout_height="@dimen/call_log_list_contact_photo_size"
android:layout_alignParentLeft="true"
- android:layout_gravity="center_vertical"
+ android:layout_centerInParent="true"
/>
</merge>
diff --git a/res/layout/call_log_incoming_call_icon.xml b/res/layout/call_log_incoming_call_icon.xml
new file mode 100644
index 0000000..7bb7054
--- /dev/null
+++ b/res/layout/call_log_incoming_call_icon.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/call_log_incoming_call_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_icon_margin"
+ android:src="@drawable/ic_call_incoming_holo_dark"
+ android:contentDescription="@string/description_call_log_incoming_call"
+/>
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 890026e..fcccf07 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -27,10 +27,10 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="?attr/call_log_outer_margin"
- android:layout_marginRight="?attr/call_log_outer_margin"
- android:layout_marginTop="?attr/call_log_inner_margin"
- android:layout_marginBottom="?attr/call_log_inner_margin"
+ android:layout_marginLeft="@dimen/call_log_outer_margin"
+ android:layout_marginRight="@dimen/call_log_outer_margin"
+ android:layout_marginTop="@dimen/call_log_inner_margin"
+ android:layout_marginBottom="@dimen/call_log_inner_margin"
>
<!--
This layout may represent either a call log item or one of the
@@ -63,7 +63,7 @@
android:id="@+id/call_log_header_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="?attr/call_log_inner_margin"
+ android:layout_marginLeft="@dimen/call_log_inner_margin"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="?attr/call_log_header_color"
diff --git a/res/layout/call_log_list_item_layout.xml b/res/layout/call_log_list_item_layout.xml
index 4fbe426..e754bf7 100644
--- a/res/layout/call_log_list_item_layout.xml
+++ b/res/layout/call_log_list_item_layout.xml
@@ -17,11 +17,12 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="wrap_content"
- android:layout_height="?attr/call_log_list_contact_photo_size"
+ android:layout_height="wrap_content"
android:layout_toRightOf="@id/contact_photo"
android:layout_toLeftOf="@id/divider"
+ android:layout_centerInParent="true"
android:layout_alignWithParentIfMissing="true"
- android:layout_marginLeft="?attr/call_log_inner_margin"
+ android:layout_marginLeft="@dimen/call_log_inner_margin"
>
<include layout="@layout/call_log_phone_call_details"/>
</RelativeLayout>
diff --git a/res/layout/call_log_missed_call_icon.xml b/res/layout/call_log_missed_call_icon.xml
new file mode 100644
index 0000000..4a37229
--- /dev/null
+++ b/res/layout/call_log_missed_call_icon.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/call_log_missed_call_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_icon_margin"
+ android:src="@drawable/ic_call_missed_holo_dark"
+ android:contentDescription="@string/description_call_log_missed_call"
+/>
diff --git a/res/layout/call_log_outgoing_call_icon.xml b/res/layout/call_log_outgoing_call_icon.xml
new file mode 100644
index 0000000..67841be
--- /dev/null
+++ b/res/layout/call_log_outgoing_call_icon.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/call_log_outgoing_call_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_icon_margin"
+ android:src="@drawable/ic_call_outgoing_holo_dark"
+ android:contentDescription="@string/description_call_log_outgoing_call"
+/>
diff --git a/res/layout/call_log_phone_call_details.xml b/res/layout/call_log_phone_call_details.xml
index cf26fb6..5a4131e 100644
--- a/res/layout/call_log_phone_call_details.xml
+++ b/res/layout/call_log_phone_call_details.xml
@@ -16,68 +16,73 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
- android:id="@+id/call_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
- android:layout_alignParentBottom="true"
+ android:layout_centerInParent="true"
android:gravity="center_vertical"
+ android:orientation="vertical"
>
+ <TextView
+ android:id="@+id/name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="?attr/call_log_primary_text_color"
+ android:textSize="18sp"
+ android:singleLine="true"
+ />
+ <TextView
+ android:id="@+id/number"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="14sp"
+ android:singleLine="true"
+ />
<LinearLayout
- android:id="@+id/call_type_icons"
+ android:id="@+id/call_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginRight="?attr/call_log_inner_margin"
- />
- <TextView
- android:id="@+id/call_type_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="?attr/call_log_secondary_text_color"
- android:textSize="14sp"
- android:layout_marginRight="?attr/call_log_inner_margin"
- android:singleLine="true"
- />
- <TextView
- android:id="@+id/call_type_separator"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="?attr/call_log_inner_margin"
- android:textColor="?attr/call_log_secondary_text_color"
- android:textSize="14sp"
- android:text="@string/call_log_type_date_separator"
- android:singleLine="true"
- />
- <TextView
- android:id="@+id/date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="?attr/call_log_secondary_text_color"
- android:textSize="14sp"
- android:layout_toRightOf="@id/call_type"
- android:layout_alignParentBottom="true"
- android:singleLine="true"
- />
+ android:orientation="horizontal"
+ >
+ <LinearLayout
+ android:id="@+id/call_type_icons"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_icon_margin"
+ android:layout_gravity="center_vertical"
+ android:orientation="horizontal"
+ />
+ <TextView
+ android:id="@+id/call_type_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_inner_margin"
+ android:layout_gravity="center_vertical"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="14sp"
+ android:singleLine="true"
+ />
+ <TextView
+ android:id="@+id/call_type_separator"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_inner_margin"
+ android:layout_gravity="center_vertical"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="14sp"
+ android:text="@string/call_log_type_date_separator"
+ android:singleLine="true"
+ />
+ <TextView
+ android:id="@+id/date"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="14sp"
+ android:singleLine="true"
+ />
+ </LinearLayout>
</LinearLayout>
- <TextView
- android:id="@+id/number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="?attr/call_log_secondary_text_color"
- android:textSize="14sp"
- android:layout_alignParentLeft="true"
- android:layout_above="@id/call_type"
- android:singleLine="true"
- />
- <TextView
- android:id="@+id/name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="?attr/call_log_primary_text_color"
- android:textSize="18sp"
- android:layout_alignParentLeft="true"
- android:layout_above="@id/number"
- android:paddingBottom="2dp"
- android:singleLine="true"
- />
</merge>
diff --git a/res/layout/call_log_voicemail_icon.xml b/res/layout/call_log_voicemail_icon.xml
new file mode 100644
index 0000000..cfd6a2d
--- /dev/null
+++ b/res/layout/call_log_voicemail_icon.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/call_log_voicemail_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="@dimen/call_log_icon_margin"
+ android:src="@drawable/ic_call_voicemail_holo_dark"
+ android:contentDescription="@string/description_call_log_voicemail"
+/>
diff --git a/res/layout/playback_layout.xml b/res/layout/playback_layout.xml
index bebb0a0..1fb36be 100644
--- a/res/layout/playback_layout.xml
+++ b/res/layout/playback_layout.xml
@@ -61,8 +61,8 @@
android:thumb="@drawable/seek_bar_thumb"
android:thumbOffset="0dip"
android:background="@drawable/dialpad_background"
- android:paddingLeft="35dip"
- android:paddingRight="35dip"
+ android:paddingLeft="50dip"
+ android:paddingRight="50dip"
android:paddingTop="10dip"
android:paddingBottom="20dip"
android:layout_margin="4dip"
@@ -81,7 +81,7 @@
/>
<ImageButton
android:id="@+id/rate_decrease_button"
- android:src="@drawable/ic_menu_remove_field_holo_light"
+ android:src="@drawable/ic_minus_holo_dark"
android:layout_width="30dip"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
@@ -92,7 +92,7 @@
/>
<ImageButton
android:id="@+id/rate_increase_button"
- android:src="@drawable/ic_menu_add_field_holo_light"
+ android:src="@drawable/ic_plus_holo_dark"
android:layout_width="30dip"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index e155cbc..2bba6ac 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -214,4 +214,16 @@
<!-- ContactTile Layouts -->
<dimen name="contact_tile_shadowbox_height">48dip</dimen>
+
+ <!-- Call Log -->
+ <dimen name="call_log_call_action_size">32dip</dimen>
+ <dimen name="call_log_icon_margin">4dip</dimen>
+ <dimen name="call_log_inner_margin">8dip</dimen>
+ <dimen name="call_log_outer_margin">16dip</dimen>
+ <dimen name="call_log_indent_margin">24dip</dimen>
+ <dimen name="call_log_list_contact_photo_size">64dip</dimen>
+ <dimen name="call_detail_contact_background_height">174dip</dimen>
+ <dimen name="call_detail_contact_background_overlay_height">42dip</dimen>
+ <dimen name="call_detail_contact_name_margin">24dip</dimen>
+ <dimen name="call_detail_action_bar_height">60dip</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 75e3249..7d11c54 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1660,4 +1660,56 @@
<!-- Used to display as default status when the contact is busy or Do not disturb for chat [CHAR LIMIT=19] -->
<string name="status_busy">Busy</string>
+ <!-- String describing the icon in the call log used to place a call.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_call_log_call_button">Call number</string>
+
+ <!-- String describing the icon in the call log used to play a voicemail.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_call_log_play_button">Play voicemail</string>
+
+ <!-- String describing the icon in the call log used to represent an incoming call.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_call_log_incoming_call">Incoming call</string>
+
+ <!-- String describing the icon in the call log used to represent an outgoing call.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+
+ <string name="description_call_log_outgoing_call">Outgoing call</string>
+
+ <!-- String describing the icon in the call log used to represent a missed call.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+
+ <string name="description_call_log_missed_call">Missed call</string>
+
+ <!-- String describing the icon in the call log used to represent a voicemail left to the user.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_call_log_voicemail">Voicemail</string>
+
+ <!-- String describing the icon in the call log used to represent an unheard voicemail left to
+ the user.
+
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+ -->
+ <string name="description_call_log_unheard_voicemail">Unheard voicemail</string>
+
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index d16590e..46e6583 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -41,12 +41,7 @@
<item name="list_item_header_underline_height">1px</item>
<item name="list_item_header_underline_color">@color/people_app_theme_color</item>
<item name="contact_filter_popup_width">320dip</item>
- <!-- CallLogList -->
- <item name="call_log_list_contact_photo_size">64dip</item>
- <item name="call_log_list_call_action_size">32dip</item>
<!-- CallLog -->
- <item name="call_log_inner_margin">8dip</item>
- <item name="call_log_outer_margin">16dip</item>
<item name="call_log_primary_text_color">#FFFFFF</item>
<item name="call_log_primary_background_color">#000000</item>
<item name="call_log_secondary_text_color">#888888</item>
@@ -62,14 +57,8 @@
<item name="android:windowNoTitle">true</item>
<item name="android:gravity">top</item>
<item name="call_detail_transparent_background">#CC000000</item>
- <item name="call_detail_contact_background_height">150dip</item>
- <item name="call_detail_contact_background_overlay_height">70dip</item>
- <item name="call_detail_action_bar_height">60dip</item>
- <item name="call_detail_action_icon_size">60dip</item>
<item name="call_detail_contact_background_overlay_alpha">0.25</item>
<!-- CallLog -->
- <item name="call_log_inner_margin">8dip</item>
- <item name="call_log_outer_margin">16dip</item>
<item name="call_log_primary_text_color">#FFFFFF</item>
<item name="call_log_primary_background_color">#000000</item>
<item name="call_log_secondary_text_color">#FFFFFF</item>
@@ -154,17 +143,10 @@
<declare-styleable name="CallDetailActivity">
<attr name="call_detail_transparent_background" format="color" />
- <attr name="call_detail_contact_background_height" format="dimension" />
- <attr name="call_detail_contact_background_overlay_height" format="dimension" />
<attr name="call_detail_contact_background_overlay_alpha" format="float" />
- <attr name="call_detail_contact_photo_size" format="dimension" />
- <attr name="call_detail_action_icon_size" format="dimension" />
- <attr name="call_detail_action_bar_height" format="dimension" />
</declare-styleable>
<declare-styleable name="CallLog">
- <attr name="call_log_inner_margin" format="dimension" />
- <attr name="call_log_outer_margin" format="dimension" />
<attr name="call_log_primary_text_color" format="color" />
<attr name="call_log_primary_background_color" format="color" />
<attr name="call_log_secondary_text_color" format="color" />
@@ -172,11 +154,6 @@
<attr name="call_log_header_color" format="color" />
</declare-styleable>
- <declare-styleable name="CallLogList">
- <attr name="call_log_list_contact_photo_size" format="dimension" />
- <attr name="call_log_list_call_action_size" format="dimension" />
- </declare-styleable>
-
<declare-styleable name="VoicemailStatus">
<attr name="call_log_voicemail_status_height" format="dimension" />
<attr name="call_log_voicemail_status_background_color" format="color" />
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index 68c9f61..d732d66 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -147,13 +147,9 @@
mResources = getResources();
mPhoneCallDetailsViews = PhoneCallDetailsViews.fromView(getWindow().getDecorView());
- mCallTypeHelper = new CallTypeHelper(getResources(),
- getResources().getDrawable(R.drawable.ic_call_incoming_holo_dark),
- getResources().getDrawable(R.drawable.ic_call_outgoing_holo_dark),
- getResources().getDrawable(R.drawable.ic_call_missed_holo_dark),
- getResources().getDrawable(R.drawable.ic_call_voicemail_holo_dark));
+ mCallTypeHelper = new CallTypeHelper(getResources(), mInflater);
mPhoneNumberHelper = new PhoneNumberHelper(mResources, getVoicemailNumber());
- mPhoneCallDetailsHelper = new PhoneCallDetailsHelper(this, mResources, mCallTypeHelper,
+ mPhoneCallDetailsHelper = new PhoneCallDetailsHelper(mResources, mCallTypeHelper,
mPhoneNumberHelper);
mVoicemailStatusHelper = new VoicemailStatusHelperImpl();
mAsyncQueryHandler = new CallDetailActivityQueryHandler(this);
@@ -286,7 +282,7 @@
// Set the details header, based on the first phone call.
mPhoneCallDetailsHelper.setPhoneCallDetails(mPhoneCallDetailsViews,
- details[0], false, false);
+ details[0], false, false, true);
// Cache the details about the phone number.
final Uri numberCallUri = mPhoneNumberHelper.getCallUri(mNumber);
diff --git a/src/com/android/contacts/PhoneCallDetailsHelper.java b/src/com/android/contacts/PhoneCallDetailsHelper.java
index b2810bc..019e608 100644
--- a/src/com/android/contacts/PhoneCallDetailsHelper.java
+++ b/src/com/android/contacts/PhoneCallDetailsHelper.java
@@ -20,7 +20,6 @@
import com.android.contacts.calllog.PhoneNumberHelper;
import com.android.contacts.format.FormatUtils;
-import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.provider.ContactsContract.CommonDataKinds.Phone;
@@ -29,7 +28,6 @@
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.view.View;
-import android.widget.ImageView;
/**
* Helper class to fill in the views in {@link PhoneCallDetailsViews}.
@@ -38,7 +36,6 @@
/** The maximum number of icons will be shown to represent the call types in a group. */
private static final int MAX_CALL_TYPE_ICONS = 3;
- private final Context mContext;
private final Resources mResources;
/** The injected current time in milliseconds since the epoch. Used only by tests. */
private Long mCurrentTimeMillisForTest;
@@ -53,9 +50,8 @@
*
* @param resources used to look up strings
*/
- public PhoneCallDetailsHelper(Context context, Resources resources,
- CallTypeHelper callTypeHelper, PhoneNumberHelper phoneNumberHelper) {
- mContext = context;
+ public PhoneCallDetailsHelper(Resources resources, CallTypeHelper callTypeHelper,
+ PhoneNumberHelper phoneNumberHelper) {
mResources = resources;
mCallTypeHelper = callTypeHelper;
mPhoneNumberHelper = phoneNumberHelper;
@@ -63,15 +59,12 @@
/** Fills the call details views with content. */
public void setPhoneCallDetails(PhoneCallDetailsViews views, PhoneCallDetails details,
- boolean useIcons, boolean isHighlighted) {
+ boolean useIcons, boolean isHighlighted, boolean nameOnly) {
if (useIcons) {
views.callTypeIcons.removeAllViews();
int count = details.callTypes.length;
for (int index = 0; index < count && index < MAX_CALL_TYPE_ICONS; ++index) {
- int callType = details.callTypes[index];
- ImageView callTypeImage = new ImageView(mContext);
- callTypeImage.setImageDrawable(mCallTypeHelper.getCallTypeDrawable(callType));
- views.callTypeIcons.addView(callTypeImage);
+ mCallTypeHelper.inflateCallTypeIcon(details.callTypes[index], views.callTypeIcons);
}
views.callTypeIcons.setVisibility(View.VISIBLE);
if (count > MAX_CALL_TYPE_ICONS) {
@@ -144,6 +137,10 @@
} else {
views.numberView.setVisibility(View.GONE);
}
+
+ // Hide the rest if not visible.
+ views.callTypeView.setVisibility(nameOnly ? View.GONE : View.VISIBLE);
+ views.numberView.setVisibility(nameOnly ? View.GONE : View.VISIBLE);
}
public void setCurrentTimeForTest(long currentTimeMillis) {
diff --git a/src/com/android/contacts/PhoneCallDetailsViews.java b/src/com/android/contacts/PhoneCallDetailsViews.java
index 7453af0..19e931f 100644
--- a/src/com/android/contacts/PhoneCallDetailsViews.java
+++ b/src/com/android/contacts/PhoneCallDetailsViews.java
@@ -16,6 +16,7 @@
package com.android.contacts;
+import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -25,15 +26,17 @@
*/
public final class PhoneCallDetailsViews {
public final TextView nameView;
+ public final View callTypeView;
public final LinearLayout callTypeIcons;
public final TextView callTypeText;
public final View callTypeSeparator;
public final TextView dateView;
public final TextView numberView;
- private PhoneCallDetailsViews(TextView nameView, LinearLayout callTypeIcons,
+ private PhoneCallDetailsViews(TextView nameView, View callTypeView, LinearLayout callTypeIcons,
TextView callTypeText, View callTypeSeparator, TextView dateView, TextView numberView) {
this.nameView = nameView;
+ this.callTypeView = callTypeView;
this.callTypeIcons = callTypeIcons;
this.callTypeText = callTypeText;
this.callTypeSeparator = callTypeSeparator;
@@ -50,6 +53,7 @@
*/
public static PhoneCallDetailsViews fromView(View view) {
return new PhoneCallDetailsViews((TextView) view.findViewById(R.id.name),
+ view.findViewById(R.id.call_type),
(LinearLayout) view.findViewById(R.id.call_type_icons),
(TextView) view.findViewById(R.id.call_type_name),
view.findViewById(R.id.call_type_separator),
@@ -57,10 +61,14 @@
(TextView) view.findViewById(R.id.number));
}
- public static PhoneCallDetailsViews createForTest(TextView nameView,
- LinearLayout callTypeIcons, TextView callTypeText, View callTypeSeparator,
- TextView dateView, TextView numberView) {
- return new PhoneCallDetailsViews(nameView, callTypeIcons, callTypeText, callTypeSeparator,
- dateView, numberView);
+ public static PhoneCallDetailsViews createForTest(Context context) {
+ return new PhoneCallDetailsViews(
+ new TextView(context),
+ new View(context),
+ new LinearLayout(context),
+ new TextView(context),
+ new View(context),
+ new TextView(context),
+ new TextView(context));
}
}
diff --git a/src/com/android/contacts/calllog/CallDetailHistoryAdapter.java b/src/com/android/contacts/calllog/CallDetailHistoryAdapter.java
index ae81a79..e55020c 100644
--- a/src/com/android/contacts/calllog/CallDetailHistoryAdapter.java
+++ b/src/com/android/contacts/calllog/CallDetailHistoryAdapter.java
@@ -26,7 +26,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
-import android.widget.ImageView;
+import android.widget.FrameLayout;
import android.widget.TextView;
/**
@@ -69,13 +69,14 @@
}
PhoneCallDetails details = mPhoneCallDetails[position];
- ImageView callTypeIconView = (ImageView) convertView.findViewById(R.id.call_type_icon);
+ FrameLayout callTypeIconView = (FrameLayout) convertView.findViewById(R.id.call_type_icon);
TextView callTypeTextView = (TextView) convertView.findViewById(R.id.call_type_text);
TextView dateView = (TextView) convertView.findViewById(R.id.date);
TextView durationView = (TextView) convertView.findViewById(R.id.duration);
int callType = details.callTypes[0];
- callTypeIconView.setImageDrawable(mCallTypeHelper.getCallTypeDrawable(callType));
+ callTypeIconView.removeAllViews();
+ mCallTypeHelper.inflateCallTypeIcon(callType, callTypeIconView);
callTypeTextView.setText(mCallTypeHelper.getCallTypeText(callType));
// Set the date.
CharSequence dateValue = DateUtils.formatDateRange(mContext, details.date, details.date,
diff --git a/src/com/android/contacts/calllog/CallLogFragment.java b/src/com/android/contacts/calllog/CallLogFragment.java
index 9f64815..f059292 100644
--- a/src/com/android/contacts/calllog/CallLogFragment.java
+++ b/src/com/android/contacts/calllog/CallLogFragment.java
@@ -312,11 +312,8 @@
mPreDrawListener = null;
Resources resources = getResources();
- CallTypeHelper callTypeHelper = new CallTypeHelper(resources,
- resources.getDrawable(R.drawable.ic_call_incoming_holo_dark),
- resources.getDrawable(R.drawable.ic_call_outgoing_holo_dark),
- resources.getDrawable(R.drawable.ic_call_missed_holo_dark),
- resources.getDrawable(R.drawable.ic_call_voicemail_holo_dark));
+ LayoutInflater layoutInflater = getActivity().getLayoutInflater();
+ CallTypeHelper callTypeHelper = new CallTypeHelper(resources, layoutInflater);
Drawable callDrawable = resources.getDrawable(R.drawable.ic_dial_action_call);
Drawable playDrawable = resources.getDrawable(
R.drawable.ic_call_log_list_action_play);
@@ -324,7 +321,7 @@
mContactPhotoManager = ContactPhotoManager.getInstance(getActivity());
mPhoneNumberHelper = new PhoneNumberHelper(getResources(), mVoiceMailNumber);
PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper(
- getActivity(), resources, callTypeHelper, mPhoneNumberHelper);
+ resources, callTypeHelper, mPhoneNumberHelper);
mCallLogViewsHelper =
new CallLogListItemHelper(phoneCallDetailsHelper, mPhoneNumberHelper);
mCallLogGroupBuilder = new CallLogGroupBuilder(this);
@@ -659,7 +656,6 @@
// Get the views to bind to.
CallLogListItemViews views = CallLogListItemViews.fromView(view);
views.callView.setOnClickListener(this);
- views.playView.setOnClickListener(this);
view.setTag(views);
}
@@ -697,21 +693,18 @@
final String formattedNumber;
final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO);
- // Store away the number so we can call it directly if you click on the call icon.
- if (!TextUtils.isEmpty(number)) {
- views.callView.setTag(IntentProvider.getReturnCallIntentProvider(number));
- } else {
- views.callView.setTag(null);
- }
-
// Store away the voicemail information so we can play it directly.
if (callType == Calls.VOICEMAIL_TYPE) {
String voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI);
final long rowId = c.getLong(CallLogQuery.ID);
- views.playView.setTag(
+ views.callView.setTag(
IntentProvider.getPlayVoicemailIntentProvider(rowId, voicemailUri));
+ } else if (!TextUtils.isEmpty(number)) {
+ // Store away the number so we can call it directly if you click on the call icon.
+ views.callView.setTag(IntentProvider.getReturnCallIntentProvider(number));
} else {
- views.playView.setTag(null);
+ // No action enabled.
+ views.callView.setTag(null);
}
// Lookup contacts with this number
diff --git a/src/com/android/contacts/calllog/CallLogListItemHelper.java b/src/com/android/contacts/calllog/CallLogListItemHelper.java
index d4f2291..d8184d2 100644
--- a/src/com/android/contacts/calllog/CallLogListItemHelper.java
+++ b/src/com/android/contacts/calllog/CallLogListItemHelper.java
@@ -54,19 +54,27 @@
public void setPhoneCallDetails(CallLogListItemViews views, PhoneCallDetails details,
boolean useIcons, boolean isHighlighted) {
mPhoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details, useIcons,
- isHighlighted);
- boolean callVisible = mPhoneNumberHelper.canPlaceCallsTo(details.number);
- boolean playVisible = details.callTypes[0] == Calls.VOICEMAIL_TYPE;
+ isHighlighted, false);
+ boolean canCall = mPhoneNumberHelper.canPlaceCallsTo(details.number);
+ boolean canPlay = details.callTypes[0] == Calls.VOICEMAIL_TYPE;
- if (callVisible || playVisible) {
- // At least one is visible. Keep the divider and the space for the call button.
- views.callView.setVisibility(callVisible ? View.VISIBLE : View.INVISIBLE);
- views.playView.setVisibility(playVisible ? View.VISIBLE : View.GONE);
+ if (canPlay) {
+ // Playback action takes preference.
+ views.callView.setVisibility(View.GONE);
+ views.playView.setVisibility(View.VISIBLE);
+ views.unheardView.setVisibility(isHighlighted ? View.VISIBLE : View.GONE);
+ views.dividerView.setVisibility(View.VISIBLE);
+ } else if (canCall) {
+ // Call is the main action.
+ views.callView.setVisibility(View.VISIBLE);
+ views.playView.setVisibility(View.GONE);
+ views.unheardView.setVisibility(View.GONE);
views.dividerView.setVisibility(View.VISIBLE);
} else {
- // Neither is visible, remove all of them entirely.
+ // No action available.
views.callView.setVisibility(View.GONE);
views.playView.setVisibility(View.GONE);
+ views.unheardView.setVisibility(View.GONE);
views.dividerView.setVisibility(View.GONE);
}
}
diff --git a/src/com/android/contacts/calllog/CallLogListItemViews.java b/src/com/android/contacts/calllog/CallLogListItemViews.java
index b66d84e..51bc535 100644
--- a/src/com/android/contacts/calllog/CallLogListItemViews.java
+++ b/src/com/android/contacts/calllog/CallLogListItemViews.java
@@ -19,8 +19,8 @@
import com.android.contacts.PhoneCallDetailsViews;
import com.android.contacts.R;
+import android.content.Context;
import android.view.View;
-import android.widget.ImageView;
import android.widget.QuickContactBadge;
import android.widget.TextView;
@@ -31,9 +31,11 @@
/** The quick contact badge for the contact. Only present for group and stand alone entries. */
public final QuickContactBadge photoView;
/** The main action button on the entry. */
- public final ImageView callView;
+ public final View callView;
/** The play action button used for voicemail. */
- public final ImageView playView;
+ public final View playView;
+ /** The icon used for unheard voicemail. */
+ public final View unheardView;
/** The divider between callView and playView. */
public final View dividerView;
/** The details of the phone call. */
@@ -45,12 +47,14 @@
/** The text of the header in a stand-alone row, or null for other types of rows. */
public final TextView listHeaderTextView;
- private CallLogListItemViews(QuickContactBadge photoView, ImageView callView,
- ImageView playView, View dividerView, PhoneCallDetailsViews phoneCallDetailsViews,
- View listItemView, View listHeaderView, TextView listHeaderTextView) {
+ private CallLogListItemViews(QuickContactBadge photoView, View callView,
+ View playView, View unheardView, View dividerView,
+ PhoneCallDetailsViews phoneCallDetailsViews, View listItemView, View listHeaderView,
+ TextView listHeaderTextView) {
this.photoView = photoView;
this.callView = callView;
this.playView = playView;
+ this.unheardView = unheardView;
this.dividerView = dividerView;
this.phoneCallDetailsViews = phoneCallDetailsViews;
this.listItemView = listItemView;
@@ -60,8 +64,9 @@
public static CallLogListItemViews fromView(View view) {
return new CallLogListItemViews((QuickContactBadge) view.findViewById(R.id.contact_photo),
- (ImageView) view.findViewById(R.id.call_icon),
- (ImageView) view.findViewById(R.id.play_icon),
+ view.findViewById(R.id.call_icon),
+ view.findViewById(R.id.play_icon),
+ view.findViewById(R.id.unheard_icon),
view.findViewById(R.id.divider),
PhoneCallDetailsViews.fromView(view),
view.findViewById(R.id.call_log_item),
@@ -69,12 +74,16 @@
(TextView) view.findViewById(R.id.call_log_header_text));
}
- public static CallLogListItemViews createForTest(QuickContactBadge photoView,
- ImageView callView, ImageView playView, View dividerView,
- PhoneCallDetailsViews phoneCallDetailsViews, View standAloneItemView,
- View standAloneHeaderView, TextView standAloneHeaderTextView) {
- return new CallLogListItemViews(photoView, callView, playView, dividerView,
- phoneCallDetailsViews, standAloneItemView, standAloneHeaderView,
- standAloneHeaderTextView);
+ public static CallLogListItemViews createForTest(Context context) {
+ return new CallLogListItemViews(
+ new QuickContactBadge(context),
+ new View(context),
+ new View(context),
+ new View(context),
+ new View(context),
+ PhoneCallDetailsViews.createForTest(context),
+ new View(context),
+ new View(context),
+ new TextView(context));
}
}
diff --git a/src/com/android/contacts/calllog/CallTypeHelper.java b/src/com/android/contacts/calllog/CallTypeHelper.java
index 0c2068e..465e2bf 100644
--- a/src/com/android/contacts/calllog/CallTypeHelper.java
+++ b/src/com/android/contacts/calllog/CallTypeHelper.java
@@ -20,25 +20,21 @@
import android.content.res.Resources;
import android.graphics.Typeface;
-import android.graphics.drawable.Drawable;
import android.provider.CallLog.Calls;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
/**
* Helper class to perform operations related to call types.
*/
public class CallTypeHelper {
- /** Icon for incoming calls. */
- private final Drawable mIncomingDrawable;
- /** Icon for outgoing calls. */
- private final Drawable mOutgoingDrawable;
- /** Icon for missed calls. */
- private final Drawable mMissedDrawable;
- /** Icon for voicemails. */
- private final Drawable mVoicemailDrawable;
+ /** Used to create the views for the call types. */
+ private final LayoutInflater mLayoutInflater;
/** Name used to identify incoming calls. */
private final CharSequence mIncomingName;
/** Name used to identify outgoing calls. */
@@ -52,12 +48,8 @@
/** Name used to identify new voicemail calls. */
private final CharSequence mNewVoicemailName;
- public CallTypeHelper(Resources resources, Drawable incomingDrawable, Drawable outgoingDrawable,
- Drawable missedDrawable, Drawable voicemailDrawable) {
- mIncomingDrawable = incomingDrawable;
- mOutgoingDrawable = outgoingDrawable;
- mMissedDrawable = missedDrawable;
- mVoicemailDrawable = voicemailDrawable;
+ public CallTypeHelper(Resources resources, LayoutInflater layoutInflater) {
+ mLayoutInflater = layoutInflater;
// Cache these values so that we do not need to look them up each time.
mIncomingName = resources.getString(R.string.type_incoming);
mOutgoingName = resources.getString(R.string.type_outgoing);
@@ -111,20 +103,20 @@
}
}
- /** Returns the drawable of the icon associated with the given call type. */
- public Drawable getCallTypeDrawable(int callType) {
+ /** Returns a new view for the icon to be used to represent a given call type. */
+ public View inflateCallTypeIcon(int callType, ViewGroup root) {
switch (callType) {
case Calls.INCOMING_TYPE:
- return mIncomingDrawable;
+ return mLayoutInflater.inflate(R.layout.call_log_incoming_call_icon, root);
case Calls.OUTGOING_TYPE:
- return mOutgoingDrawable;
+ return mLayoutInflater.inflate(R.layout.call_log_outgoing_call_icon, root);
case Calls.MISSED_TYPE:
- return mMissedDrawable;
+ return mLayoutInflater.inflate(R.layout.call_log_missed_call_icon, root);
case Calls.VOICEMAIL_TYPE:
- return mVoicemailDrawable;
+ return mLayoutInflater.inflate(R.layout.call_log_voicemail_icon, root);
default:
throw new IllegalArgumentException("invalid call type: " + callType);
diff --git a/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java b/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java
index f02e7b0..3f4e49c 100644
--- a/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java
@@ -23,15 +23,10 @@
import android.content.Context;
import android.content.res.Resources;
-import android.graphics.Color;
-import android.graphics.drawable.ColorDrawable;
-import android.graphics.drawable.Drawable;
import android.provider.CallLog.Calls;
import android.test.AndroidTestCase;
+import android.view.LayoutInflater;
import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
import java.util.GregorianCalendar;
import java.util.Locale;
@@ -50,14 +45,6 @@
private static final String TEST_NUMBER = "14125555555";
/** The formatted version of {@link #TEST_NUMBER}. */
private static final String TEST_FORMATTED_NUMBER = "1-412-255-5555";
- /** A drawable to be used for incoming calls. */
- private static final Drawable TEST_INCOMING_DRAWABLE = new ColorDrawable(Color.BLACK);
- /** A drawable to be used for outgoing calls. */
- private static final Drawable TEST_OUTGOING_DRAWABLE = new ColorDrawable(Color.BLUE);
- /** A drawable to be used for missed calls. */
- private static final Drawable TEST_MISSED_DRAWABLE = new ColorDrawable(Color.RED);
- /** A drawable to be used for voicemails. */
- private static final Drawable TEST_VOICEMAIL_DRAWABLE = new ColorDrawable(Color.CYAN);
/** The country ISO name used in the tests. */
private static final String TEST_COUNTRY_ISO = "US";
@@ -72,14 +59,12 @@
super.setUp();
Context context = getContext();
Resources resources = context.getResources();
- CallTypeHelper callTypeHelper = new CallTypeHelper(resources, TEST_INCOMING_DRAWABLE,
- TEST_OUTGOING_DRAWABLE, TEST_MISSED_DRAWABLE, TEST_VOICEMAIL_DRAWABLE);
+ LayoutInflater layoutInflater =
+ (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ CallTypeHelper callTypeHelper = new CallTypeHelper(resources, layoutInflater);
mPhoneNumberHelper = new PhoneNumberHelper(resources, TEST_VOICEMAIL_NUMBER);
- mHelper = new PhoneCallDetailsHelper(
- context, resources, callTypeHelper, mPhoneNumberHelper);
- mViews = PhoneCallDetailsViews.createForTest(new TextView(context),
- new LinearLayout(context), new TextView(context), new View(context),
- new TextView(context), new TextView(context));
+ mHelper = new PhoneCallDetailsHelper(resources, callTypeHelper, mPhoneNumberHelper);
+ mViews = PhoneCallDetailsViews.createForTest(context);
}
@Override
@@ -143,16 +128,25 @@
public void testSetPhoneCallDetails_CallTypeIcons() {
setPhoneCallDetailsWithCallTypeIcons(Calls.INCOMING_TYPE);
- assertCallTypeIconsEquals(TEST_INCOMING_DRAWABLE);
+ assertCallTypeIconsEquals(R.id.call_log_incoming_call_icon);
setPhoneCallDetailsWithCallTypeIcons(Calls.OUTGOING_TYPE);
- assertCallTypeIconsEquals(TEST_OUTGOING_DRAWABLE);
+ assertCallTypeIconsEquals(R.id.call_log_outgoing_call_icon);
setPhoneCallDetailsWithCallTypeIcons(Calls.MISSED_TYPE);
- assertCallTypeIconsEquals(TEST_MISSED_DRAWABLE);
+ assertCallTypeIconsEquals(R.id.call_log_missed_call_icon);
setPhoneCallDetailsWithCallTypeIcons(Calls.VOICEMAIL_TYPE);
- assertCallTypeIconsEquals(TEST_VOICEMAIL_DRAWABLE);
+ assertCallTypeIconsEquals(R.id.call_log_voicemail_icon);
+ }
+
+ public void testSetPhoneCallDetails_MultipleCallTypeIcons() {
+ setPhoneCallDetailsWithCallTypeIcons(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
+ assertCallTypeIconsEquals(R.id.call_log_incoming_call_icon,
+ R.id.call_log_outgoing_call_icon);
+
+ setPhoneCallDetailsWithCallTypeIcons(Calls.MISSED_TYPE, Calls.MISSED_TYPE);
+ assertCallTypeIconsEquals(R.id.call_log_missed_call_icon, R.id.call_log_missed_call_icon);
}
public void testSetPhoneCallDetails_CallTypeText() {
@@ -187,6 +181,13 @@
}
}
+ public void testSetPhoneCallDetails_NameOnly() {
+ setPhoneCallDetailsNameOnly();
+ assertEquals(View.VISIBLE, mViews.nameView.getVisibility());
+ assertEquals(View.GONE, mViews.numberView.getVisibility());
+ assertEquals(View.GONE, mViews.callTypeView.getVisibility());
+ }
+
/** Asserts that the name text field contains the value of the given string resource. */
private void assertNameEqualsResource(int resId) {
assertNameEquals(getContext().getString(resId));
@@ -208,12 +209,11 @@
}
/** Asserts that the call type contains the images with the given drawables. */
- private void assertCallTypeIconsEquals(Drawable... drawables) {
- assertEquals(drawables.length, mViews.callTypeIcons.getChildCount());
- for (int index = 0; index < drawables.length; ++index) {
- Drawable drawable = drawables[index];
- ImageView imageView = (ImageView) mViews.callTypeIcons.getChildAt(index);
- assertEquals(drawable, imageView.getDrawable());
+ private void assertCallTypeIconsEquals(int... ids) {
+ assertEquals(ids.length, mViews.callTypeIcons.getChildCount());
+ for (int index = 0; index < ids.length; ++index) {
+ int id = ids[index];
+ assertEquals(id, mViews.callTypeIcons.getChildAt(index).getId());
}
assertEquals(View.VISIBLE, mViews.callTypeIcons.getVisibility());
assertEquals(View.GONE, mViews.callTypeText.getVisibility());
@@ -233,7 +233,7 @@
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(number, formattedNumber, TEST_COUNTRY_ISO,
new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION),
- false, false);
+ false, false, false);
}
/** Sets the phone call details with default values and the given date. */
@@ -241,7 +241,7 @@
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO,
new int[]{ Calls.INCOMING_TYPE }, date, TEST_DURATION),
- false, false);
+ false, false, false);
}
/** Sets the phone call details with default values and the given call types using icons. */
@@ -258,6 +258,13 @@
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO,
callTypes, TEST_DATE, TEST_DURATION),
- useIcons, false);
+ useIcons, false, false);
+ }
+
+ private void setPhoneCallDetailsNameOnly() {
+ mHelper.setPhoneCallDetails(mViews,
+ new PhoneCallDetails(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO,
+ new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION),
+ true, false, true);
}
}
diff --git a/tests/src/com/android/contacts/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/contacts/calllog/CallLogListItemHelperTest.java
index 626d7c6..79ebf4d 100644
--- a/tests/src/com/android/contacts/calllog/CallLogListItemHelperTest.java
+++ b/tests/src/com/android/contacts/calllog/CallLogListItemHelperTest.java
@@ -18,19 +18,14 @@
import com.android.contacts.PhoneCallDetails;
import com.android.contacts.PhoneCallDetailsHelper;
-import com.android.contacts.PhoneCallDetailsViews;
-import com.android.contacts.R;
import com.android.internal.telephony.CallerInfo;
import android.content.Context;
import android.content.res.Resources;
import android.provider.CallLog.Calls;
import android.test.AndroidTestCase;
+import android.view.LayoutInflater;
import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.QuickContactBadge;
-import android.widget.TextView;
/**
* Unit tests for {@link CallLogListItemHelper}.
@@ -61,21 +56,14 @@
super.setUp();
Context context = getContext();
Resources resources = context.getResources();
- CallTypeHelper callTypeHelper = new CallTypeHelper(resources,
- resources.getDrawable(R.drawable.ic_call_incoming_holo_dark),
- resources.getDrawable(R.drawable.ic_call_outgoing_holo_dark),
- resources.getDrawable(R.drawable.ic_call_missed_holo_dark),
- resources.getDrawable(R.drawable.ic_call_voicemail_holo_dark));
+ LayoutInflater layoutInflater =
+ (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ CallTypeHelper callTypeHelper = new CallTypeHelper(resources, layoutInflater);
mPhoneNumberHelper = new PhoneNumberHelper(resources, TEST_VOICEMAIL_NUMBER);
- PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper(context,
+ PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper(
resources, callTypeHelper, mPhoneNumberHelper);
mHelper = new CallLogListItemHelper(phoneCallDetailsHelper, mPhoneNumberHelper);
- mViews = CallLogListItemViews.createForTest(new QuickContactBadge(context),
- new ImageView(context), new ImageView(context), new View(context),
- PhoneCallDetailsViews.createForTest(new TextView(context),
- new LinearLayout(context), new TextView(context), new TextView(context),
- new TextView(context), new TextView(context)),
- new View(context), new View(context), new TextView(context));
+ mViews = CallLogListItemViews.createForTest(context);
}
@Override
@@ -89,6 +77,7 @@
setPhoneCallDetailsWithNumber("12125551234", "1-212-555-1234");
assertEquals(View.VISIBLE, mViews.callView.getVisibility());
assertEquals(View.GONE, mViews.playView.getVisibility());
+ assertEquals(View.GONE, mViews.unheardView.getVisibility());
}
public void testSetPhoneCallDetails_Unknown() {
@@ -110,34 +99,39 @@
setPhoneCallDetailsWithNumber(TEST_VOICEMAIL_NUMBER, TEST_VOICEMAIL_NUMBER);
assertEquals(View.VISIBLE, mViews.callView.getVisibility());
assertEquals(View.GONE, mViews.playView.getVisibility());
+ assertEquals(View.GONE, mViews.unheardView.getVisibility());
}
- public void testSetPhoneCallDetails_Voicemail() {
+ public void testSetPhoneCallDetails_ReadVoicemail() {
setPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
- assertEquals(View.VISIBLE, mViews.callView.getVisibility());
+ assertEquals(View.GONE, mViews.callView.getVisibility());
assertEquals(View.VISIBLE, mViews.playView.getVisibility());
+ assertEquals(View.GONE, mViews.unheardView.getVisibility());
+ }
+
+ public void testSetPhoneCallDetails_UnreadVoicemail() {
+ setUnreadPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
+ assertEquals(View.GONE, mViews.callView.getVisibility());
+ assertEquals(View.VISIBLE, mViews.playView.getVisibility());
+ assertEquals(View.VISIBLE, mViews.unheardView.getVisibility());
}
public void testSetPhoneCallDetails_VoicemailFromUnknown() {
setPhoneCallDetailsWithNumberAndType(CallerInfo.UNKNOWN_NUMBER, CallerInfo.UNKNOWN_NUMBER,
Calls.VOICEMAIL_TYPE);
+ assertEquals(View.GONE, mViews.callView.getVisibility());
assertEquals(View.VISIBLE, mViews.playView.getVisibility());
- assertEmptyCallButton();
+ assertEquals(View.GONE, mViews.unheardView.getVisibility());
}
/** Asserts that the whole call area is gone. */
private void assertNoCallButton() {
assertEquals(View.GONE, mViews.callView.getVisibility());
assertEquals(View.GONE, mViews.playView.getVisibility());
+ assertEquals(View.GONE, mViews.unheardView.getVisibility());
assertEquals(View.GONE, mViews.dividerView.getVisibility());
}
- /** Asserts that the call area is present but empty. */
- private void assertEmptyCallButton() {
- assertEquals(View.INVISIBLE, mViews.callView.getVisibility());
- assertEquals(View.VISIBLE, mViews.dividerView.getVisibility());
- }
-
/** Sets the details of a phone call using the specified phone number. */
private void setPhoneCallDetailsWithNumber(String number, String formattedNumber) {
setPhoneCallDetailsWithNumberAndType(number, formattedNumber, Calls.INCOMING_TYPE);
@@ -159,4 +153,12 @@
types, TEST_DATE, TEST_DURATION),
true, false);
}
+
+ /** Sets the details of a phone call using the specified call type. */
+ private void setUnreadPhoneCallDetailsWithTypes(int... types) {
+ mHelper.setPhoneCallDetails(mViews,
+ new PhoneCallDetails(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO,
+ types, TEST_DATE, TEST_DURATION),
+ true, true);
+ }
}