Loading src/com/android/contacts/activities/ActionBarAdapter.java +4 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,10 @@ public class ActionBarAdapter implements OnQueryTextListener, OnCloseListener { return mSearchMode; } public boolean shouldShowSearchResult() { return mSearchMode && !TextUtils.isEmpty(mQueryString); } public void setSearchMode(boolean flag) { if (mSearchMode != flag) { mSearchMode = flag; Loading src/com/android/contacts/activities/PeopleActivity.java +3 −3 Original line number Diff line number Diff line Loading @@ -867,11 +867,11 @@ public class PeopleActivity extends ContactsActivity } private void configureContactListFragment() { final boolean searchMode = mActionBarAdapter.isSearchMode(); mAllFragment.setSearchMode(searchMode); final boolean showSearchResult = mActionBarAdapter.shouldShowSearchResult(); mAllFragment.setSearchMode(showSearchResult); final boolean useTwoPane = PhoneCapabilityTester.isUsingTwoPanes(this); mAllFragment.setVisibleScrollbarEnabled(!searchMode); mAllFragment.setVisibleScrollbarEnabled(!showSearchResult); mAllFragment.setVerticalScrollbarPosition( useTwoPane ? View.SCROLLBAR_POSITION_LEFT Loading src/com/android/contacts/list/ContactEntryListAdapter.java +0 −4 Original line number Diff line number Diff line Loading @@ -457,10 +457,6 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter { if (!mEmptyListEnabled) { return false; } else if (isSearchMode()) { // TODO Do we really need this? DefaultContactListAdapter overrides it and always // return false, as it returns all contacts if in the search mode and the query is // empty. If there's no places relying on this behavior, we can just return false // here. return TextUtils.isEmpty(getQueryString()); } else if (mLoading) { // We don't want the empty state to show when loading. Loading src/com/android/contacts/list/DefaultContactListAdapter.java +5 −21 Original line number Diff line number Diff line Loading @@ -66,15 +66,11 @@ public class DefaultContactListAdapter extends ContactListAdapter { } query = query.trim(); if (TextUtils.isEmpty(query)) { // Special case: if the query string is empty, show all contacts, regardless of the // current filter. // (We can't use the FILTER_URI for this, as the contacts provider would return // an empty cursor if the query is empty.) final ContactListFilter allFilter = ContactListFilter.createFilterWithType( ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS); configureUri(loader, directoryId, allFilter); configureProjection(loader, directoryId, allFilter); configureSelection(loader, directoryId, allFilter); // Regardless of the directory, we don't want anything returned, // so let's just send a "nothing" query to the local directory. loader.setUri(Contacts.CONTENT_URI); loader.setProjection(PROJECTION_CONTACT); loader.setSelection("0"); } else { Builder builder = Contacts.CONTENT_FILTER_URI.buildUpon(); builder.appendPath(query); // Builder will encode the query Loading Loading @@ -256,16 +252,4 @@ public class DefaultContactListAdapter extends ContactListAdapter { return prefs.getBoolean(ContactsPreferences.PREF_DISPLAY_ONLY_PHONES, ContactsPreferences.PREF_DISPLAY_ONLY_PHONES_DEFAULT); } @Override public boolean isEmpty() { // ContactEntryListAdapter.isEmpty() returns false when in the search mode && the query is // empty. Here, we want to return all contacts in this case, override it and make it // always return false. See the TODO there -- we may not need this method entirely. if (isSearchMode()) { return false; } else { return super.isEmpty(); } } } Loading
src/com/android/contacts/activities/ActionBarAdapter.java +4 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,10 @@ public class ActionBarAdapter implements OnQueryTextListener, OnCloseListener { return mSearchMode; } public boolean shouldShowSearchResult() { return mSearchMode && !TextUtils.isEmpty(mQueryString); } public void setSearchMode(boolean flag) { if (mSearchMode != flag) { mSearchMode = flag; Loading
src/com/android/contacts/activities/PeopleActivity.java +3 −3 Original line number Diff line number Diff line Loading @@ -867,11 +867,11 @@ public class PeopleActivity extends ContactsActivity } private void configureContactListFragment() { final boolean searchMode = mActionBarAdapter.isSearchMode(); mAllFragment.setSearchMode(searchMode); final boolean showSearchResult = mActionBarAdapter.shouldShowSearchResult(); mAllFragment.setSearchMode(showSearchResult); final boolean useTwoPane = PhoneCapabilityTester.isUsingTwoPanes(this); mAllFragment.setVisibleScrollbarEnabled(!searchMode); mAllFragment.setVisibleScrollbarEnabled(!showSearchResult); mAllFragment.setVerticalScrollbarPosition( useTwoPane ? View.SCROLLBAR_POSITION_LEFT Loading
src/com/android/contacts/list/ContactEntryListAdapter.java +0 −4 Original line number Diff line number Diff line Loading @@ -457,10 +457,6 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter { if (!mEmptyListEnabled) { return false; } else if (isSearchMode()) { // TODO Do we really need this? DefaultContactListAdapter overrides it and always // return false, as it returns all contacts if in the search mode and the query is // empty. If there's no places relying on this behavior, we can just return false // here. return TextUtils.isEmpty(getQueryString()); } else if (mLoading) { // We don't want the empty state to show when loading. Loading
src/com/android/contacts/list/DefaultContactListAdapter.java +5 −21 Original line number Diff line number Diff line Loading @@ -66,15 +66,11 @@ public class DefaultContactListAdapter extends ContactListAdapter { } query = query.trim(); if (TextUtils.isEmpty(query)) { // Special case: if the query string is empty, show all contacts, regardless of the // current filter. // (We can't use the FILTER_URI for this, as the contacts provider would return // an empty cursor if the query is empty.) final ContactListFilter allFilter = ContactListFilter.createFilterWithType( ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS); configureUri(loader, directoryId, allFilter); configureProjection(loader, directoryId, allFilter); configureSelection(loader, directoryId, allFilter); // Regardless of the directory, we don't want anything returned, // so let's just send a "nothing" query to the local directory. loader.setUri(Contacts.CONTENT_URI); loader.setProjection(PROJECTION_CONTACT); loader.setSelection("0"); } else { Builder builder = Contacts.CONTENT_FILTER_URI.buildUpon(); builder.appendPath(query); // Builder will encode the query Loading Loading @@ -256,16 +252,4 @@ public class DefaultContactListAdapter extends ContactListAdapter { return prefs.getBoolean(ContactsPreferences.PREF_DISPLAY_ONLY_PHONES, ContactsPreferences.PREF_DISPLAY_ONLY_PHONES_DEFAULT); } @Override public boolean isEmpty() { // ContactEntryListAdapter.isEmpty() returns false when in the search mode && the query is // empty. Here, we want to return all contacts in this case, override it and make it // always return false. See the TODO there -- we may not need this method entirely. if (isSearchMode()) { return false; } else { return super.isEmpty(); } } }