|
|
@ -57,6 +57,7 @@ public class ServiceUI extends IntentService {
|
|
|
|
static final int PI_HIDE = 9;
|
|
|
|
static final int PI_HIDE = 9;
|
|
|
|
static final int PI_SNOOZE = 10;
|
|
|
|
static final int PI_SNOOZE = 10;
|
|
|
|
static final int PI_IGNORED = 11;
|
|
|
|
static final int PI_IGNORED = 11;
|
|
|
|
|
|
|
|
static final int PI_DELETE = 12;
|
|
|
|
|
|
|
|
|
|
|
|
public ServiceUI() {
|
|
|
|
public ServiceUI() {
|
|
|
|
this(ServiceUI.class.getName());
|
|
|
|
this(ServiceUI.class.getName());
|
|
|
@ -108,6 +109,11 @@ public class ServiceUI extends IntentService {
|
|
|
|
onMove(id, EntityFolder.TRASH);
|
|
|
|
onMove(id, EntityFolder.TRASH);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "delete":
|
|
|
|
|
|
|
|
cancel(group, id);
|
|
|
|
|
|
|
|
onDelete(id);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "junk":
|
|
|
|
case "junk":
|
|
|
|
cancel(group, id);
|
|
|
|
cancel(group, id);
|
|
|
|
onJunk(id);
|
|
|
|
onJunk(id);
|
|
|
@ -249,6 +255,23 @@ public class ServiceUI extends IntentService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void onDelete(long id) {
|
|
|
|
|
|
|
|
DB db = DB.getInstance(this);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
db.beginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
|
|
|
|
if (message == null)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EntityOperation.queue(this, message, EntityOperation.DELETE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
db.endTransaction();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onJunk(long id) throws JSONException {
|
|
|
|
private void onJunk(long id) throws JSONException {
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
boolean block_sender = prefs.getBoolean("notify_block_sender", false);
|
|
|
|
boolean block_sender = prefs.getBoolean("notify_block_sender", false);
|
|
|
|