Fixes Issue 742
This commit is contained in:
parent
11a1a09e97
commit
84a1e0647d
1 changed files with 31 additions and 27 deletions
|
@ -3292,34 +3292,38 @@ public class MessagingController implements Runnable {
|
|||
|
||||
public void notifyAccount(Context context, Account thisAccount, int unreadMessageCount)
|
||||
{
|
||||
String notice = context.getString(R.string.notification_new_one_account_fmt, unreadMessageCount,
|
||||
thisAccount.getDescription());
|
||||
Notification notif = new Notification(R.drawable.stat_notify_email_generic,
|
||||
context.getString(R.string.notification_new_title), System.currentTimeMillis());
|
||||
|
||||
notif.number = unreadMessageCount;
|
||||
|
||||
Intent i = FolderList.actionHandleAccountIntent(context, thisAccount);
|
||||
|
||||
PendingIntent pi = PendingIntent.getActivity(context, 0, i, 0);
|
||||
|
||||
notif.setLatestEventInfo(context, context.getString(R.string.notification_new_title), notice, pi);
|
||||
|
||||
String ringtone = thisAccount.getRingtone();
|
||||
notif.sound = TextUtils.isEmpty(ringtone) ? null : Uri.parse(ringtone);
|
||||
|
||||
if (thisAccount.isVibrate()) {
|
||||
notif.defaults |= Notification.DEFAULT_VIBRATE;
|
||||
boolean isNotifyAccount = thisAccount.isNotifyNewMail();
|
||||
if (isNotifyAccount)
|
||||
{
|
||||
String notice = context.getString(R.string.notification_new_one_account_fmt, unreadMessageCount,
|
||||
thisAccount.getDescription());
|
||||
Notification notif = new Notification(R.drawable.stat_notify_email_generic,
|
||||
context.getString(R.string.notification_new_title), System.currentTimeMillis());
|
||||
|
||||
notif.number = unreadMessageCount;
|
||||
|
||||
Intent i = FolderList.actionHandleAccountIntent(context, thisAccount);
|
||||
|
||||
PendingIntent pi = PendingIntent.getActivity(context, 0, i, 0);
|
||||
|
||||
notif.setLatestEventInfo(context, context.getString(R.string.notification_new_title), notice, pi);
|
||||
|
||||
String ringtone = thisAccount.getRingtone();
|
||||
notif.sound = TextUtils.isEmpty(ringtone) ? null : Uri.parse(ringtone);
|
||||
|
||||
if (thisAccount.isVibrate()) {
|
||||
notif.defaults |= Notification.DEFAULT_VIBRATE;
|
||||
}
|
||||
|
||||
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
||||
notif.ledARGB = Email.NOTIFICATION_LED_COLOR;
|
||||
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);
|
||||
}
|
||||
|
||||
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
||||
notif.ledARGB = Email.NOTIFICATION_LED_COLOR;
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue