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.
live-activity-data
Julien Pivotto 2015-09-13 22:47:56 +02:00
parent 95e22a4e32
commit 21d59b23c1
3 changed files with 14 additions and 1 deletions

View File

@ -132,7 +132,6 @@ public class NotificationListener extends NotificationListenerService {
source.equals("com.android.systemui") || source.equals("com.android.systemui") ||
source.equals("com.android.dialer") || source.equals("com.android.dialer") ||
source.equals("com.android.mms") || source.equals("com.android.mms") ||
source.equals("com.moez.QKSMS") ||
source.equals("com.cyanogenmod.eleven")) { source.equals("com.cyanogenmod.eleven")) {
return; 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); HashSet<String> blacklist = (HashSet<String>) sharedPrefs.getStringSet("package_blacklist", null);
if (blacklist != null && blacklist.contains(source)) { if (blacklist != null && blacklist.contains(source)) {
return; return;
@ -167,6 +172,9 @@ public class NotificationListener extends NotificationListenerService {
case "com.android.email": case "com.android.email":
notificationKind = NotificationKind.EMAIL; notificationKind = NotificationKind.EMAIL;
break; break;
case "com.moez.QKSMS":
notificationKind = NotificationKind.SMS;
break;
case "eu.siacs.conversations": case "eu.siacs.conversations":
notificationKind = NotificationKind.CHAT; notificationKind = NotificationKind.CHAT;
break; break;

View File

@ -7,5 +7,6 @@ public enum NotificationKind {
CHAT, CHAT,
EMAIL, EMAIL,
FACEBOOK, FACEBOOK,
SMS,
TWITTER, TWITTER,
} }

View File

@ -635,6 +635,10 @@ public class PebbleProtocol extends GBDeviceProtocol {
icon_id = PebbleIconID.GENERIC_EMAIL; icon_id = PebbleIconID.GENERIC_EMAIL;
color_id = PebbleColor.JaegerGreen; color_id = PebbleColor.JaegerGreen;
break; break;
case SMS:
icon_id = PebbleIconID.GENERIC_SMS;
color_id = PebbleColor.VividViolet;
break;
case FACEBOOK: case FACEBOOK:
icon_id = PebbleIconID.NOTIFICATION_FACEBOOK; icon_id = PebbleIconID.NOTIFICATION_FACEBOOK;
color_id = PebbleColor.VeryLightBlue; color_id = PebbleColor.VeryLightBlue;