Save pref for delivery reports

This commit is contained in:
Mathieu Maret 2012-11-09 14:28:57 +01:00
parent 5bdea2addc
commit 6190c47524

View File

@ -13,8 +13,10 @@ import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
@ -30,6 +32,8 @@ import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
public class MultiSmsSender extends Activity {
@ -59,8 +63,11 @@ public class MultiSmsSender extends Activity {
private static final int SENDING_DIALOG_KEY = 6;
public static final String PARAM_NUMBERS_LIST = "param number list";
public static final String PARAM_FLUSH = "param flush";
public static final String PARAM_ENTRY_ID = "entry_id";
public static final String PARAM_FLUSH = "param flush";
public static final String PARAM_ENTRY_ID = "entry_id";
public static final String PREF_NAME = "com.hectorone.multismssender.pref";
public static final String PREF_USE_DELIVERY = "use_delivery";
public static final String DEBUG_TAG="MultiSmsSender";
@ -220,6 +227,24 @@ public class MultiSmsSender extends Activity {
mThreadSender.start();
}
});
//delivery preference
SharedPreferences settings = getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
boolean deliveryEnabled = settings.getBoolean(PREF_USE_DELIVERY, false);
mDeliveryCheckBox.setChecked(deliveryEnabled);
mDeliveryCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
SharedPreferences settings = getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
settings.edit().putBoolean(PREF_USE_DELIVERY, isChecked);
//TODO prefer apply() to commit() since API 9
settings.edit().commit();
}
});
}
public void selectNumbers() {