Fixes Issue 801

This commit is contained in:
Daniel Applebaum 2009-11-22 17:15:11 +00:00
parent 2e50cc5444
commit c732f14c3d
2 changed files with 39 additions and 31 deletions

View File

@ -3329,6 +3329,10 @@ public class MessagingController implements Runnable {
{
boolean isNotifyAccount = thisAccount.isNotifyNewMail();
if (isNotifyAccount)
{
NotificationManager notifMgr =
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
if (unreadMessageCount > 0)
{
String notice = context.getString(R.string.notification_new_one_account_fmt, unreadMessageCount,
thisAccount.getDescription());
@ -3355,10 +3359,14 @@ public class MessagingController implements Runnable {
notif.ledOnMS = Email.NOTIFICATION_LED_ON_TIME;
notif.ledOffMS = Email.NOTIFICATION_LED_OFF_TIME;
NotificationManager notifMgr =
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
notifMgr.notify(thisAccount.getAccountNumber(), notif);
}
else
{
notifMgr.cancel(thisAccount.getAccountNumber());
}
}
}
@ -3753,6 +3761,10 @@ public class MessagingController implements Runnable {
{
notifyAccount(mApplication, account, unreadMessageCount);
}
if (unreadCount == 0)
{
notifyAccount(mApplication, account, unreadMessageCount);
}
for (MessagingListener l : getListeners())
{

View File

@ -9,7 +9,6 @@ import com.android.email.MessagingListener;
import com.android.email.Preferences;
import com.android.email.mail.MessagingException;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
@ -139,9 +138,6 @@ public class PollService extends CoreService
return;
}
NotificationManager notifMgr =
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
for (Account thisAccount : Preferences.getPreferences(context).getAccounts()) {
Integer newMailCount = accountsChecked.get(thisAccount.getUuid());
if (newMailCount != null)
@ -155,7 +151,7 @@ public class PollService extends CoreService
}
else if (unreadMessageCount == 0)
{
notifMgr.cancel(thisAccount.getAccountNumber());
MessagingController.getInstance(getApplication()).notifyAccount(context, thisAccount, unreadMessageCount);
}
}
catch (MessagingException me)