From 2223c40c9342644275a90af6d6a13fdb3061cf70 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Tue, 26 Jan 2010 18:28:38 +0100 Subject: [PATCH] Some test code --- src/com/openwide/android/MultiSmsSender.java | 28 +++++++++++--------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/com/openwide/android/MultiSmsSender.java b/src/com/openwide/android/MultiSmsSender.java index d00aefe..882b916 100644 --- a/src/com/openwide/android/MultiSmsSender.java +++ b/src/com/openwide/android/MultiSmsSender.java @@ -96,7 +96,7 @@ public class MultiSmsSender extends Activity { long deliveryId = -1; ArrayList messages = manager.divideMessage(message); int messageCount = messages.size(); - + //showDialog(SENDING_DIALOG_KEY); mSendingDialog = new ProgressDialog(this); mSendingDialog.setTitle(R.string.sending); @@ -106,7 +106,7 @@ public class MultiSmsSender extends Activity { mSendingDialog.setCancelable(false); mSendingDialog.setMax(size); mSendingDialog.show(); - + if (haveDeliveryReports) { deliveryId = mDbHelper.createDelivery(message.substring(0, Math.min(30, message .length())).replace('\n', ' '), DateFormat.getDateInstance() @@ -116,28 +116,32 @@ public class MultiSmsSender extends Activity { if (numbers.length != 0) { for (int i = 0; i < numbers.length; i++) { String newN = numbers[i].trim(); - + if (!newN.equals("") && PhoneNumberUtils.isWellFormedSmsAddress(newN)) { mSendingDialog.setProgress(i / size); if (!allreadySend.contains(newN)) { allreadySend.add(newN); - - ArrayList sentIntents = null; - if (haveDeliveryReports) { - - sentIntents = new ArrayList(messageCount); - long entryId = mDbHelper.createEntry(mDbHelper.nameFromNumber(newN), newN, deliveryId); + ArrayList deliveryIntents = new ArrayList(messageCount); + ArrayList sentIntents = null; + + + + if (haveDeliveryReports) { + long entryId = mDbHelper.createEntry(mDbHelper.nameFromNumber(newN), newN, deliveryId); for (int j = 0; j < messageCount; j++) { + Intent intent = new Intent(MessageReceiver.MESSAGE_RECEIVED, null, this, MessageReceiver.class); intent.putExtra(PARAM_ENTRY_ID, entryId); - sentIntents.add(PendingIntent.getBroadcast( - this, 0, intent , PendingIntent.FLAG_CANCEL_CURRENT)); + deliveryIntents.add(PendingIntent.getBroadcast( + this, 0, intent , PendingIntent.FLAG_UPDATE_CURRENT)); } + + } - manager.sendMultipartTextMessage(newN, null, messages, null, sentIntents); + manager.sendMultipartTextMessage(newN, null, messages, deliveryIntents, sentIntents); } }