mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
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:
+3
-7
@@ -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);
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user