diff options
-rw-r--r-- | src/main/java/de/pixart/messenger/services/NotificationService.java | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index e3bc8a181..73d536d1a 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -4,6 +4,7 @@ import android.app.Notification; import android.app.PendingIntent; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Typeface; import android.net.Uri; @@ -279,10 +280,11 @@ public class NotificationService { } else { Log.d(Config.LOGTAG, "Notification: Received multiple notification or using Android N"); mBuilder = buildMultipleConversation(); + modifyForSoundVibrationAndLight(mBuilder, notify, preferences); for (Map.Entry<String, ArrayList<Message>> entry : notifications.entrySet()) { Builder singleBuilder = buildSingleConversations(entry.getValue()); singleBuilder.setGroup(CONVERSATIONS_GROUP); - modifyForSoundVibrationAndLight(singleBuilder, notify, preferences); + setNotificationColor(singleBuilder); notificationManager.notify(entry.getKey(), NOTIFICATION_ID, singleBuilder.build()); } notificationManager.notify(NOTIFICATION_ID, mBuilder.build()); @@ -291,10 +293,11 @@ public class NotificationService { } private void modifyForSoundVibrationAndLight(Builder mBuilder, boolean notify, SharedPreferences preferences) { - final String ringtone = preferences.getString("notification_ringtone", null); - final boolean vibrate = preferences.getBoolean("vibrate_on_notification", true); - final boolean led = preferences.getBoolean("led", true); - final boolean headsup = preferences.getBoolean("notification_headsup", mXmppConnectionService.getResources().getBoolean(R.bool.headsup_notifications)); + final Resources resources = mXmppConnectionService.getResources(); + final String ringtone = preferences.getString("notification_ringtone", resources.getString(R.string.notification_ringtone)); + final boolean vibrate = preferences.getBoolean("vibrate_on_notification", resources.getBoolean(R.bool.vibrate_on_notification)); + final boolean led = preferences.getBoolean("led", resources.getBoolean(R.bool.led)); + final boolean headsup = preferences.getBoolean("notification_headsup", resources.getBoolean(R.bool.headsup_notifications)); if (notify && !isQuietHours()) { if (vibrate) { final int dat = 70; @@ -303,13 +306,11 @@ public class NotificationService { } else { mBuilder.setVibrate(new long[]{0}); } - if (ringtone != null) { - Uri uri = Uri.parse(ringtone); - try { - mBuilder.setSound(fixRingtoneUri(uri)); - } catch (SecurityException e) { - Log.d(Config.LOGTAG, "unable to use custom notification sound " + uri.toString()); - } + Uri uri = Uri.parse(ringtone); + try { + mBuilder.setSound(fixRingtoneUri(uri)); + } catch (SecurityException e) { + Log.d(Config.LOGTAG, "unable to use custom notification sound " + uri.toString()); } } if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |