Merge "Use locale-appropriate date format for mTitleNoYearDateFormat"
diff --git a/res/layout-sw680dp/people_activity.xml b/res/layout-sw680dp/people_activity.xml
index fbd4312..d6a59db 100644
--- a/res/layout-sw680dp/people_activity.xml
+++ b/res/layout-sw680dp/people_activity.xml
@@ -58,7 +58,7 @@
android:id="@+id/contact_details_view"
android:layout_width="0dip"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_weight="2"
android:background="@color/background_primary"
android:visibility="gone">
@@ -87,7 +87,7 @@
android:id="@+id/group_details_view"
android:layout_width="0dip"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_weight="2"
android:visibility="gone">
<!-- This is the group detail page -->
diff --git a/res/layout/contact_picker_content.xml b/res/layout/contact_picker_content.xml
index 613af69..0a3fa1d 100644
--- a/res/layout/contact_picker_content.xml
+++ b/res/layout/contact_picker_content.xml
@@ -14,26 +14,25 @@
limitations under the License.
-->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/pinned_header_list_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
<view
class="com.android.contacts.common.list.PinnedHeaderListView"
android:id="@android:id/list"
android:layout_width="match_parent"
- android:layout_height="0dip"
+ android:layout_height="match_parent"
android:layout_marginLeft="?attr/contact_browser_list_padding_left"
android:layout_marginRight="?attr/contact_browser_list_padding_right"
- android:fastScrollEnabled="true"
- android:layout_weight="1" />
+ android:fastScrollEnabled="true"/>
- <ViewStub
- android:id="@+id/footer_stub"
- android:layout="@layout/footer_panel"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" />
-</LinearLayout>
+ <TextView android:id="@android:id/empty"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:textSize="20sp"
+ android:textColor="?android:attr/textColorSecondary"
+ android:text="@string/listFoundAllContactsZero"/>
+
+</FrameLayout>
diff --git a/res/layout/group_account_header_vertical.xml b/res/layout/group_account_header_vertical.xml
index 8edbb8b..35b47fd 100644
--- a/res/layout/group_account_header_vertical.xml
+++ b/res/layout/group_account_header_vertical.xml
@@ -17,19 +17,17 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?attr/list_item_header_height"
+ android:layout_height="?attr/list_item_header_height"
android:layout_marginLeft="?attr/list_item_padding_left"
android:layout_marginRight="?attr/list_item_padding_right"
- android:paddingBottom="4dip"
android:background="@drawable/list_section_divider_holo_custom"
+ android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/account_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
android:paddingLeft="?attr/list_item_header_text_indent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/people_app_theme_color"
@@ -43,7 +41,6 @@
android:id="@+id/account_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
android:paddingLeft="?attr/list_item_header_text_indent"
android:textColor="@color/contact_count_text_color"
android:textSize="12sp"
diff --git a/res/layout/user_profile_header.xml b/res/layout/user_profile_header.xml
index 67b64d5..29fd1c6 100644
--- a/res/layout/user_profile_header.xml
+++ b/res/layout/user_profile_header.xml
@@ -19,12 +19,11 @@
android:id="@+id/user_profile_header"
android:orientation="horizontal"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingTop="@dimen/list_header_extra_top_padding"
+ android:layout_height="?attr/list_item_header_height"
android:paddingLeft="?attr/list_item_padding_left"
- android:paddingRight="?attr/list_item_padding_right"
+ android:paddingRight="?attr/list_item_padding_right"
android:background="@drawable/list_section_divider_holo_custom"
- android:minHeight="?attr/list_item_header_height"
+ android:gravity="center_vertical"
>
<TextView
@@ -35,8 +34,6 @@
android:text="@string/user_profile_contacts_list_header"
android:textStyle="bold"
android:ellipsize="end"
- android:layout_gravity="left|bottom"
- android:layout_marginBottom="2dip"
android:layout_weight="1"
android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceSmall"
@@ -49,8 +46,6 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
- android:layout_gravity="right|bottom"
- android:layout_marginBottom="2dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="12sp"
android:textColor="@color/contact_count_text_color" />
diff --git a/res/values-sw680dp/donottranslate_config.xml b/res/values-sw680dp/donottranslate_config.xml
deleted file mode 100644
index 5e5be30..0000000
--- a/res/values-sw680dp/donottranslate_config.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<resources>
- <bool name="config_browse_list_show_images">true</bool>
- <bool name="config_use_two_panes_in_favorites">true</bool>
-</resources>
diff --git a/res/xml/preference_display_options.xml b/res/xml/preference_display_options.xml
index a65010d..4ec31b2 100644
--- a/res/xml/preference_display_options.xml
+++ b/res/xml/preference_display_options.xml
@@ -15,16 +15,13 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
- <PreferenceCategory
- android:title="@string/preference_displayOptions">
- <com.android.contacts.preference.SortOrderPreference
- android:key="sortOrder"
- android:title="@string/display_options_sort_list_by"
- android:dialogTitle="@string/display_options_sort_list_by" />
+ <com.android.contacts.preference.SortOrderPreference
+ android:key="sortOrder"
+ android:title="@string/display_options_sort_list_by"
+ android:dialogTitle="@string/display_options_sort_list_by" />
- <com.android.contacts.preference.DisplayOrderPreference
- android:key="displayOrder"
- android:title="@string/display_options_view_names_as"
- android:dialogTitle="@string/display_options_view_names_as" />
- </PreferenceCategory>
+ <com.android.contacts.preference.DisplayOrderPreference
+ android:key="displayOrder"
+ android:title="@string/display_options_view_names_as"
+ android:dialogTitle="@string/display_options_view_names_as" />
</PreferenceScreen>
diff --git a/src/com/android/contacts/detail/ContactDetailFragment.java b/src/com/android/contacts/detail/ContactDetailFragment.java
index ccdc403..d4d5fc7 100644
--- a/src/com/android/contacts/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/detail/ContactDetailFragment.java
@@ -461,6 +461,7 @@
Collapser.collapseList(mPostalEntries);
Collapser.collapseList(mImEntries);
Collapser.collapseList(mEventEntries);
+ Collapser.collapseList(mWebsiteEntries);
mIsUniqueNumber = mPhoneEntries.size() == 1;
mIsUniqueEmail = mEmailEntries.size() == 1;
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 13c8b33..bb63b2e 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -330,10 +330,6 @@
@Override
public void onStop() {
super.onStop();
- if (mAggregationSuggestionEngine != null) {
- mAggregationSuggestionEngine.quit();
- }
-
// If anything was left unsaved, save it now but keep the editor open.
if (!getActivity().isChangingConfigurations() && mStatus == Status.EDITING) {
save(SaveMode.RELOAD);
@@ -341,6 +337,14 @@
}
@Override
+ public void onDestroy() {
+ super.onDestroy();
+ if (mAggregationSuggestionEngine != null) {
+ mAggregationSuggestionEngine.quit();
+ }
+ }
+
+ @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
final View view = inflater.inflate(R.layout.contact_editor_fragment, container, false);
@@ -945,6 +949,7 @@
final MenuItem splitMenu = menu.findItem(R.id.menu_split);
final MenuItem joinMenu = menu.findItem(R.id.menu_join);
final MenuItem helpMenu = menu.findItem(R.id.menu_help);
+ final MenuItem discardMenu = menu.findItem(R.id.menu_discard);
// Set visibility of menus
doneMenu.setVisible(false);
@@ -955,6 +960,10 @@
// Cannot join a user profile
joinMenu.setVisible(!isEditingUserProfile());
+ // Discard menu is only available if at least one raw contact is editable
+ discardMenu.setVisible(mState != null &&
+ mState.getFirstWritableRawContact(mContext) != null);
+
// help menu depending on whether this is inserting or editing
if (Intent.ACTION_INSERT.equals(mAction)) {
// inserting
diff --git a/src/com/android/contacts/editor/RawContactEditorView.java b/src/com/android/contacts/editor/RawContactEditorView.java
index c79ba2f..d069c8d 100644
--- a/src/com/android/contacts/editor/RawContactEditorView.java
+++ b/src/com/android/contacts/editor/RawContactEditorView.java
@@ -18,6 +18,8 @@
import android.content.Context;
import android.database.Cursor;
+import android.os.Bundle;
+import android.os.Parcelable;
import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
import android.provider.ContactsContract.CommonDataKinds.Organization;
import android.provider.ContactsContract.CommonDataKinds.Photo;
@@ -60,12 +62,19 @@
* {@link RawContactModifier} to ensure that {@link AccountType} are enforced.
*/
public class RawContactEditorView extends BaseRawContactEditorView {
+ private static final String KEY_ORGANIZATION_VIEW_EXPANDED = "organizationViewExpanded";
+ private static final String KEY_SUPER_INSTANCE_STATE = "superInstanceState";
+
private LayoutInflater mInflater;
private StructuredNameEditorView mName;
private PhoneticNameEditorView mPhoneticName;
private GroupMembershipView mGroupMembershipView;
+ private ViewGroup mOrganizationSectionViewContainer;
+ private View mAddOrganizationButton;
+ private boolean mOrganizationViewExpanded = false;
+
private ViewGroup mFields;
private ImageView mAccountIcon;
@@ -148,6 +157,35 @@
});
}
+ @Override
+ protected Parcelable onSaveInstanceState() {
+ Bundle bundle = new Bundle();
+ bundle.putBoolean(KEY_ORGANIZATION_VIEW_EXPANDED, mOrganizationViewExpanded);
+ // super implementation of onSaveInstanceState returns null
+ bundle.putParcelable(KEY_SUPER_INSTANCE_STATE, super.onSaveInstanceState());
+ return bundle;
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Parcelable state) {
+ if (state instanceof Bundle) {
+ Bundle bundle = (Bundle) state;
+ mOrganizationViewExpanded = bundle.getBoolean(KEY_ORGANIZATION_VIEW_EXPANDED);
+ if (mOrganizationViewExpanded) {
+ // we have to manually perform the expansion here because
+ // onRestoreInstanceState is called after setState. So at the point
+ // of the creation of the organization view, mOrganizationViewExpanded
+ // does not have the correct value yet.
+ mOrganizationSectionViewContainer.setVisibility(VISIBLE);
+ mAddOrganizationButton.setVisibility(GONE);
+ }
+ super.onRestoreInstanceState(bundle.getParcelable(KEY_SUPER_INSTANCE_STATE));
+ return;
+ }
+ super.onRestoreInstanceState(state);
+ return;
+ }
+
/**
* Set the internal state for this view, given a current
* {@link RawContactDelta} state and the {@link AccountType} that
@@ -264,21 +302,21 @@
// EditText fields only when clicked
final View organizationView = mInflater.inflate(
R.layout.organization_editor_view_switcher, mFields, false);
- final View addOrganizationButton = organizationView.findViewById(
+ mAddOrganizationButton = organizationView.findViewById(
R.id.add_organization_button);
- final ViewGroup organizationSectionViewContainer =
+ mOrganizationSectionViewContainer =
(ViewGroup) organizationView.findViewById(R.id.container);
-
- organizationSectionViewContainer.addView(section);
+ mOrganizationSectionViewContainer.addView(section);
// Setup the click listener for the "add organization" button
- addOrganizationButton.setOnClickListener(new OnClickListener() {
+ mAddOrganizationButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Once the user expands the organization field, the user cannot
// collapse them again.
- EditorAnimator.getInstance().expandOrganization(addOrganizationButton,
- organizationSectionViewContainer);
+ EditorAnimator.getInstance().expandOrganization(mAddOrganizationButton,
+ mOrganizationSectionViewContainer);
+ mOrganizationViewExpanded = true;
}
});
diff --git a/src/com/android/contacts/group/GroupBrowseListAdapter.java b/src/com/android/contacts/group/GroupBrowseListAdapter.java
index 32296c2..f1c3aba 100644
--- a/src/com/android/contacts/group/GroupBrowseListAdapter.java
+++ b/src/com/android/contacts/group/GroupBrowseListAdapter.java
@@ -60,7 +60,7 @@
// first group
if (mSelectedGroupUri == null && cursor != null && cursor.getCount() > 0) {
GroupListItem firstItem = getItem(0);
- long groupId = (firstItem == null) ? null : firstItem.getGroupId();
+ long groupId = (firstItem == null) ? 0 : firstItem.getGroupId();
mSelectedGroupUri = getGroupUriFromId(groupId);
}
diff --git a/src/com/android/contacts/group/GroupDetailFragment.java b/src/com/android/contacts/group/GroupDetailFragment.java
index 69d5165..834e2c3 100644
--- a/src/com/android/contacts/group/GroupDetailFragment.java
+++ b/src/com/android/contacts/group/GroupDetailFragment.java
@@ -115,10 +115,11 @@
private String mAccountTypeString;
private String mDataSet;
private boolean mIsReadOnly;
+ private boolean mIsMembershipEditable;
private boolean mShowGroupActionInActionBar;
private boolean mOptionsMenuGroupDeletable;
- private boolean mOptionsMenuGroupPresent;
+ private boolean mOptionsMenuGroupEditable;
private boolean mCloseActivityAfterDelete;
public GroupDetailFragment() {
@@ -338,8 +339,15 @@
* (based on the result from the {@link Loader}), then we can display this to the user in 1 of
* 2 ways depending on screen size and orientation: either as a button in the action bar or as
* a button in a static header on the page.
+ * We also use isGroupMembershipEditable() of accountType to determine whether or not we should
+ * display the Edit option in the Actionbar.
*/
private void updateAccountType(final String accountTypeString, final String dataSet) {
+ final AccountTypeManager manager = AccountTypeManager.getInstance(getActivity());
+ final AccountType accountType =
+ manager.getAccountType(accountTypeString, dataSet);
+
+ mIsMembershipEditable = accountType.isGroupMembershipEditable();
// If the group action should be shown in the action bar, then pass the data to the
// listener who will take care of setting up the view and click listener. There is nothing
@@ -349,10 +357,6 @@
return;
}
- final AccountTypeManager manager = AccountTypeManager.getInstance(getActivity());
- final AccountType accountType =
- manager.getAccountType(accountTypeString, dataSet);
-
// Otherwise, if the {@link Fragment} needs to create and setup the button, then first
// verify that there is a valid action.
if (!TextUtils.isEmpty(accountType.getViewGroupActivity())) {
@@ -406,24 +410,24 @@
public boolean isOptionsMenuChanged() {
return mOptionsMenuGroupDeletable != isGroupDeletable() &&
- mOptionsMenuGroupPresent != isGroupPresent();
+ mOptionsMenuGroupEditable != isGroupEditableAndPresent();
}
public boolean isGroupDeletable() {
return mGroupUri != null && !mIsReadOnly;
}
- public boolean isGroupPresent() {
- return mGroupUri != null;
+ public boolean isGroupEditableAndPresent() {
+ return mGroupUri != null && mIsMembershipEditable;
}
@Override
public void onPrepareOptionsMenu(Menu menu) {
mOptionsMenuGroupDeletable = isGroupDeletable() && isVisible();
- mOptionsMenuGroupPresent = isGroupPresent() && isVisible();
+ mOptionsMenuGroupEditable = isGroupEditableAndPresent() && isVisible();
final MenuItem editMenu = menu.findItem(R.id.menu_edit_group);
- editMenu.setVisible(mOptionsMenuGroupPresent);
+ editMenu.setVisible(mOptionsMenuGroupEditable);
final MenuItem deleteMenu = menu.findItem(R.id.menu_delete_group);
deleteMenu.setVisible(mOptionsMenuGroupDeletable);
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 00ac7ba..adf58bc 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -590,12 +590,23 @@
}
private class PageChangeListener extends SimpleOnPageChangeListener {
+ private int mScrollingState = ViewPager.SCROLL_STATE_IDLE;
+
@Override
public void onPageSelected(int position) {
final CheckableImageView actionView = getActionViewAt(position);
mTrackScroller.requestChildRectangleOnScreen(actionView,
new Rect(0, 0, actionView.getWidth(), actionView.getHeight()), false);
- renderSelectedRectangle(position, 0);
+ // Don't render rectangle if we are currently scrolling to prevent it from flickering
+ if (mScrollingState == ViewPager.SCROLL_STATE_IDLE) {
+ renderSelectedRectangle(position, 0);
+ }
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int state) {
+ super.onPageScrollStateChanged(state);
+ mScrollingState = state;
}
@Override