Show all contacts on invalid contact selection
Happens when a contact is created but it isn't shown due to
contact fliter (e.g. the contact is for the account A while the
filter shows only contacts for the account B). Single contact
mode is just confusing in that case, so now let's show all contacts
and notify the change to the user.
Bug: 5031526
Change-Id: Ica75178d10b4a9b95c44cc4f75f56b65fbc67da8
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 87461d7..a49ab77 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1757,4 +1757,8 @@
<!-- String describing the text on the header of the profile contact in the contacts list [CHAR LIMIT=20] -->
<string name="user_profile_contacts_list_header">ME</string>
+
+ <!-- Toast shown when the app starts showing all contacts regardless of its current
+ contact filter state. [CHAR LIMIT=64] -->
+ <string name="toast_displaying_all_contacts">Displaying all contacts</string>
</resources>
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 4da032e..b2fc972 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -1024,18 +1024,11 @@
@Override
public void onInvalidSelection() {
- ContactListFilter filter;
- ContactListFilter currentFilter = mAllFragment.getFilter();
- if (currentFilter != null
- && currentFilter.filterType == ContactListFilter.FILTER_TYPE_SINGLE_CONTACT) {
- filter = ContactListFilter.createFilterWithType(
- ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS);
- mAllFragment.setFilter(filter);
- } else {
- filter = ContactListFilter.createFilterWithType(
- ContactListFilter.FILTER_TYPE_SINGLE_CONTACT);
- mAllFragment.setFilter(filter, false);
- }
+ Toast.makeText(PeopleActivity.this, R.string.toast_displaying_all_contacts,
+ Toast.LENGTH_LONG).show();
+ ContactListFilter filter = ContactListFilter.createFilterWithType(
+ ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS);
+ mAllFragment.setFilter(filter);
mContactListFilterController.setContactListFilter(filter, true);
}
}