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 String ringtone = preferences.getString("notification_ringtone", null);
|
||||||
final boolean vibrate = preferences.getBoolean("vibrate_on_notification", true);
|
final boolean vibrate = preferences.getBoolean("vibrate_on_notification", true);
|
||||||
final boolean led = preferences.getBoolean("led", 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 (notify && !isQuietHours()) {
|
||||||
if (vibrate) {
|
if (vibrate) {
|
||||||
final int dat = 70;
|
final int dat = 70;
|
||||||
|
@ -303,7 +304,7 @@ public class NotificationService {
|
||||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
mBuilder.setCategory(Notification.CATEGORY_MESSAGE);
|
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);
|
setNotificationColor(mBuilder);
|
||||||
mBuilder.setDefaults(0);
|
mBuilder.setDefaults(0);
|
||||||
if (led) {
|
if (led) {
|
||||||
|
|
|
@ -4,4 +4,5 @@
|
||||||
<bool name="portrait_only">true</bool>
|
<bool name="portrait_only">true</bool>
|
||||||
<bool name="enter_is_send">false</bool>
|
<bool name="enter_is_send">false</bool>
|
||||||
<bool name="notifications_from_strangers">false</bool>
|
<bool name="notifications_from_strangers">false</bool>
|
||||||
|
<bool name="headsup_notifications">false</bool>
|
||||||
</resources>
|
</resources>
|
|
@ -752,4 +752,6 @@
|
||||||
<string name="account_status_regis_web">Server requires registration on website</string>
|
<string name="account_status_regis_web">Server requires registration on website</string>
|
||||||
<string name="open_website">Open 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="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>
|
</resources>
|
||||||
|
|
|
@ -66,6 +66,12 @@
|
||||||
android:ringtoneType="notification"
|
android:ringtoneType="notification"
|
||||||
android:summary="@string/pref_sound_summary"
|
android:summary="@string/pref_sound_summary"
|
||||||
android:title="@string/pref_sound"/>
|
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
|
<PreferenceScreen
|
||||||
android:dependency="show_notification"
|
android:dependency="show_notification"
|
||||||
android:key="quiet_hours"
|
android:key="quiet_hours"
|
||||||
|
|
Loading…
Reference in a new issue