Merge "Rename tab "Contacts" to "All""
diff --git a/res/drawable-hdpi/call_log_action_bar_bg.9.png b/res/drawable-hdpi/call_log_action_bar_bg.9.png
new file mode 100644
index 0000000..2e4d0ca
--- /dev/null
+++ b/res/drawable-hdpi/call_log_action_bar_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_call_log_home.png b/res/drawable-hdpi/ic_call_log_home.png
new file mode 100644
index 0000000..c7c8f16
--- /dev/null
+++ b/res/drawable-hdpi/ic_call_log_home.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_call_log_list_incoming_call.png b/res/drawable-hdpi/ic_call_log_list_incoming_call.png
index 15b5e44..624a0c5 100644
--- a/res/drawable-hdpi/ic_call_log_list_incoming_call.png
+++ b/res/drawable-hdpi/ic_call_log_list_incoming_call.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_call_log_list_missed_call.png b/res/drawable-hdpi/ic_call_log_list_missed_call.png
index 8dcb279..bd572cd 100644
--- a/res/drawable-hdpi/ic_call_log_list_missed_call.png
+++ b/res/drawable-hdpi/ic_call_log_list_missed_call.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_call_log_list_outgoing_call.png b/res/drawable-hdpi/ic_call_log_list_outgoing_call.png
index 160c707..1a93a78 100644
--- a/res/drawable-hdpi/ic_call_log_list_outgoing_call.png
+++ b/res/drawable-hdpi/ic_call_log_list_outgoing_call.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_call_log_list_voicemail.png b/res/drawable-hdpi/ic_call_log_list_voicemail.png
index d2ee44f..0c2a6f4 100644
--- a/res/drawable-hdpi/ic_call_log_list_voicemail.png
+++ b/res/drawable-hdpi/ic_call_log_list_voicemail.png
Binary files differ
diff --git a/res/drawable-mdpi/call_log_action_bar_bg.9.png b/res/drawable-mdpi/call_log_action_bar_bg.9.png
new file mode 100644
index 0000000..2e4d0ca
--- /dev/null
+++ b/res/drawable-mdpi/call_log_action_bar_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_call_log_home.png b/res/drawable-mdpi/ic_call_log_home.png
new file mode 100644
index 0000000..c7c8f16
--- /dev/null
+++ b/res/drawable-mdpi/ic_call_log_home.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_call_log_list_incoming_call.png b/res/drawable-mdpi/ic_call_log_list_incoming_call.png
index c7eec52..77be776 100644
--- a/res/drawable-mdpi/ic_call_log_list_incoming_call.png
+++ b/res/drawable-mdpi/ic_call_log_list_incoming_call.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_call_log_list_missed_call.png b/res/drawable-mdpi/ic_call_log_list_missed_call.png
index 1907a62..66c8d85 100644
--- a/res/drawable-mdpi/ic_call_log_list_missed_call.png
+++ b/res/drawable-mdpi/ic_call_log_list_missed_call.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_call_log_list_outgoing_call.png b/res/drawable-mdpi/ic_call_log_list_outgoing_call.png
index 041d086..a7f85b2 100644
--- a/res/drawable-mdpi/ic_call_log_list_outgoing_call.png
+++ b/res/drawable-mdpi/ic_call_log_list_outgoing_call.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_call_log_list_voicemail.png b/res/drawable-mdpi/ic_call_log_list_voicemail.png
index d2ee44f..6aec9ed 100644
--- a/res/drawable-mdpi/ic_call_log_list_voicemail.png
+++ b/res/drawable-mdpi/ic_call_log_list_voicemail.png
Binary files differ
diff --git a/res/layout-sw580dp/item_kind_section.xml b/res/layout-sw580dp/item_kind_section.xml
index f0ae1dc..dd38e26 100644
--- a/res/layout-sw580dp/item_kind_section.xml
+++ b/res/layout-sw580dp/item_kind_section.xml
@@ -4,9 +4,9 @@
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.
@@ -22,11 +22,11 @@
android:layout_height="wrap_content"
android:paddingBottom="@dimen/editor_field_bottom_padding"
android:orientation="vertical">
-
- <View
+ <ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/divider_horizontal_light" />
+ android:scaleType="fitXY"
+ android:src="@drawable/divider_horizontal_light" />
<LinearLayout
android:id="@+id/kind_editors"
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index 83c8f1b..1fe6faa 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -19,100 +19,91 @@
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="top"
- android:paddingTop="?attr/call_detail_top_gap"
- android:background="?attr/call_detail_transparent_background"
>
+ <LinearLayout
+ android:id="@+id/action_bar"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/call_detail_action_bar_height"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true"
+ android:orientation="horizontal"
+ android:background="@drawable/call_log_action_bar_bg"
+ >
+ <ImageView
+ android:id="@+id/action_bar_home"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_call_log_home"
+ />
+ </LinearLayout>
<ImageView
android:id="@+id/contact_background"
android:layout_width="match_parent"
android:layout_height="?attr/call_detail_contact_background_height"
android:layout_alignParentLeft="true"
- android:layout_alignParentTop="true"
+ android:layout_below="@id/action_bar"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:background="@drawable/ic_contact_picture"
/>
- <View
- android:id="@+id/contact_background_overlay"
+ <ListView
+ android:id="@android:id/list"
android:layout_width="match_parent"
- android:layout_height="?attr/call_detail_contact_background_height"
- android:layout_alignParentLeft="true"
- android:layout_alignParentTop="true"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/contact_background"
android:background="?attr/call_detail_primary_background_color"
- android:alpha="?attr/call_detail_contact_background_overlay_alpha"
/>
-
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="?attr/call_detail_contact_background_overlay_height"
+ android:background="#3F000000"
+ android:layout_alignParentLeft="true"
+ android:layout_above="@android:id/list"
+ />
<RelativeLayout
android:id="@+id/photo_panel"
android:layout_width="match_parent"
- android:layout_height="?attr/call_detail_contact_background_height"
+ android:layout_height="?attr/call_detail_contact_background_overlay_height"
android:layout_alignParentLeft="true"
- android:layout_alignParentTop="true"
- android:paddingBottom="10dp"
+ android:layout_above="@android:id/list"
+ android:paddingLeft="5dip"
>
- <ImageView
- android:id="@+id/contact_photo"
- android:layout_width="?attr/call_detail_contact_photo_size"
- android:layout_height="?attr/call_detail_contact_photo_size"
- android:layout_alignParentLeft="true"
- android:layout_alignParentBottom="true"
-
- android:background="@drawable/ic_contact_picture"
- />
<RelativeLayout
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
- android:layout_toRightOf="@id/contact_photo"
- android:layout_marginLeft="10dp"
>
<include layout="@layout/call_log_phone_call_details" />
</RelativeLayout>
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="?attr/call_detail_action_icon_size"
+ <ImageView
+ android:id="@+id/main_action"
+ android:layout_width="?attr/call_detail_action_icon_size"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:scaleType="center"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
- android:layout_marginBottom="10dp"
- >
- <ImageView
- android:id="@+id/call"
- android:layout_width="?attr/call_detail_action_icon_size"
- android:layout_height="?attr/call_detail_action_icon_size"
- android:layout_alignParentRight="true"
- android:gravity="center_vertical"
- android:src="@drawable/ic_call_log_list_action_call"
- android:scaleType="center"
- />
- <View
- android:id="@+id/divider"
- android:layout_width="1px"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
- android:layout_marginBottom="5dip"
- android:layout_toLeftOf="@id/call"
- android:layout_marginLeft="11dip"
- android:background="#FFFFFF"
- />
- </RelativeLayout>
+ />
</RelativeLayout>
<RelativeLayout
android:id="@+id/call_panel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
- android:layout_below="@id/photo_panel"
+ android:layout_below="@android:id/list"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:paddingLeft="80dp"
- android:background="#FFFFFF"
+ android:background="?attr/call_detail_secondary_background_color"
>
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
+ android:textColor="?attr/call_detail_secondary_text_color"
/>
<TextView
android:id="@+id/duration"
@@ -121,6 +112,7 @@
android:layout_alignParentLeft="true"
android:layout_below="@id/time"
android:layout_alignLeft="@id/time"
+ android:textColor="?attr/call_detail_secondary_text_color"
/>
<ImageView
android:id="@+id/delete"
@@ -133,11 +125,4 @@
android:visibility="gone"
/>
</RelativeLayout>
- <ListView
- android:id="@android:id/list"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/call_panel"
- android:background="?attr/call_detail_secondary_background_color"
- />
</RelativeLayout>
diff --git a/res/layout/call_log_phone_call_details.xml b/res/layout/call_log_phone_call_details.xml
index e58de21..5da2773 100644
--- a/res/layout/call_log_phone_call_details.xml
+++ b/res/layout/call_log_phone_call_details.xml
@@ -15,15 +15,6 @@
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <TextView
- android:id="@+id/number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?attr/call_detail_primary_text_color"
- android:layout_alignParentLeft="true"
- android:layout_alignParentBottom="true"
- />
<LinearLayout
android:id="@+id/call_types"
android:layout_width="wrap_content"
@@ -31,7 +22,7 @@
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/call_detail_primary_text_color"
android:layout_alignParentLeft="true"
- android:layout_above="@id/number"
+ android:layout_alignParentBottom="true"
/>
<TextView
android:id="@+id/date"
@@ -40,8 +31,17 @@
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/call_detail_primary_text_color"
android:layout_toRightOf="@id/call_types"
- android:layout_above="@id/number"
android:layout_marginLeft="?attr/call_detail_date_margin"
+ android:layout_alignParentBottom="true"
+ />
+ <TextView
+ android:id="@+id/number"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?attr/call_detail_primary_text_color"
+ android:layout_alignParentLeft="true"
+ android:layout_above="@id/call_types"
/>
<TextView
android:id="@+id/name"
@@ -50,7 +50,7 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?attr/call_detail_primary_text_color"
android:layout_alignParentLeft="true"
- android:layout_above="@id/call_types"
+ android:layout_above="@id/number"
android:paddingBottom="2dp"
/>
</merge>
diff --git a/res/layout/custom_action_bar.xml b/res/layout/custom_action_bar.xml
index 2357756..f749586 100644
--- a/res/layout/custom_action_bar.xml
+++ b/res/layout/custom_action_bar.xml
@@ -14,11 +14,20 @@
limitations under the License.
-->
+<!-- Dimensions are set at runtime in ActionBarAdapter -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
+ android:layout_width="0dip"
+ android:layout_height="0dip" >
+ <!-- To prevent the search view from getting the initial focus. -->
+ <View
+ android:focusable="true"
+ android:focusableInTouchMode="true"
+ android:layout_width="1px"
+ android:layout_height="1px" >
+ <requestFocus />
+ </View>
<SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
diff --git a/res/menu-sw580dp-w720dp/actions.xml b/res/menu-sw580dp-w720dp/actions.xml
index 081065c..d87b091 100644
--- a/res/menu-sw580dp-w720dp/actions.xml
+++ b/res/menu-sw580dp-w720dp/actions.xml
@@ -15,11 +15,6 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
- android:id="@+id/menu_search"
- android:showAsAction="always"
- android:actionViewClass="android.widget.SearchView" />
-
- <item
android:id="@+id/menu_add_contact"
android:icon="@drawable/ic_menu_add_contact_holo_light"
android:title="@string/menu_new_contact_action_bar"
diff --git a/res/menu-sw580dp/actions.xml b/res/menu-sw580dp/actions.xml
index 1d955c1..fea883e 100644
--- a/res/menu-sw580dp/actions.xml
+++ b/res/menu-sw580dp/actions.xml
@@ -15,11 +15,6 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
- android:id="@+id/menu_search"
- android:showAsAction="always"
- android:actionViewClass="android.widget.SearchView" />
-
- <item
android:id="@+id/menu_add_contact"
android:icon="@drawable/ic_menu_add_contact_holo_light"
android:title="@string/menu_new_contact_action_bar"
diff --git a/res/values-sw580dp/dimens.xml b/res/values-sw580dp/dimens.xml
index 0c1e5fb..bcaf1d2 100644
--- a/res/values-sw580dp/dimens.xml
+++ b/res/values-sw580dp/dimens.xml
@@ -33,4 +33,5 @@
<dimen name="list_section_height">37dip</dimen>
<dimen name="directory_header_height">56dip</dimen>
<dimen name="detail_tab_carousel_height">256dip</dimen>
+ <dimen name="search_view_width">400dip</dimen>
</resources>
diff --git a/res/values-sw580dp/donottranslate_config.xml b/res/values-sw580dp/donottranslate_config.xml
index fcb7da9..5ca1af6 100644
--- a/res/values-sw580dp/donottranslate_config.xml
+++ b/res/values-sw580dp/donottranslate_config.xml
@@ -19,4 +19,5 @@
<resources>
<bool name="config_use_two_panes">true</bool>
+ <bool name="always_show_search_view">true</bool>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index a0c4845..948d357 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -148,7 +148,7 @@
<!-- Spacing on the left the search field in the action bar -->
<dimen name="action_bar_search_spacing">12dip</dimen>
- <!-- Size of the shortcut icon. 0dip means: use the system default -->
+ <!-- Size of the shortcut icon. 0dip means: use the system default -->
<dimen name="shortcut_icon_size">0dip</dimen>
<!-- Height of list sections (A, B, C) that show the first character of the contacts -->
@@ -181,4 +181,7 @@
<dimen name="dialpad_digits_margin_top">1dip</dimen>
<!-- Just used in landscape mode -->
<dimen name="dialpad_digits_margin_bottom">50dip</dimen>
+
+ <!-- Width of search view in action bar. Use 0dip for MATCH_PARENT -->
+ <dimen name="search_view_width">0dip</dimen>
</resources>
diff --git a/res/values/donottranslate_config.xml b/res/values/donottranslate_config.xml
index e310953..c778212 100644
--- a/res/values/donottranslate_config.xml
+++ b/res/values/donottranslate_config.xml
@@ -103,4 +103,8 @@
<!-- If true, Contacts uses two panes: List and Detail. If false, Details are
shown in their own screens. This flag must be in sync with the layout definitions. -->
<bool name="config_use_two_panes">false</bool>
+
+ <!-- If true, search view on action bar will always be visible. If false, it'll only be
+ visible in search mode. -->
+ <bool name="always_show_search_view">false</bool>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 0cf8e25..067a730 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -42,22 +42,20 @@
<item name="call_log_list_item_height">60dip</item>
</style>
- <style name="CallDetailActivityTheme" parent="android:Theme.Holo.Light">
- <item name="android:windowContentOverlay">@null</item>
- <item name="android:windowIsTranslucent">true</item>
+ <style name="CallDetailActivityTheme" parent="android:Theme.Holo">
<item name="android:windowNoTitle">true</item>
- <item name="android:windowBackground">@android:color/transparent</item>
<item name="android:gravity">top</item>
- <item name="call_detail_top_gap">49dip</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>
- <item name="call_detail_primary_background_color">#000000</item>
- <item name="call_detail_contact_photo_size">60dip</item>
<item name="call_detail_primary_text_color">#FFFFFF</item>
- <item name="call_detail_action_icon_size">50dip</item>
- <item name="call_detail_secondary_background_color">#FFFFFF</item>
<item name="call_detail_date_margin">5dip</item>
+ <item name="call_detail_primary_background_color">#000000</item>
+ <item name="call_detail_secondary_text_color">#FFFFFF</item>
+ <item name="call_detail_secondary_background_color">#333333</item>
</style>
<style name="ContactDetailActivityTheme" parent="android:Theme.Holo.Light">
@@ -133,14 +131,16 @@
</declare-styleable>
<declare-styleable name="CallDetailActivity">
- <attr name="call_detail_top_gap" format="dimension" />
<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" />
<attr name="call_detail_primary_text_color" format="color" />
<attr name="call_detail_primary_background_color" format="color" />
+ <attr name="call_detail_secondary_text_color" format="color" />
<attr name="call_detail_secondary_background_color" format="color" />
<attr name="call_detail_date_margin" format="dimension" />
</declare-styleable>
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index f87f8a4..a4a578f 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -61,8 +61,8 @@
private PhoneCallDetailsHelper mPhoneCallDetailsHelper;
private TextView mCallTimeView;
private TextView mCallDurationView;
- private View mCallActionView;
- private ImageView mContactPhotoView;
+ private View mHomeActionView;
+ private ImageView mMainActionView;
private ImageView mContactBackgroundView;
private String mNumber = null;
@@ -121,14 +121,22 @@
getResources().getDrawable(R.drawable.ic_call_log_list_outgoing_call),
getResources().getDrawable(R.drawable.ic_call_log_list_missed_call),
getResources().getDrawable(R.drawable.ic_call_log_list_voicemail));
- mCallActionView = findViewById(R.id.call);
- mContactPhotoView = (ImageView) findViewById(R.id.contact_photo);
+ mHomeActionView = findViewById(R.id.action_bar_home);
+ mMainActionView = (ImageView) findViewById(R.id.main_action);
mContactBackgroundView = (ImageView) findViewById(R.id.contact_background);
mCallTimeView = (TextView) findViewById(R.id.time);
mCallDurationView = (TextView) findViewById(R.id.duration);
mDefaultCountryIso = ContactsUtils.getCurrentCountryIso(this);
mContactPhotoManager = ContactPhotoManager.getInstance(this);
getListView().setOnItemClickListener(this);
+ mHomeActionView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // We want this to start the call log if this activity was not started from the
+ // call log itself.
+ CallDetailActivity.this.finish();
+ }
+ });
}
@Override
@@ -198,7 +206,7 @@
mNumber.equals(CallerInfo.PRIVATE_NUMBER)) {
numberText = getString(mNumber.equals(CallerInfo.PRIVATE_NUMBER)
? R.string.private_num : R.string.unknown);
- mCallActionView.setVisibility(View.GONE);
+ mMainActionView.setVisibility(View.GONE);
} else {
// Perform a reverse-phonebook lookup to find the PERSON_ID
Uri personUri = null;
@@ -227,38 +235,42 @@
}
numberText = mNumber;
- mCallActionView.setVisibility(View.VISIBLE);
- mCallActionView.setOnClickListener(new View.OnClickListener() {
+ // Let user view contact details if they exist, otherwise add option
+ // to create new contact from this number.
+ final Intent mainActionIntent;
+ final int mainActionIcon;
+ if (personUri != null) {
+ mainActionIntent = new Intent(Intent.ACTION_VIEW, personUri);
+ mainActionIcon = R.drawable.sym_action_view_contact;
+ } else {
+ mainActionIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
+ mainActionIntent.setType(Contacts.CONTENT_ITEM_TYPE);
+ mainActionIntent.putExtra(Insert.PHONE, mNumber);
+ mainActionIcon = R.drawable.sym_action_add;
+ }
+
+ mMainActionView.setVisibility(View.VISIBLE);
+ mMainActionView.setImageResource(mainActionIcon);
+ mMainActionView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
- Uri.fromParts("tel", mNumber, null));
- startActivity(callIntent);
+ startActivity(mainActionIntent);
}
});
// Build list of various available actions
List<ViewEntry> actions = new ArrayList<ViewEntry>();
+ Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
+ Uri.fromParts("tel", mNumber, null));
+ actions.add(new ViewEntry(android.R.drawable.sym_action_call,
+ getString(R.string.menu_callNumber, mNumber), callIntent));
+
Intent smsIntent = new Intent(Intent.ACTION_SENDTO,
Uri.fromParts("sms", mNumber, null));
actions.add(new ViewEntry(R.drawable.sym_action_sms,
getString(R.string.menu_sendTextMessage), smsIntent));
- // Let user view contact details if they exist, otherwise add option
- // to create new contact from this number.
- if (personUri != null) {
- Intent viewIntent = new Intent(Intent.ACTION_VIEW, personUri);
- actions.add(new ViewEntry(R.drawable.sym_action_view_contact,
- getString(R.string.menu_viewContact), viewIntent));
- } else {
- Intent createIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
- createIntent.setType(Contacts.CONTENT_ITEM_TYPE);
- createIntent.putExtra(Insert.PHONE, mNumber);
- actions.add(new ViewEntry(R.drawable.sym_action_add,
- getString(R.string.recentCalls_addToContact), createIntent));
- }
-
ViewAdapter adapter = new ViewAdapter(this, actions);
setListAdapter(adapter);
}
@@ -282,21 +294,7 @@
/** Load the contact photos and places them in the corresponding views. */
private void loadContactPhotos(final long photoId) {
- // There seem to be a limitation in the ContactPhotoManager that does not allow requesting
- // two photos at once.
- // TODO: Figure out the problem with ContactPhotoManager and remove this nonsense.
- mContactPhotoView.post(new Runnable() {
- @Override
- public void run() {
- mContactPhotoManager.loadPhoto(mContactPhotoView, photoId);
- mContactPhotoView.postDelayed(new Runnable() {
- @Override
- public void run() {
- mContactPhotoManager.loadPhoto(mContactBackgroundView, photoId);
- }
- }, 100);
- }
- });
+ mContactPhotoManager.loadPhoto(mContactBackgroundView, photoId);
}
private String formatDuration(long elapsedSeconds) {
diff --git a/src/com/android/contacts/ContactPhotoManager.java b/src/com/android/contacts/ContactPhotoManager.java
index e61d379..fe73fbe 100644
--- a/src/com/android/contacts/ContactPhotoManager.java
+++ b/src/com/android/contacts/ContactPhotoManager.java
@@ -66,11 +66,12 @@
* the available authenticators. This method can safely be called from the UI thread.
*/
public static ContactPhotoManager getInstance(Context context) {
+ Context applicationContext = context.getApplicationContext();
ContactPhotoManager service =
- (ContactPhotoManager) context.getSystemService(CONTACT_PHOTO_SERVICE);
+ (ContactPhotoManager) applicationContext.getSystemService(CONTACT_PHOTO_SERVICE);
if (service == null) {
- service = createContactPhotoManager(context);
- Log.e(TAG, "No contact photo service in context: " + context);
+ service = createContactPhotoManager(applicationContext);
+ Log.e(TAG, "No contact photo service in context: " + applicationContext);
}
return service;
}
diff --git a/src/com/android/contacts/GroupMetaDataLoader.java b/src/com/android/contacts/GroupMetaDataLoader.java
index d900825..8533bb6 100644
--- a/src/com/android/contacts/GroupMetaDataLoader.java
+++ b/src/com/android/contacts/GroupMetaDataLoader.java
@@ -34,6 +34,7 @@
Groups.AUTO_ADD,
Groups.FAVORITES,
Groups.GROUP_IS_READ_ONLY,
+ Groups.DELETED,
};
public final static int ACCOUNT_NAME = 0;
@@ -43,6 +44,7 @@
public final static int AUTO_ADD = 4;
public final static int FAVORITES = 5;
public final static int IS_READ_ONLY = 6;
+ public final static int DELETED = 7;
public GroupMetaDataLoader(Context context, Uri groupUri) {
super(context, ensureIsGroupUri(groupUri), COLUMNS, Groups.ACCOUNT_TYPE + " NOT NULL AND "
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index 073f665..e0f8aef 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -58,27 +58,24 @@
private SearchView mSearchView;
private final Context mContext;
+ private final boolean mAlwaysShowSearchView;
private Listener mListener;
private ContactListFilterController mFilterController;
private ActionBar mActionBar;
- private View mCustomSearchView;
- private LayoutParams mLayoutParams;
- private boolean mIsSearchInOverflowMenu;
public ActionBarAdapter(Context context, Listener listener) {
mContext = context;
mListener = listener;
mSearchLabelText = mContext.getString(R.string.search_label);
+ mAlwaysShowSearchView = mContext.getResources().getBoolean(R.bool.always_show_search_view);
}
- public void onCreate(Bundle savedState, ContactsRequest request, ActionBar actionBar,
- boolean searchInOverflowMenu) {
+ public void onCreate(Bundle savedState, ContactsRequest request, ActionBar actionBar) {
mActionBar = actionBar;
mQueryString = null;
- mIsSearchInOverflowMenu = searchInOverflowMenu;
if (savedState != null) {
mSearchMode = savedState.getBoolean(EXTRA_KEY_SEARCH_MODE);
@@ -88,18 +85,23 @@
mQueryString = request.getQueryString();
}
- if (mSearchView != null) {
- mSearchView.setQuery(mQueryString, false);
+ // Set up search view.
+ View customSearchView = LayoutInflater.from(mContext).inflate(R.layout.custom_action_bar,
+ null);
+ int searchViewWidth = mContext.getResources().getDimensionPixelSize(
+ R.dimen.search_view_width);
+ if (searchViewWidth == 0) {
+ searchViewWidth = LayoutParams.MATCH_PARENT;
}
-
- update();
- }
-
- public void setSearchView(SearchView searchView) {
- mSearchView = searchView;
+ LayoutParams layoutParams = new LayoutParams(searchViewWidth, LayoutParams.WRAP_CONTENT);
+ mSearchView = (SearchView) customSearchView.findViewById(R.id.search_view);
+ mSearchView.setQueryHint(mContext.getString(R.string.hint_findContacts));
mSearchView.setOnQueryTextListener(this);
mSearchView.setOnCloseListener(this);
mSearchView.setQuery(mQueryString, false);
+ mActionBar.setCustomView(customSearchView, layoutParams);
+
+ update();
}
public void setListener(Listener listener) {
@@ -111,10 +113,6 @@
mFilterController.addListener(this);
}
- public boolean isSearchInOverflowMenu() {
- return mIsSearchInOverflowMenu;
- }
-
public boolean isSearchMode() {
return mSearchMode;
}
@@ -127,7 +125,7 @@
return;
}
if (mSearchMode) {
- mSearchView.requestFocus();
+ setFocusOnSearchView();
} else {
mSearchView.setQuery(null, false);
}
@@ -147,31 +145,20 @@
public void update() {
if (mSearchMode) {
- // If the search icon was in the overflow menu, then inflate a custom view containing
- // a search view for the action bar (and hide the tabs).
- if (mIsSearchInOverflowMenu) {
- if (mCustomSearchView == null) {
- mCustomSearchView = LayoutInflater.from(mContext).inflate(
- R.layout.custom_action_bar, null);
- mLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
- LayoutParams.WRAP_CONTENT);
- SearchView searchView = (SearchView) mCustomSearchView.
- findViewById(R.id.search_view);
- searchView.setQueryHint(mContext.getString(R.string.hint_findContacts));
- setSearchView(searchView);
- }
- mActionBar.setDisplayShowCustomEnabled(true);
- mActionBar.setCustomView(mCustomSearchView, mLayoutParams);
- mSearchView.requestFocus();
- } else {
+ mActionBar.setDisplayShowCustomEnabled(true);
+ if (mAlwaysShowSearchView) {
+ // Tablet -- change the app title for the search mode
mActionBar.setTitle(mSearchLabelText);
+ } else {
+ // Phone -- search view gets focus
+ setFocusOnSearchView();
}
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
if (mListener != null) {
mListener.onAction(Action.START_SEARCH_MODE);
}
} else {
- mActionBar.setDisplayShowCustomEnabled(false);
+ mActionBar.setDisplayShowCustomEnabled(mAlwaysShowSearchView);
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mActionBar.setTitle(null);
if (mListener != null) {
@@ -236,4 +223,9 @@
@Override
public void onContactListFilterCustomizationRequest() {
}
+
+ private void setFocusOnSearchView() {
+ mSearchView.requestFocus();
+ mSearchView.setIconified(false); // Workaround for the "IME not popping up" issue.
+ }
}
diff --git a/src/com/android/contacts/activities/GroupDetailActivity.java b/src/com/android/contacts/activities/GroupDetailActivity.java
index 21900c6..c8f511b 100644
--- a/src/com/android/contacts/activities/GroupDetailActivity.java
+++ b/src/com/android/contacts/activities/GroupDetailActivity.java
@@ -43,6 +43,7 @@
R.id.group_detail_fragment);
fragment.setListener(mFragmentListener);
fragment.loadGroup(getIntent().getData());
+ fragment.closeActivityAfterDelete(true);
ActionBar actionBar = getActionBar();
if (actionBar != null) {
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index b6676c2..19019f4 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -303,7 +303,7 @@
setTitle(mRequest.getActivityTitle());
ActionBar actionBar = getActionBar();
mActionBarAdapter = new ActionBarAdapter(this, this);
- mActionBarAdapter.onCreate(savedState, mRequest, getActionBar(), !mContentPaneDisplayed);
+ mActionBarAdapter.onCreate(savedState, mRequest, getActionBar());
mActionBarAdapter.setContactListFilterController(mContactListFilterController);
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
@@ -935,16 +935,6 @@
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.actions, menu);
- MenuItem searchMenuItem = menu.findItem(R.id.menu_search);
- if (searchMenuItem != null && searchMenuItem.getActionView() instanceof SearchView) {
- SearchView searchView = (SearchView) searchMenuItem.getActionView();
- searchView.setQueryHint(getString(R.string.hint_findContacts));
- searchView.setIconifiedByDefault(false);
-
- if (mActionBarAdapter != null) {
- mActionBarAdapter.setSearchView(searchView);
- }
- }
// On narrow screens we specify a NEW group button in the {@link ActionBar}, so that
// it can be in the overflow menu. On wide screens, we use a custom view because we need
@@ -1009,10 +999,8 @@
if (mActionBarAdapter.isSearchMode()) {
addContactMenu.setVisible(false);
addGroupMenu.setVisible(false);
- // If search is normally in the overflow menu, when we are in search
- // mode, hide this option.
- if (mActionBarAdapter.isSearchInOverflowMenu()) {
- searchMenu.setVisible(false);
+ if (searchMenu != null) {
+ searchMenu.setVisible(false); // Don't show the search menu in search mode.
}
} else {
switch (mSelectedTab) {
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 2cd7b3c..ece2a29 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -110,6 +110,7 @@
private static final String KEY_VIEW_ID_GENERATOR = "viewidgenerator";
private static final String KEY_CURRENT_PHOTO_FILE = "currentphotofile";
private static final String KEY_CONTACT_ID_FOR_JOIN = "contactidforjoin";
+ private static final String KEY_CONTACT_WRITABLE_FOR_JOIN = "contactwritableforjoin";
private static final String KEY_SHOW_JOIN_SUGGESTIONS = "showJoinSuggestions";
private static final String KEY_ENABLED = "enabled";
private static final String KEY_STATUS = "status";
@@ -222,6 +223,7 @@
private Listener mListener;
private long mContactIdForJoin;
+ private boolean mContactWritableForJoin;
private LinearLayout mContent;
private EntityDeltaList mState;
@@ -274,9 +276,7 @@
// If anything was left unsaved, save it now but keep the editor open.
if (!getActivity().isChangingConfigurations() && mStatus == Status.EDITING) {
- if (mStatus != SaveMode.JOIN) {
- save(SaveMode.RELOAD);
- }
+ save(SaveMode.RELOAD);
}
}
@@ -373,6 +373,7 @@
mCurrentPhotoFile = new File(fileName);
}
mContactIdForJoin = savedState.getLong(KEY_CONTACT_ID_FOR_JOIN);
+ mContactWritableForJoin = savedState.getBoolean(KEY_CONTACT_WRITABLE_FOR_JOIN);
mAggregationSuggestionsRawContactId = savedState.getLong(KEY_SHOW_JOIN_SUGGESTIONS);
mEnabled = savedState.getBoolean(KEY_ENABLED);
mStatus = savedState.getInt(KEY_STATUS);
@@ -981,17 +982,17 @@
case SaveMode.RELOAD:
case SaveMode.JOIN:
if (success && contactLookupUri != null) {
+ // If it was a JOIN, we are now ready to bring up the join activity.
+ if (saveMode == SaveMode.JOIN) {
+ showJoinAggregateActivity(contactLookupUri);
+ }
+
// If this was in INSERT, we are changing into an EDIT now.
// If it already was an EDIT, we are changing to the new Uri now
mState = null;
load(Intent.ACTION_EDIT, contactLookupUri, null);
mStatus = Status.LOADING;
getLoaderManager().restartLoader(LOADER_DATA, null, mDataLoaderListener);
-
- // If it was a JOIN, we are now ready to bring up the join activity.
- if (saveMode == SaveMode.JOIN) {
- showJoinAggregateActivity(contactLookupUri);
- }
}
break;
@@ -1017,6 +1018,7 @@
}
mContactIdForJoin = ContentUris.parseId(contactLookupUri);
+ mContactWritableForJoin = isContactWritable();
final Intent intent = new Intent(JoinContactActivity.JOIN_CONTACT);
intent.putExtra(JoinContactActivity.EXTRA_TARGET_CONTACT_ID, mContactIdForJoin);
startActivityForResult(intent, REQUEST_CODE_JOIN);
@@ -1027,7 +1029,7 @@
*/
private void joinAggregate(final long contactId) {
Intent intent = ContactSaveService.createJoinContactsIntent(mContext, mContactIdForJoin,
- contactId, isContactWritable(),
+ contactId, mContactWritableForJoin,
ContactEditorActivity.class, ContactEditorActivity.ACTION_JOIN_COMPLETED);
mContext.startService(intent);
}
@@ -1460,6 +1462,7 @@
outState.putString(KEY_CURRENT_PHOTO_FILE, mCurrentPhotoFile.toString());
}
outState.putLong(KEY_CONTACT_ID_FOR_JOIN, mContactIdForJoin);
+ outState.putBoolean(KEY_CONTACT_WRITABLE_FOR_JOIN, mContactWritableForJoin);
outState.putLong(KEY_SHOW_JOIN_SUGGESTIONS, mAggregationSuggestionsRawContactId);
outState.putBoolean(KEY_ENABLED, mEnabled);
outState.putInt(KEY_STATUS, mStatus);
@@ -1586,6 +1589,7 @@
Log.v(TAG, "Time needed for setting UI: " + (setDataEndTime-setDataStartTime));
}
+ @Override
public void onLoaderReset(Loader<ContactLoader.Result> loader) {
}
};
diff --git a/src/com/android/contacts/group/GroupBrowseListFragment.java b/src/com/android/contacts/group/GroupBrowseListFragment.java
index 59b0cec..4443a53 100644
--- a/src/com/android/contacts/group/GroupBrowseListFragment.java
+++ b/src/com/android/contacts/group/GroupBrowseListFragment.java
@@ -196,6 +196,8 @@
String accountType = mGroupListCursor.getString(GroupMetaDataLoader.ACCOUNT_TYPE);
long groupId = mGroupListCursor.getLong(GroupMetaDataLoader.GROUP_ID);
String title = mGroupListCursor.getString(GroupMetaDataLoader.TITLE);
+ boolean deleted =
+ (mGroupListCursor.getInt(GroupMetaDataLoader.DELETED) == 1);
boolean defaultGroup = mGroupListCursor.isNull(GroupMetaDataLoader.AUTO_ADD)
? false
: mGroupListCursor.getInt(GroupMetaDataLoader.AUTO_ADD) != 0;
@@ -204,8 +206,8 @@
: mGroupListCursor.getInt(GroupMetaDataLoader.FAVORITES) != 0;
// Don't show the "auto-added" (i.e. My Contacts) or "favorites" groups because
- // they show up elsewhere in the app
- if (defaultGroup || favorites) {
+ // they show up elsewhere in the app. Also skip groups that are marked as "deleted"
+ if (defaultGroup || favorites || deleted) {
continue;
}
diff --git a/src/com/android/contacts/group/GroupDetailFragment.java b/src/com/android/contacts/group/GroupDetailFragment.java
index c4824ae..fe2605e 100644
--- a/src/com/android/contacts/group/GroupDetailFragment.java
+++ b/src/com/android/contacts/group/GroupDetailFragment.java
@@ -90,6 +90,7 @@
private String mGroupName;
private boolean mOptionsMenuEditable;
+ private boolean mCloseActivityAfterDelete;
public GroupDetailFragment() {
}
@@ -190,11 +191,20 @@
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
- bindGroupMetaData(data);
+ data.moveToPosition(-1);
+ if (data.moveToNext()) {
+ boolean deleted = data.getInt(GroupMetaDataLoader.DELETED) == 1;
+ if (!deleted) {
+ bindGroupMetaData(data);
- // Retrieve the list of members
- configureAdapter(mGroupId);
- startGroupMembersLoader();
+ // Retrieve the list of members
+ configureAdapter(mGroupId);
+ startGroupMembersLoader();
+ return;
+ }
+ }
+ updateSize(null);
+ updateTitle(null);
}
@Override
@@ -295,10 +305,15 @@
break;
}
case R.id.menu_delete_group: {
- GroupDeletionDialogFragment.show(getFragmentManager(), mGroupId, mGroupName);
+ GroupDeletionDialogFragment.show(getFragmentManager(), mGroupId, mGroupName,
+ mCloseActivityAfterDelete);
return true;
}
}
return false;
}
+
+ public void closeActivityAfterDelete(boolean closeActivity) {
+ mCloseActivityAfterDelete = closeActivity;
+ }
}
diff --git a/src/com/android/contacts/interactions/GroupDeletionDialogFragment.java b/src/com/android/contacts/interactions/GroupDeletionDialogFragment.java
index 44d31be..c9c1342 100644
--- a/src/com/android/contacts/interactions/GroupDeletionDialogFragment.java
+++ b/src/com/android/contacts/interactions/GroupDeletionDialogFragment.java
@@ -33,8 +33,15 @@
private static final String ARG_GROUP_ID = "groupId";
private static final String ARG_LABEL = "label";
- public static void show(FragmentManager fragmentManager, long groupId, String label) {
- GroupDeletionDialogFragment dialog = new GroupDeletionDialogFragment();
+ private boolean mEndActivity;
+
+ public GroupDeletionDialogFragment(boolean endActivity) {
+ mEndActivity = endActivity;
+ }
+
+ public static void show(FragmentManager fragmentManager, long groupId, String label,
+ boolean endActivity) {
+ GroupDeletionDialogFragment dialog = new GroupDeletionDialogFragment(endActivity);
Bundle args = new Bundle();
args.putLong(ARG_GROUP_ID, groupId);
args.putString(ARG_LABEL, label);
@@ -69,5 +76,8 @@
getActivity().startService(ContactSaveService.createGroupDeletionIntent(
getActivity(), groupId));
+ if (mEndActivity) {
+ getActivity().finish();
+ }
}
}