diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-06-25 19:12:06 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-06-25 19:12:06 +0200 |
commit | 6f632359349f22f0c642adef6b76b0d139629a18 (patch) | |
tree | ae10a39081a99e209870809dfb6807e9cc7a3972 /src | |
parent | 8d8b6779c9f42db3755299faf3b2cf0cb3520285 (diff) |
Added preference to control Heads-up Notifications
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/NotificationService.java | 3 | ||||
-rw-r--r-- | src/main/res/values-de/strings.xml | 2 | ||||
-rw-r--r-- | src/main/res/values/defaults.xml | 1 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/main/res/xml/preferences.xml | 6 |
5 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index ace144942..90bad9703 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -294,6 +294,7 @@ public class NotificationService { final String ringtone = preferences.getString("notification_ringtone", null); final boolean vibrate = preferences.getBoolean("vibrate_on_notification", true); final boolean led = preferences.getBoolean("led", true); + final boolean headsup = preferences.getBoolean("notification_headsup", mXmppConnectionService.getResources().getBoolean(R.bool.headsup_notifications)); if (notify && !isQuietHours()) { if (vibrate) { final int dat = 70; @@ -314,7 +315,7 @@ public class NotificationService { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mBuilder.setCategory(Notification.CATEGORY_MESSAGE); } - mBuilder.setPriority(notify ? NotificationCompat.PRIORITY_DEFAULT : NotificationCompat.PRIORITY_LOW); + mBuilder.setPriority(notify ? (headsup ? NotificationCompat.PRIORITY_HIGH : NotificationCompat.PRIORITY_DEFAULT) : NotificationCompat.PRIORITY_LOW); setNotificationColor(mBuilder); mBuilder.setDefaults(0); if (led) { diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index d7e45abdd..ff483d499 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -727,5 +727,7 @@ <string name="account_status_regis_web">Server verlangt Registrierung auf Webseite</string> <string name="application_found_to_open_website">Keine Anwendung zum Öffnen von Webseiten gefunden</string> <string name="open_website">Webseite anzeigen</string> + <string name="pref_headsup_notifications">Benachrichtigungsvorschau</string> + <string name="pref_headsup_notifications_summary">Zeige Benachrichtigungsvorschau am oberen Bildschirmrand an</string> </resources> diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml index 2b3d62f25..8cee33d5f 100644 --- a/src/main/res/values/defaults.xml +++ b/src/main/res/values/defaults.xml @@ -4,4 +4,5 @@ <bool name="portrait_only">true</bool> <bool name="enter_is_send">false</bool> <bool name="notifications_from_strangers">false</bool> + <bool name="headsup_notifications">true</bool> </resources>
\ No newline at end of file diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 344f7bf18..0cdf39614 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -775,4 +775,6 @@ <string name="account_status_regis_web">Server requires registration on website</string> <string name="application_found_to_open_website">No application found to open website</string> <string name="open_website">Open website</string> + <string name="pref_headsup_notifications">Heads-up Notifications</string> + <string name="pref_headsup_notifications_summary">Show Heads-up Notifications</string> </resources> diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 4e8fcb412..877a9b05a 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -54,6 +54,12 @@ android:key="show_notification" android:summary="@string/pref_notifications_summary" android:title="@string/pref_notifications" /> + <CheckBoxPreference + android:defaultValue="@bool/headsup_notifications" + android:dependency="show_notification" + android:key="notification_headsup" + android:summary="@string/pref_headsup_notifications_summary" + android:title="@string/pref_headsup_notifications" /> <PreferenceScreen android:dependency="show_notification" android:key="quiet_hours" |