use of com.fsck.k9.NotificationSetting in project k-9 by k9mail.
the class DeviceNotifications method buildSummaryNotification.
public Notification buildSummaryNotification(Account account, NotificationData notificationData, boolean silent) {
int unreadMessageCount = notificationData.getUnreadMessageCount();
NotificationCompat.Builder builder;
if (isPrivacyModeActive() || !platformSupportsExtendedNotifications()) {
builder = createSimpleSummaryNotification(account, unreadMessageCount);
} else if (notificationData.isSingleMessageNotification()) {
NotificationHolder holder = notificationData.getHolderForLatestNotification();
builder = createBigTextStyleSummaryNotification(account, holder);
} else {
builder = createInboxStyleSummaryNotification(account, notificationData, unreadMessageCount);
}
if (notificationData.containsStarredMessages()) {
builder.setPriority(NotificationCompat.PRIORITY_HIGH);
}
int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
PendingIntent deletePendingIntent = actionCreator.createDismissAllMessagesPendingIntent(account, notificationId);
builder.setDeleteIntent(deletePendingIntent);
lockScreenNotification.configureLockScreenNotification(builder, notificationData);
boolean ringAndVibrate = false;
if (!silent && !account.isRingNotified()) {
account.setRingNotified(true);
ringAndVibrate = true;
}
NotificationSetting notificationSetting = account.getNotificationSetting();
controller.configureNotification(builder, (notificationSetting.shouldRing()) ? notificationSetting.getRingtone() : null, (notificationSetting.shouldVibrate()) ? notificationSetting.getVibration() : null, (notificationSetting.isLed()) ? notificationSetting.getLedColor() : null, NOTIFICATION_LED_BLINK_SLOW, ringAndVibrate);
return builder.build();
}
use of com.fsck.k9.NotificationSetting in project k-9 by k9mail.
the class DeviceNotificationsTest method createFakeAccount.
private Account createFakeAccount() {
Account account = mock(Account.class);
when(account.getChipColor()).thenReturn(ACCOUNT_COLOR);
when(account.getAccountNumber()).thenReturn(ACCOUNT_NUMBER);
NotificationSetting notificationSetting = mock(NotificationSetting.class);
when(account.getNotificationSetting()).thenReturn(notificationSetting);
return account;
}
Aggregations