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 message_sent = 0;
int chunk_max = Math.min(MANY_MESSAGE, size); int chunk_max = Math.min(MANY_MESSAGE, size);
do { do {
if(message_sent > 0) { if (message_sent > 0) {
displayDialog(handler, DIALOG_STARTWAIT,null); displayDialog(handler, DIALOG_STARTWAIT, null);
synchronized (MultiSmsSender.this) { synchronized (MultiSmsSender.this) {
try { try {
MultiSmsSender.this.wait(); 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); // Log.d(DEBUG_TAG,
for(int i = message_sent; i < chunk_max; i++) { // "size is"+size+" message_sent "+message_sent+" max"+chunk_max);
message_sent ++; for (int i = message_sent; i < chunk_max; i++) {
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);
b.putInt("total", (i*100)/size); b.putInt("total", (i * 100) / size);
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, ""
//intent.putExtra(PARAM_ENTRY_ID, entryId); + entryId);
Intent intent = new Intent(
MessageReceiver.MESSAGE_RECEIVED,
entryURI, this, MessageReceiver.class);
// 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();
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);