diff --git a/res/values/strings.xml b/res/values/strings.xml index 0999db8a58..de8a62cefa 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -437,6 +437,8 @@ Select LED Blink Pattern Select LED Color Sound + In thread notifications + Play notification sound while in thread. Vibrate Also vibrate when notified minutes diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index f6b5a53545..d166319807 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -50,12 +50,22 @@ android:title="@string/preferences__sound" android:ringtoneType="notification" android:defaultValue="content://settings/system/notification_sound" /> + + + + + diff --git a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java index 953e50fade..358b80fee6 100644 --- a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java +++ b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java @@ -58,6 +58,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr private static final int ENABLE_PASSPHRASE_ACTIVITY = 2; public static final String RINGTONE_PREF = "pref_key_ringtone"; + public static final String IN_THREAD_NOTIFICATION_PREF = "pref_key_inthread_notifications"; public static final String VIBRATE_PREF = "pref_key_vibrate"; public static final String NOTIFICATION_PREF = "pref_key_enable_notifications"; public static final String LED_COLOR_PREF = "pref_led_color"; diff --git a/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java b/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java index e13bbd74f0..9351c55806 100644 --- a/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java +++ b/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java @@ -228,6 +228,11 @@ public class MessageNotifier { private static void sendInThreadNotification(Context context) { try { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); + + if (!sp.getBoolean(ApplicationPreferencesActivity.IN_THREAD_NOTIFICATION_PREF, true)) { + return; + } + String ringtone = sp.getString(ApplicationPreferencesActivity.RINGTONE_PREF, null); if (ringtone == null)