From ac9a5e52dc349faae2a7d8a990ff2b674c61f027 Mon Sep 17 00:00:00 2001 From: Alexander Blom Date: Wed, 1 Feb 2012 18:32:18 +0100 Subject: [PATCH] Use name and number for SMS delivery reports Switched SMS delivery reports to display both name and number of the contact instead of just displaying their number. I also switched to using Context.getString() instead of String.format and also added brackets to the if statements to follow the Android coding style. Change-Id: Icb95712714523c2ac465835eeb94a99865fae0c3 Signed-off-by: Alexander Blom --- .../mms/transaction/MessagingNotification.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/com/android/mms/transaction/MessagingNotification.java b/src/com/android/mms/transaction/MessagingNotification.java index 160b24e20..0ed2466b4 100644 --- a/src/com/android/mms/transaction/MessagingNotification.java +++ b/src/com/android/mms/transaction/MessagingNotification.java @@ -340,18 +340,22 @@ private static final MmsSmsDeliveryInfo getSmsNewDeliveryInfo(Context context) { SMS_STATUS_PROJECTION, NEW_DELIVERY_SM_CONSTRAINT, null, Sms.DATE); - if (cursor == null) + if (cursor == null) { return null; + } try { - if (!cursor.moveToLast()) - return null; + if (!cursor.moveToLast()) { + return null; + } String address = cursor.getString(COLUMN_SMS_ADDRESS); long timeMillis = 3000; - return new MmsSmsDeliveryInfo(String.format( - context.getString(R.string.delivery_toast_body), address), + Contact contact = Contact.get(address, false); + String name = contact.getNameAndNumber(); + + return new MmsSmsDeliveryInfo(context.getString(R.string.delivery_toast_body, name), timeMillis); } finally {