From 1443c8088c8bf8783c9de2ff7eff138743ca1a2a Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 10 May 2015 15:07:28 +0200 Subject: [PATCH] Change default for Pebble Notification Intents back to "when screen off" Conversations accepted our PR, so we will continue to get these intents. The option cann still turned off, in that case Conversations' notifications are picked up by our generic notification support. --- .../externalevents/NotificationListener.java | 10 +++------- .../gadgetbridge/externalevents/PebbleReceiver.java | 4 ++-- app/src/main/res/xml/preferences.xml | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java index feb4dd9b..4744b09b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java @@ -78,7 +78,7 @@ public class NotificationListener extends NotificationListenerService { } if (source.equals("eu.siacs.conversations")) { - if (!"never".equals(sharedPrefs.getString("notification_mode_pebblemsg", "never"))) { + if (!"never".equals(sharedPrefs.getString("notification_mode_pebblemsg", "when_screen_off"))) { return; } } @@ -88,18 +88,14 @@ public class NotificationListener extends NotificationListenerService { Bundle extras = notification.extras; String title = extras.getCharSequence(Notification.EXTRA_TITLE).toString(); String content = null; - if (extras.containsKey(Notification.EXTRA_TEXT)) - - { + if (extras.containsKey(Notification.EXTRA_TEXT)) { CharSequence contentCS = extras.getCharSequence(Notification.EXTRA_TEXT); if (contentCS != null) { content = contentCS.toString(); } } - if (content != null) - - { + if (content != null) { Intent startIntent = new Intent(NotificationListener.this, BluetoothCommunicationService.class); startIntent.setAction(BluetoothCommunicationService.ACTION_NOTIFICATION_GENERIC); startIntent.putExtra("notification_title", title); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/PebbleReceiver.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/PebbleReceiver.java index bedef8f6..fe45002b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/PebbleReceiver.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/PebbleReceiver.java @@ -21,10 +21,10 @@ public class PebbleReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - if ("never".equals(sharedPrefs.getString("notification_mode_pebblemsg", "never"))) { + if ("never".equals(sharedPrefs.getString("notification_mode_pebblemsg", "when_screen_off"))) { return; } - if ("when_screen_off".equals(sharedPrefs.getString("notification_mode_pebblemsg", "never"))) { + if ("when_screen_off".equals(sharedPrefs.getString("notification_mode_pebblemsg", "when_screen_off"))) { PowerManager powermanager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); if (powermanager.isScreenOn()) { return; diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index f9f7ba7d..919977f2 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -36,7 +36,7 @@ android:title="@string/pref_title_notifications_k9mail" />