summaryrefslogtreecommitdiffstats
path: root/provider_src
diff options
context:
space:
mode:
authorMartin Hibdon <mhibdon@google.com>2014-10-10 20:12:43 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-10 20:12:43 +0000
commit5fde01e4a94b0339937da3bf927031dbc3d631dd (patch)
treea65106320c91eec293904e92e86ca94c200c9746 /provider_src
parent89272781fa854e7f44e673bbc3d9c87b0a7b44b4 (diff)
parent00fbbb24b3777160d5ba0157ff171aa2335632d7 (diff)
downloadandroid_packages_apps_Email-5fde01e4a94b0339937da3bf927031dbc3d631dd.tar.gz
android_packages_apps_Email-5fde01e4a94b0339937da3bf927031dbc3d631dd.tar.bz2
android_packages_apps_Email-5fde01e4a94b0339937da3bf927031dbc3d631dd.zip
Merge "Set the search mailbox's syncState as soon as a search is requested" into ub-gmail-ur14-dev
Diffstat (limited to 'provider_src')
-rw-r--r--provider_src/com/android/email/provider/EmailProvider.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/provider_src/com/android/email/provider/EmailProvider.java b/provider_src/com/android/email/provider/EmailProvider.java
index 0e275ea2a..8a10b81b0 100644
--- a/provider_src/com/android/email/provider/EmailProvider.java
+++ b/provider_src/com/android/email/provider/EmailProvider.java
@@ -5958,16 +5958,26 @@ public class EmailProvider extends ContentProvider
// TODO: This conditional is unnecessary, just two lines earlier we created
// mSearchParams using a constructor that never sets mOffset.
LogUtils.d(TAG, "deleting existing search results.");
-
- // Delete existing contents of search mailbox
- ContentResolver resolver = context.getContentResolver();
- resolver.delete(Message.CONTENT_URI, MessageColumns.MAILBOX_KEY + "=" + searchMailboxId,
- null);
- final ContentValues cv = new ContentValues(1);
+ final ContentResolver resolver = context.getContentResolver();
+ final ContentValues cv = new ContentValues(3);
// For now, use the actual query as the name of the mailbox
cv.put(Mailbox.DISPLAY_NAME, mSearchParams.mFilter);
+ // We are about to do a sync on this folder, but if the UI is refreshed before the
+ // service can start its query, we need it to see that there is a sync in progress.
+ // Otherwise it could show the empty state, until the service gets around to setting
+ // the syncState.
+ cv.put(Mailbox.SYNC_STATUS, EmailContent.SYNC_STATUS_LIVE);
+ // We don't know how many result we'll have yet, but we assume zero until we get
+ // a response back from the server. Otherwise, we'll whatever count there was on the
+ // previous search, and we'll display the "Load More" footer prior to having
+ // any results.
+ cv.put(Mailbox.TOTAL_COUNT, 0);
resolver.update(ContentUris.withAppendedId(Mailbox.CONTENT_URI, searchMailboxId),
cv, null, null);
+
+ // Delete existing contents of search mailbox
+ resolver.delete(Message.CONTENT_URI, MessageColumns.MAILBOX_KEY + "=" + searchMailboxId,
+ null);
}
// Start the search running in the background