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)
diff --git a/src/org/thoughtcrime/securesms/service/KeyCachingService.java b/src/org/thoughtcrime/securesms/service/KeyCachingService.java
index 7422ad0d3e..e24026c9e6 100644
--- a/src/org/thoughtcrime/securesms/service/KeyCachingService.java
+++ b/src/org/thoughtcrime/securesms/service/KeyCachingService.java
@@ -189,7 +189,7 @@ public class KeyCachingService extends Service {
}
private void foregroundServiceModern() {
- Notification notification = new Notification(R.drawable.icon_cached, null, System.currentTimeMillis());
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.key_caching_notification);
Intent intent = new Intent(this, KeyCachingService.class);
@@ -197,10 +197,11 @@ public class KeyCachingService extends Service {
PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 0, intent, 0);
remoteViews.setOnClickPendingIntent(R.id.lock_cache_icon, pendingIntent);
- notification.contentView = remoteViews;
+ builder.setSmallIcon(R.drawable.icon_cached);
+ builder.setContent(remoteViews);
stopForeground(true);
- startForeground(SERVICE_RUNNING_ID, notification);
+ startForeground(SERVICE_RUNNING_ID, builder.build());
}
private void foregroundServiceLegacy() {
diff --git a/src/org/thoughtcrime/securesms/transport/SmsTransport.java b/src/org/thoughtcrime/securesms/transport/SmsTransport.java
index 75764cb1c3..e0b068b2e1 100644
--- a/src/org/thoughtcrime/securesms/transport/SmsTransport.java
+++ b/src/org/thoughtcrime/securesms/transport/SmsTransport.java
@@ -60,15 +60,19 @@ public class SmsTransport {
// and messages, this will throw an NPE. I have no idea why, so I'm just catching it and marking
// the message as a failure. That way at least it doesn't repeatedly crash every time you start
// the app.
+ // d3sre 12/10/13 -- extended the log file to further analyse the problem
try {
SmsManager.getDefault().sendTextMessage(message.getIndividualRecipient().getNumber(), null, messages.get(i),
sentIntents.get(i),
deliveredIntents == null ? null : deliveredIntents.get(i));
} catch (NullPointerException npe) {
- Log.w("SmsSender", npe);
+ Log.w("SmsTransport", npe);
+ Log.w("SmsTransport", "Recipient: " + message.getIndividualRecipient().getNumber());
+ Log.w("SmsTransport", "Message Total Parts/Current: " + messages.size() + "/" + i);
+ Log.w("SmsTransport", "Message Part Length: " + messages.get(i).getBytes().length);
throw new UndeliverableMessageException(npe);
} catch (IllegalArgumentException iae) {
- Log.w("SmsSender", iae);
+ Log.w("SmsTransport", iae);
throw new UndeliverableMessageException(iae);
}
}
@@ -87,10 +91,16 @@ public class SmsTransport {
// and messages, this will throw an NPE. I have no idea why, so I'm just catching it and marking
// the message as a failure. That way at least it doesn't repeatedly crash every time you start
// the app.
+ // d3sre 12/10/13 -- extended the log file to further analyse the problem
try {
SmsManager.getDefault().sendMultipartTextMessage(recipient, null, messages, sentIntents, deliveredIntents);
} catch (NullPointerException npe) {
Log.w("SmsTransport", npe);
+ Log.w("SmsTransport", "Recipient: " + recipient);
+ Log.w("SmsTransport", "Message Parts: " + messages.size());
+ for (String messagePart: messages) {
+ Log.w("SmsTransport", "Message Part Length: " + messagePart.getBytes().length);
+ }
throw new UndeliverableMessageException(npe);
}
}