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

@ -290,14 +290,13 @@ public class MultiSmsSender extends Activity {
}
if(mManyMessageContinue) {
if (mManyMessageContinue) {
int message_sent = 0;
int chunk_max = Math.min(MANY_MESSAGE, size);
do {
if(message_sent > 0) {
displayDialog(handler, DIALOG_STARTWAIT,null);
if (message_sent > 0) {
displayDialog(handler, DIALOG_STARTWAIT, null);
synchronized (MultiSmsSender.this) {
try {
MultiSmsSender.this.wait();
@ -307,61 +306,64 @@ public class MultiSmsSender extends Activity {
}
}
//Log.d(DEBUG_TAG, "size is"+size+" message_sent "+message_sent+" max"+chunk_max);
for(int i = message_sent; i < chunk_max; i++) {
message_sent ++;
// Log.d(DEBUG_TAG,
// "size is"+size+" message_sent "+message_sent+" max"+chunk_max);
for (int i = message_sent; i < chunk_max; i++) {
message_sent++;
String newN = numbers[i];
Message msg = handler.obtainMessage();
Bundle b = new Bundle();
b.putInt("ORIGIN", DIALOG_PROGRESS);
b.putInt("total", (i*100)/size);
b.putInt("total", (i * 100) / size);
msg.setData(b);
handler.sendMessage(msg);
ArrayList<PendingIntent> deliveryIntents = null;
ArrayList<PendingIntent> sentIntents = null;
if (haveDeliveryReports) {
deliveryIntents = new ArrayList<PendingIntent>(messageCount);
deliveryIntents = new ArrayList<PendingIntent>(
messageCount);
// Add to the Google MMS app
ContentValues values = new ContentValues();
values.put("address", newN);
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);
//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++) {
Uri entryURI = Uri.withAppendedPath(EntryContentProvider.CONTENT_URI, ""+entryId);
Intent intent = new Intent(MessageReceiver.MESSAGE_RECEIVED,entryURI, this, MessageReceiver.class);
//intent.putExtra(PARAM_ENTRY_ID, entryId);
Uri entryURI = Uri.withAppendedPath(
EntryContentProvider.CONTENT_URI, ""
+ entryId);
Intent intent = new Intent(
MessageReceiver.MESSAGE_RECEIVED,
entryURI, this, MessageReceiver.class);
// intent.putExtra(PARAM_ENTRY_ID, entryId);
deliveryIntents.add(PendingIntent.getBroadcast(
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();
Bundle b = new Bundle();
b.putInt("ORIGIN", DIALOG_FINISHED);
b.putInt("total", phoneNumberConform.size());
msg.setData(b);
handler.sendMessage(msg);
}
Message msg = handler.obtainMessage();
Bundle b = new Bundle();
b.putInt("ORIGIN", DIALOG_FINISHED);
b.putInt("total", phoneNumberConform.size() );
msg.setData(b);
handler.sendMessage(msg);