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:
Andreas Shimokawa 2015-05-10 15:07:28 +02:00
parent 22daa507ce
commit 1443c8088c
3 changed files with 6 additions and 10 deletions

View File

@ -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);

View File

@ -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;

View File

@ -36,7 +36,7 @@
android:title="@string/pref_title_notifications_k9mail" />
<ListPreference
android:defaultValue="never"
android:defaultValue="when_screen_off"
android:entries="@array/notification_mode"
android:entryValues="@array/notification_mode_values"
android:key="notification_mode_pebblemsg"