diff options
| author | Jin Cao <jinyan@google.com> | 2014-09-08 18:12:53 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-08 18:12:53 +0000 |
| commit | 2946d500edeb1ce361da03984314a2cd19dea167 (patch) | |
| tree | 8833a49277ef1def2ab208afc21acd1574347213 | |
| parent | 701ca2d9341f60faf7cad99856a64458e6e473c3 (diff) | |
| parent | 31c33ef87cb0612250b812233ffbc0c46e88a371 (diff) | |
| download | android_frameworks_opt_chips-2946d500edeb1ce361da03984314a2cd19dea167.tar.gz android_frameworks_opt_chips-2946d500edeb1ce361da03984314a2cd19dea167.tar.bz2 android_frameworks_opt_chips-2946d500edeb1ce361da03984314a2cd19dea167.zip | |
am 31c33ef8: Only cache current selection if there are pending searches
* commit '31c33ef87cb0612250b812233ffbc0c46e88a371':
Only cache current selection if there are pending searches
| -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; } |
