Do not display "X messages send" message when sending cancelled

This commit is contained in:
Mathieu Maret 2011-10-30 01:18:11 +02:00
parent 33ece37bba
commit f83001f0ba

View File

@ -292,7 +292,6 @@ public class MultiSmsSender extends Activity {
if (mManyMessageContinue) { if (mManyMessageContinue) {
int message_sent = 0; int message_sent = 0;
int chunk_max = Math.min(MANY_MESSAGE, size); int chunk_max = Math.min(MANY_MESSAGE, size);
do { do {
@ -307,12 +306,12 @@ public class MultiSmsSender extends Activity {
} }
} }
//Log.d(DEBUG_TAG, "size is"+size+" message_sent "+message_sent+" max"+chunk_max); // Log.d(DEBUG_TAG,
// "size is"+size+" message_sent "+message_sent+" max"+chunk_max);
for (int i = message_sent; i < chunk_max; i++) { for (int i = message_sent; i < chunk_max; i++) {
message_sent++; message_sent++;
String newN = numbers[i]; String newN = numbers[i];
Message msg = handler.obtainMessage(); Message msg = handler.obtainMessage();
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putInt("ORIGIN", DIALOG_PROGRESS); b.putInt("ORIGIN", DIALOG_PROGRESS);
@ -320,48 +319,51 @@ public class MultiSmsSender extends Activity {
msg.setData(b); msg.setData(b);
handler.sendMessage(msg); handler.sendMessage(msg);
ArrayList<PendingIntent> deliveryIntents = null; ArrayList<PendingIntent> deliveryIntents = null;
ArrayList<PendingIntent> sentIntents = null; ArrayList<PendingIntent> sentIntents = null;
if (haveDeliveryReports) { if (haveDeliveryReports) {
deliveryIntents = new ArrayList<PendingIntent>(messageCount); deliveryIntents = new ArrayList<PendingIntent>(
messageCount);
// Add to the Google MMS app // Add to the Google MMS app
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put("address", newN); values.put("address", newN);
values.put("body", message); values.put("body", message);
getContentResolver().insert(Uri.parse("content://sms/sent"), values); getContentResolver().insert(
Uri.parse("content://sms/sent"), values);
long entryId = deliveryIdMap.get(newN); long entryId = deliveryIdMap.get(newN);
//Log.d(DEBUG_TAG, "entry is "+entryId+" to number"+newN); // Log.d(DEBUG_TAG,
// "entry is "+entryId+" to number"+newN);
for (int j = 0; j < messageCount; j++) { for (int j = 0; j < messageCount; j++) {
Uri entryURI = Uri.withAppendedPath(EntryContentProvider.CONTENT_URI, ""+entryId); Uri entryURI = Uri.withAppendedPath(
Intent intent = new Intent(MessageReceiver.MESSAGE_RECEIVED,entryURI, this, MessageReceiver.class); EntryContentProvider.CONTENT_URI, ""
+ entryId);
Intent intent = new Intent(
MessageReceiver.MESSAGE_RECEIVED,
entryURI, this, MessageReceiver.class);
// intent.putExtra(PARAM_ENTRY_ID, entryId); // intent.putExtra(PARAM_ENTRY_ID, entryId);
deliveryIntents.add(PendingIntent.getBroadcast( deliveryIntents.add(PendingIntent.getBroadcast(
this, 0, intent, 0)); this, 0, intent, 0));
} }
} }
manager.sendMultipartTextMessage(newN, null, messages, sentIntents, deliveryIntents ); manager.sendMultipartTextMessage(newN, null, messages,
sentIntents, deliveryIntents);
} }
chunk_max = Math.min(message_sent + MANY_MESSAGE, size); chunk_max = Math.min(message_sent + MANY_MESSAGE, size);
} while (((size - message_sent) > 0) && appli_running); } while (((size - message_sent) > 0) && appli_running);
}
Message msg = handler.obtainMessage(); Message msg = handler.obtainMessage();
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putInt("ORIGIN", DIALOG_FINISHED); b.putInt("ORIGIN", DIALOG_FINISHED);
b.putInt("total", phoneNumberConform.size()); b.putInt("total", phoneNumberConform.size());
msg.setData(b); msg.setData(b);
handler.sendMessage(msg); handler.sendMessage(msg);
}