Allow QKSMS notifications to be handled as a generic notification if SMS notification mode is set to "never"

This makes it possible to use the "Open on Phone" and individial dismiss feature with QKSMS.
This commit is contained in:
Julien Pivotto
2015-09-13 22:51:05 +02:00
parent 95e22a4e32
commit 21d59b23c1
3 changed files with 14 additions and 1 deletions
@@ -132,7 +132,6 @@ public class NotificationListener extends NotificationListenerService {
source.equals("com.android.systemui") ||
source.equals("com.android.dialer") ||
source.equals("com.android.mms") ||
source.equals("com.moez.QKSMS") ||
source.equals("com.cyanogenmod.eleven")) {
return;
}
@@ -149,6 +148,12 @@ public class NotificationListener extends NotificationListenerService {
}
}
if (source.equals("com.moez.QKSMS")) {
if (!"never".equals(sharedPrefs.getString("notification_mode_sms", "when_screen_off"))) {
return;
}
}
HashSet<String> blacklist = (HashSet<String>) sharedPrefs.getStringSet("package_blacklist", null);
if (blacklist != null && blacklist.contains(source)) {
return;
@@ -167,6 +172,9 @@ public class NotificationListener extends NotificationListenerService {
case "com.android.email":
notificationKind = NotificationKind.EMAIL;
break;
case "com.moez.QKSMS":
notificationKind = NotificationKind.SMS;
break;
case "eu.siacs.conversations":
notificationKind = NotificationKind.CHAT;
break;
@@ -7,5 +7,6 @@ public enum NotificationKind {
CHAT,
EMAIL,
FACEBOOK,
SMS,
TWITTER,
}
@@ -635,6 +635,10 @@ public class PebbleProtocol extends GBDeviceProtocol {
icon_id = PebbleIconID.GENERIC_EMAIL;
color_id = PebbleColor.JaegerGreen;
break;
case SMS:
icon_id = PebbleIconID.GENERIC_SMS;
color_id = PebbleColor.VividViolet;
break;
case FACEBOOK:
icon_id = PebbleIconID.NOTIFICATION_FACEBOOK;
color_id = PebbleColor.VeryLightBlue;