only set non-null bitmaps for notifications

Fixes #2960
Closes #2979

// FREEBIE
pull/1/head
Jake McGinty 10 years ago committed by Moxie Marlinspike
parent 7aaedf500f
commit 4a9028aedd

@ -24,6 +24,7 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Color; import android.graphics.Color;
import android.media.AudioManager; import android.media.AudioManager;
@ -175,12 +176,13 @@ public class MessageNotifier {
return; return;
} }
List<NotificationItem>notifications = notificationState.getNotifications(); List<NotificationItem> notifications = notificationState.getNotifications();
NotificationCompat.Builder builder = new NotificationCompat.Builder(context); NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
Recipient recipient = notifications.get(0).getIndividualRecipient(); Recipient recipient = notifications.get(0).getIndividualRecipient();
Bitmap recipientPhoto = recipient.getContactPhoto();
builder.setSmallIcon(R.drawable.icon_notification); builder.setSmallIcon(R.drawable.icon_notification);
builder.setLargeIcon(recipient.getContactPhoto()); if (recipientPhoto != null) builder.setLargeIcon(recipientPhoto);
builder.setContentTitle(recipient.toShortString()); builder.setContentTitle(recipient.toShortString());
builder.setContentText(notifications.get(0).getText()); builder.setContentText(notifications.get(0).getText());
builder.setContentIntent(notifications.get(0).getPendingIntent(context)); builder.setContentIntent(notifications.get(0).getPendingIntent(context));

Loading…
Cancel
Save