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.
This commit is contained in:
parent
22daa507ce
commit
1443c8088c
|
@ -78,7 +78,7 @@ public class NotificationListener extends NotificationListenerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.equals("eu.siacs.conversations")) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,18 +88,14 @@ public class NotificationListener extends NotificationListenerService {
|
||||||
Bundle extras = notification.extras;
|
Bundle extras = notification.extras;
|
||||||
String title = extras.getCharSequence(Notification.EXTRA_TITLE).toString();
|
String title = extras.getCharSequence(Notification.EXTRA_TITLE).toString();
|
||||||
String content = null;
|
String content = null;
|
||||||
if (extras.containsKey(Notification.EXTRA_TEXT))
|
if (extras.containsKey(Notification.EXTRA_TEXT)) {
|
||||||
|
|
||||||
{
|
|
||||||
CharSequence contentCS = extras.getCharSequence(Notification.EXTRA_TEXT);
|
CharSequence contentCS = extras.getCharSequence(Notification.EXTRA_TEXT);
|
||||||
if (contentCS != null) {
|
if (contentCS != null) {
|
||||||
content = contentCS.toString();
|
content = contentCS.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content != null)
|
if (content != null) {
|
||||||
|
|
||||||
{
|
|
||||||
Intent startIntent = new Intent(NotificationListener.this, BluetoothCommunicationService.class);
|
Intent startIntent = new Intent(NotificationListener.this, BluetoothCommunicationService.class);
|
||||||
startIntent.setAction(BluetoothCommunicationService.ACTION_NOTIFICATION_GENERIC);
|
startIntent.setAction(BluetoothCommunicationService.ACTION_NOTIFICATION_GENERIC);
|
||||||
startIntent.putExtra("notification_title", title);
|
startIntent.putExtra("notification_title", title);
|
||||||
|
|
|
@ -21,10 +21,10 @@ public class PebbleReceiver extends BroadcastReceiver {
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
|
||||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
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;
|
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);
|
PowerManager powermanager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||||
if (powermanager.isScreenOn()) {
|
if (powermanager.isScreenOn()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
android:title="@string/pref_title_notifications_k9mail" />
|
android:title="@string/pref_title_notifications_k9mail" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="never"
|
android:defaultValue="when_screen_off"
|
||||||
android:entries="@array/notification_mode"
|
android:entries="@array/notification_mode"
|
||||||
android:entryValues="@array/notification_mode_values"
|
android:entryValues="@array/notification_mode_values"
|
||||||
android:key="notification_mode_pebblemsg"
|
android:key="notification_mode_pebblemsg"
|
||||||
|
|
Loading…
Reference in New Issue