diff options
| author | Michael Webster <miketwebster@gmail.com> | 2010-07-30 22:14:03 -0400 |
|---|---|---|
| committer | Steve Kondik <shade@chemlab.org> | 2010-07-31 12:45:52 -0400 |
| commit | 231375999f6e66bd1afe6a300bf86e0e51d1d552 (patch) | |
| tree | 83fd83cedbafc5e2c4d2dd9f55d33e8b0395d1e8 | |
| parent | c7109be0ea1a33eff438d5e8db270ed4076dd222 (diff) | |
| download | android_packages_apps_Email-231375999f6e66bd1afe6a300bf86e0e51d1d552.tar.gz android_packages_apps_Email-231375999f6e66bd1afe6a300bf86e0e51d1d552.tar.bz2 android_packages_apps_Email-231375999f6e66bd1afe6a300bf86e0e51d1d552.zip | |
Add subfolder sync (exchange). Add "all emails" option to sync window (exchange). ToDo: lots
| -rw-r--r-- | res/values/arrays.xml | 2 | ||||
| -rw-r--r-- | res/values/strings.xml | 4 | ||||
| -rw-r--r-- | src/com/android/email/activity/MessageList.java | 10 | ||||
| -rw-r--r-- | src/com/android/email/service/MailService.java | 24 | ||||
| -rw-r--r-- | src/com/android/exchange/adapter/EmailSyncAdapter.java | 2 | ||||
| -rw-r--r-- | src/com/android/exchange/adapter/FolderSyncParser.java | 2 |
6 files changed, 19 insertions, 25 deletions
diff --git a/res/values/arrays.xml b/res/values/arrays.xml index b896f65d6..72badfd4d 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -69,6 +69,7 @@ <item>@string/account_setup_options_mail_window_1week</item> <item>@string/account_setup_options_mail_window_2weeks</item> <item>@string/account_setup_options_mail_window_1month</item> + <item>@string/account_setup_options_mail_window_all</item> </string-array> <!-- Mail sync window size codes for EAS accounts --> @@ -79,6 +80,7 @@ <item>3</item> <item>4</item> <item>5</item> + <item>6</item> </string-array> <!-- The vibrate notification modes --> diff --git a/res/values/strings.xml b/res/values/strings.xml index 95b4e9ee5..a847924e8 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -33,8 +33,6 @@ <!-- Do Not Translate. Unused string. --> <string name="account_setup_exchange_domain_label"></string> <!-- Do Not Translate. Unused string. --> - <string name="account_setup_options_mail_window_all"></string> - <!-- Do Not Translate. Unused string. --> <string name="accounts_context_menu_title"></string> <!-- Do Not Translate. Unused string. --> <string name="accounts_title"></string> @@ -489,6 +487,8 @@ <string name="account_setup_options_mail_window_2weeks">Two weeks</string> <!-- In account setup options & account settings screens (exchange), sync window length --> <string name="account_setup_options_mail_window_1month">One month</string> + <!-- In account setup options & account settings screens (exchange), sync window length --> + <string name="account_setup_options_mail_window_all">All emails</string> <!-- "Setup could not finish" dialog text; e.g., Username or password incorrect --> <string name="account_setup_failed_dlg_auth_message">Username or password incorrect.</string> diff --git a/src/com/android/email/activity/MessageList.java b/src/com/android/email/activity/MessageList.java index caedc3a34..859cb6966 100644 --- a/src/com/android/email/activity/MessageList.java +++ b/src/com/android/email/activity/MessageList.java @@ -281,9 +281,8 @@ public class MessageList extends ListActivity implements OnItemClickListener, On mLoadMessagesTask.execute(); addFooterView(mMailboxId, -1, -1); } else { - int mailboxType = intent.getIntExtra(EXTRA_MAILBOX_TYPE, Mailbox.TYPE_INBOX); + int mailboxType = intent.getIntExtra(EXTRA_MAILBOX_TYPE, Mailbox.TYPE_INBOX); Uri uri = intent.getData(); - // TODO Possible ANR. getAccountIdFromShortcutSafeUri accesses DB. long accountId = (uri == null) ? -1 : Account.getAccountIdFromShortcutSafeUri(this, uri); @@ -1216,12 +1215,7 @@ public class MessageList extends ListActivity implements OnItemClickListener, On // the position; restoreListPosition(); autoRefreshStaleMailbox(); - // Reset the "new messages" count in the service, since we're seeing them now - if (mMailboxKey == Mailbox.QUERY_ALL_INBOXES) { - MailService.resetNewMessageCount(MessageList.this, -1); - } else if (mMailboxKey >= 0 && mAccountKey != -1) { - MailService.resetNewMessageCount(MessageList.this, mAccountKey); - } + MailService.resetNewMessageCount(MessageList.this, -1); } } diff --git a/src/com/android/email/service/MailService.java b/src/com/android/email/service/MailService.java index 94de3f611..ed0d4030c 100644 --- a/src/com/android/email/service/MailService.java +++ b/src/com/android/email/service/MailService.java @@ -70,7 +70,7 @@ public class MailService extends Service { private static final String EXTRA_CHECK_ACCOUNT = "com.android.email.intent.extra.ACCOUNT";
private static final String EXTRA_ACCOUNT_INFO = "com.android.email.intent.extra.ACCOUNT_INFO";
private static final String EXTRA_DEBUG_WATCHDOG = "com.android.email.intent.extra.WATCHDOG";
-
+ private static final String EXTRA_MAILBOX_ID = "com.android.email.intent.extra.MAILBOX_ID";
private static final int WATCHDOG_DELAY = 10 * 60 * 1000; // 10 minutes
private static final String[] NEW_MESSAGE_COUNT_PROJECTION =
@@ -142,10 +142,11 @@ public class MailService extends Service { * @param accountId the id of the account that is reporting new messages
* @param newCount the number of new messages
*/
- public static void actionNotifyNewMessages(Context context, long accountId) {
+ public static void actionNotifyNewMessages(Context context, long accountId, long mailboxId) {
Intent i = new Intent(ACTION_NOTIFY_MAIL);
i.setClass(context, MailService.class);
i.putExtra(EXTRA_CHECK_ACCOUNT, accountId);
+ i.putExtra(EXTRA_MAILBOX_ID, mailboxId);
context.startService(i);
}
@@ -215,6 +216,7 @@ public class MailService extends Service { stopSelf(startId);
} else if (ACTION_NOTIFY_MAIL.equals(action)) {
long accountId = intent.getLongExtra(EXTRA_CHECK_ACCOUNT, -1);
+ long mailboxId = intent.getLongExtra(EXTRA_MAILBOX_ID, -1);
// Get the current new message count
Cursor c = getContentResolver().query(
ContentUris.withAppendedId(Account.CONTENT_URI, accountId),
@@ -236,7 +238,7 @@ public class MailService extends Service { }
if (accountId != -1) {
updateAccountReport(accountId, newMessageCount);
- notifyNewMessages(accountId);
+ notifyNewMessages(accountId, mailboxId);
}
stopSelf(startId);
}
@@ -586,20 +588,15 @@ public class MailService extends Service { public void updateMailboxCallback(MessagingException result, long accountId,
long mailboxId, int progress, int numNewMessages) {
if (result != null || progress == 100) {
- // We only track the inbox here in the service - ignore other mailboxes
- long inboxId = Mailbox.findMailboxOfType(MailService.this,
- accountId, Mailbox.TYPE_INBOX);
- if (mailboxId == inboxId) {
if (progress == 100) {
updateAccountReport(accountId, numNewMessages);
if (numNewMessages > 0) {
- notifyNewMessages(accountId);
+ notifyNewMessages(accountId, mailboxId);
}
} else {
updateAccountReport(accountId, -1);
}
- }
- // Call the global refresh tracker for all mailboxes
+ // Call the global refresh tracker for all mailboxes
Email.updateMailboxRefreshTime(mailboxId);
}
}
@@ -637,7 +634,7 @@ public class MailService extends Service { * the alert preferences) but the notification will include a summary if other
* accounts also have new mail.
*/
- private void notifyNewMessages(long accountId) {
+ private void notifyNewMessages(long accountId, long mailboxId) {
boolean notify = false;
boolean vibrate = false;
boolean vibrateWhenSilent = false;
@@ -675,14 +672,14 @@ public class MailService extends Service { reportString = getResources().getQuantityString(
R.plurals.notification_new_one_account_fmt, numNewMessages,
numNewMessages, reportName);
- intent = MessageList.createIntent(this, accountId, -1, Mailbox.TYPE_INBOX);
+ intent = MessageList.createIntent(this, accountId, mailboxId, -1);
} else {
// Prepare a report for multiple accounts
// "4 accounts"
reportString = getResources().getQuantityString(
R.plurals.notification_new_multi_account_fmt, accountsWithNewMessages,
accountsWithNewMessages);
- intent = MessageList.createIntent(this, -1, Mailbox.QUERY_ALL_INBOXES, -1);
+ intent = MessageList.createIntent(this, mailboxId, Mailbox.QUERY_ALL_INBOXES, -1);
}
// prepare appropriate pending intent, set up notification, and send
@@ -715,4 +712,5 @@ public class MailService extends Service { (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID_NEW_MESSAGES, notification);
}
+
}
diff --git a/src/com/android/exchange/adapter/EmailSyncAdapter.java b/src/com/android/exchange/adapter/EmailSyncAdapter.java index 4e478b5ab..5b8b51c94 100644 --- a/src/com/android/exchange/adapter/EmailSyncAdapter.java +++ b/src/com/android/exchange/adapter/EmailSyncAdapter.java @@ -589,7 +589,7 @@ public class EmailSyncAdapter extends AbstractSyncAdapter { cv.put(EmailContent.ADD_COLUMN_NAME, notifyCount); Uri uri = ContentUris.withAppendedId(Account.ADD_TO_FIELD_URI, mAccount.mId); mContentResolver.update(uri, cv, null, null); - MailService.actionNotifyNewMessages(mContext, mAccount.mId); + MailService.actionNotifyNewMessages(mContext, mAccount.mId, mMailbox.mId); } } } diff --git a/src/com/android/exchange/adapter/FolderSyncParser.java b/src/com/android/exchange/adapter/FolderSyncParser.java index ed97d315e..3c7d4c1dc 100644 --- a/src/com/android/exchange/adapter/FolderSyncParser.java +++ b/src/com/android/exchange/adapter/FolderSyncParser.java @@ -212,7 +212,7 @@ public class FolderSyncParser extends AbstractSyncParser { m.mType = Mailbox.TYPE_MAIL; // Note that all mailboxes default to checking "never" (i.e. manual sync only) // We set specific intervals for inbox, contacts, and (eventually) calendar - m.mSyncInterval = Mailbox.CHECK_INTERVAL_NEVER; + m.mSyncInterval = mAccount.mSyncInterval; switch (type) { case INBOX_TYPE: m.mType = Mailbox.TYPE_INBOX; |
