Added preference to control Heads-up Notifications (turned off by default)
This commit is contained in:
parent
5fd4169720
commit
f8e031ac86
|
@ -283,6 +283,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;
|
||||
|
@ -303,7 +304,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) {
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
<bool name="portrait_only">true</bool>
|
||||
<bool name="enter_is_send">false</bool>
|
||||
<bool name="notifications_from_strangers">false</bool>
|
||||
</resources>
|
||||
<bool name="headsup_notifications">false</bool>
|
||||
</resources>
|
||||
|
|
|
@ -752,4 +752,6 @@
|
|||
<string name="account_status_regis_web">Server requires registration on website</string>
|
||||
<string name="open_website">Open website</string>
|
||||
<string name="application_found_to_open_website">No application found to open website</string>
|
||||
<string name="pref_headsup_notifications">Heads-up Notifications</string>
|
||||
<string name="pref_headsup_notifications_summary">Show Heads-up Notifications</string>
|
||||
</resources>
|
||||
|
|
|
@ -66,6 +66,12 @@
|
|||
android:ringtoneType="notification"
|
||||
android:summary="@string/pref_sound_summary"
|
||||
android:title="@string/pref_sound"/>
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="@bool/headsup_notifications"
|
||||
android:dependency="show_notification"
|
||||
android:key="notification_headsup"
|
||||
android:title="@string/pref_headsup_notifications"
|
||||
android:summary="@string/pref_headsup_notifications_summary"/>
|
||||
<PreferenceScreen
|
||||
android:dependency="show_notification"
|
||||
android:key="quiet_hours"
|
||||
|
|
Loading…
Reference in New Issue