diff options
| -rw-r--r-- | src/com/android/ex/chips/BaseRecipientAdapter.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/com/android/ex/chips/BaseRecipientAdapter.java b/src/com/android/ex/chips/BaseRecipientAdapter.java index 24f7a3e..b3474bb 100644 --- a/src/com/android/ex/chips/BaseRecipientAdapter.java +++ b/src/com/android/ex/chips/BaseRecipientAdapter.java @@ -281,12 +281,9 @@ public class BaseRecipientAdapter extends BaseAdapter implements Filterable, Acc mNonAggregatedEntries = defaultFilterResult.nonAggregatedEntries; mExistingDestinations = defaultFilterResult.existingDestinations; - // If there are no local results, in the new result set, cache off what had been - // shown to the user for use until the first directory result is returned - if (defaultFilterResult.entries.size() == 0 && - defaultFilterResult.paramsList != null) { - cacheCurrentEntries(); - } + cacheCurrentEntriesIfNeeded(defaultFilterResult.entries.size(), + defaultFilterResult.paramsList == null ? 0 : + defaultFilterResult.paramsList.size()); updateEntries(defaultFilterResult.entries); @@ -818,6 +815,19 @@ public class BaseRecipientAdapter extends BaseAdapter implements Filterable, Acc notifyDataSetChanged(); } + /** + * If there are no local results and we are searching alternate results, + * in the new result set, cache off what had been shown to the user for use until + * the first directory result is returned + * @param newEntryCount number of newly loaded entries + * @param paramListCount number of alternate filters it will search (including the current one). + */ + protected void cacheCurrentEntriesIfNeeded(int newEntryCount, int paramListCount) { + if (newEntryCount == 0 && paramListCount > 1) { + cacheCurrentEntries(); + } + } + protected void cacheCurrentEntries() { mTempEntries = mEntries; } |
