Remove logs. +Stop sending messages when application quit

This commit is contained in:
Mathieu Maret 2011-03-01 22:25:00 +01:00
parent 452941a009
commit 45a7023730
1 changed files with 9 additions and 8 deletions

View File

@ -5,8 +5,6 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@ -20,7 +18,6 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.telephony.PhoneNumberUtils; import android.telephony.PhoneNumberUtils;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -60,6 +57,8 @@ public class MultiSmsSender extends Activity {
public static final String PARAM_ENTRY_ID = "entry_id"; public static final String PARAM_ENTRY_ID = "entry_id";
public static final String DEBUG_TAG="MultiSmsSender"; public static final String DEBUG_TAG="MultiSmsSender";
private boolean appli_running = true;
MessageSenderThread mThreadSender; MessageSenderThread mThreadSender;
private boolean mManyMessageContinue; private boolean mManyMessageContinue;
@ -70,7 +69,7 @@ public class MultiSmsSender extends Activity {
switch (type) { switch (type) {
case DIALOG_PROGRESS:{ case DIALOG_PROGRESS:{
int total = msg.getData().getInt("total"); int total = msg.getData().getInt("total");
Log.d(DEBUG_TAG, "========= total is "+total); //Log.d(DEBUG_TAG, "========= total is "+total);
mSendingDialog.setProgress(total); mSendingDialog.setProgress(total);
} }
break; break;
@ -172,7 +171,8 @@ public class MultiSmsSender extends Activity {
mDeliveryCheckBox = (CheckBox) findViewById(R.id.deliveryCheckBox); mDeliveryCheckBox = (CheckBox) findViewById(R.id.deliveryCheckBox);
mContacts.setImeOptions(EditorInfo.IME_ACTION_NEXT); mContacts.setImeOptions(EditorInfo.IME_ACTION_NEXT);
mEditor.setImeOptions(EditorInfo.IME_ACTION_DONE); // mEditor.setImeOptions(EditorInfo.IME_ACTION_DONE);
mAddButton.setOnClickListener(new OnClickListener() { mAddButton.setOnClickListener(new OnClickListener() {
@ -287,7 +287,7 @@ 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].trim(); String newN = numbers[i].trim();
@ -317,7 +317,7 @@ public class MultiSmsSender extends Activity {
getContentResolver().insert(Uri.parse("content://sms/sent"), values); getContentResolver().insert(Uri.parse("content://sms/sent"), values);
long entryId = mDbHelper.createEntry(mDbHelper.nameFromNumber(newN), newN, deliveryId); long entryId = mDbHelper.createEntry(mDbHelper.nameFromNumber(newN), newN, deliveryId);
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(EntryContentProvider.CONTENT_URI, ""+entryId);
Intent intent = new Intent(MessageReceiver.MESSAGE_RECEIVED,entryURI, this, MessageReceiver.class); Intent intent = new Intent(MessageReceiver.MESSAGE_RECEIVED,entryURI, this, MessageReceiver.class);
@ -336,7 +336,7 @@ public class MultiSmsSender extends Activity {
} }
chunk_max = Math.min(message_sent +MANY_MESSAGE, size); chunk_max = Math.min(message_sent +MANY_MESSAGE, size);
} while ( (size - message_sent) >0); } while ( ((size - message_sent) >0) && appli_running );
} }
Message msg = handler.obtainMessage(); Message msg = handler.obtainMessage();
Bundle b = new Bundle(); Bundle b = new Bundle();
@ -441,6 +441,7 @@ public class MultiSmsSender extends Activity {
} }
protected void onDestroy() { protected void onDestroy() {
appli_running = false;
mDbHelper.close(); mDbHelper.close();
super.onDestroy(); super.onDestroy();
} }