|
|
@ -94,7 +94,6 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
private boolean outgoing = false;
|
|
|
|
private boolean outgoing = false;
|
|
|
|
private String thread = null;
|
|
|
|
private String thread = null;
|
|
|
|
private long id = -1;
|
|
|
|
private long id = -1;
|
|
|
|
private boolean found = false;
|
|
|
|
|
|
|
|
private String search = null;
|
|
|
|
private String search = null;
|
|
|
|
|
|
|
|
|
|
|
|
private boolean threading = true;
|
|
|
|
private boolean threading = true;
|
|
|
@ -136,7 +135,6 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
outgoing = args.getBoolean("outgoing", false);
|
|
|
|
outgoing = args.getBoolean("outgoing", false);
|
|
|
|
thread = args.getString("thread");
|
|
|
|
thread = args.getString("thread");
|
|
|
|
id = args.getLong("id", -1);
|
|
|
|
id = args.getLong("id", -1);
|
|
|
|
found = args.getBoolean("found", false);
|
|
|
|
|
|
|
|
search = args.getString("search");
|
|
|
|
search = args.getString("search");
|
|
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
@ -548,7 +546,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
result.target = target;
|
|
|
|
result.target = target;
|
|
|
|
|
|
|
|
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
message.account, message.thread, threading && thread ? null : id, message.folder, message.ui_found);
|
|
|
|
message.account, message.thread, threading && thread ? null : id, message.folder);
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
db.message().setMessageUiHide(threaded.id, true);
|
|
|
|
db.message().setMessageUiHide(threaded.id, true);
|
|
|
@ -606,7 +604,6 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putLong("account", account);
|
|
|
|
args.putLong("account", account);
|
|
|
|
args.putString("thread", thread);
|
|
|
|
args.putString("thread", thread);
|
|
|
|
args.putBoolean("found", found);
|
|
|
|
|
|
|
|
args.putString("folderType", folderType);
|
|
|
|
args.putString("folderType", folderType);
|
|
|
|
|
|
|
|
|
|
|
|
new SimpleTask<MessageTarget>() {
|
|
|
|
new SimpleTask<MessageTarget>() {
|
|
|
@ -614,7 +611,6 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
protected MessageTarget onLoad(Context context, Bundle args) {
|
|
|
|
protected MessageTarget onLoad(Context context, Bundle args) {
|
|
|
|
long account = args.getLong("account");
|
|
|
|
long account = args.getLong("account");
|
|
|
|
String thread = args.getString("thread");
|
|
|
|
String thread = args.getString("thread");
|
|
|
|
boolean found = args.getBoolean("found");
|
|
|
|
|
|
|
|
String folderType = args.getString("folderType");
|
|
|
|
String folderType = args.getString("folderType");
|
|
|
|
|
|
|
|
|
|
|
|
MessageTarget result = new MessageTarget();
|
|
|
|
MessageTarget result = new MessageTarget();
|
|
|
@ -626,7 +622,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
result.target = db.folder().getFolderByType(account, folderType);
|
|
|
|
result.target = db.folder().getFolderByType(account, folderType);
|
|
|
|
|
|
|
|
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
account, thread, threading ? null : id, null, found);
|
|
|
|
account, thread, threading ? null : id, null);
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
|
if (!result.target.id.equals(threaded.folder)) {
|
|
|
|
if (!result.target.id.equals(threaded.folder)) {
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
result.ids.add(threaded.id);
|
|
|
@ -659,8 +655,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
new Intent(ActivityView.ACTION_VIEW_THREAD)
|
|
|
|
new Intent(ActivityView.ACTION_VIEW_THREAD)
|
|
|
|
.putExtra("account", target.account)
|
|
|
|
.putExtra("account", target.account)
|
|
|
|
.putExtra("thread", target.thread)
|
|
|
|
.putExtra("thread", target.thread)
|
|
|
|
.putExtra("id", target.id)
|
|
|
|
.putExtra("id", target.id));
|
|
|
|
.putExtra("found", target.found));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -851,7 +846,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
if (message.ui_seen != seen) {
|
|
|
|
if (message.ui_seen != seen) {
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder, message.ui_found);
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
|
EntityOperation.queue(db, threaded, EntityOperation.SEEN, seen);
|
|
|
|
EntityOperation.queue(db, threaded, EntityOperation.SEEN, seen);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -893,7 +888,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
if (message.ui_flagged != flagged) {
|
|
|
|
if (message.ui_flagged != flagged) {
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder, message.ui_found);
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
|
EntityOperation.queue(db, threaded, EntityOperation.FLAG, flagged);
|
|
|
|
EntityOperation.queue(db, threaded, EntityOperation.FLAG, flagged);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -950,7 +945,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder, message.ui_found);
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
if (threaded.uid == null && !TextUtils.isEmpty(threaded.error)) // outbox
|
|
|
|
if (threaded.uid == null && !TextUtils.isEmpty(threaded.error)) // outbox
|
|
|
|
db.message().deleteMessage(threaded.id);
|
|
|
|
db.message().deleteMessage(threaded.id);
|
|
|
@ -1003,7 +998,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder, message.ui_found);
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
db.message().setMessageUiHide(threaded.id, true);
|
|
|
|
db.message().setMessageUiHide(threaded.id, true);
|
|
|
@ -1092,7 +1087,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder, message.ui_found);
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
db.message().setMessageUiHide(threaded.id, true);
|
|
|
|
db.message().setMessageUiHide(threaded.id, true);
|
|
|
@ -1363,7 +1358,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
new SimpleTask<Void>() {
|
|
|
|
new SimpleTask<Void>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected Void onLoad(Context context, Bundle args) {
|
|
|
|
protected Void onLoad(Context context, Bundle args) {
|
|
|
|
DB.getInstance(context).message().deleteFoundMessages();
|
|
|
|
DB.getInstance(context).message().resetSearch();
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1485,7 +1480,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
db.beginTransaction();
|
|
|
|
db.beginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
for (EntityMessage message : db.message().getMessageSeen(outbox, false)) {
|
|
|
|
for (EntityMessage message : db.message().getMessageSeen(outbox)) {
|
|
|
|
EntityIdentity identity = db.identity().getIdentity(message.identity);
|
|
|
|
EntityIdentity identity = db.identity().getIdentity(message.identity);
|
|
|
|
EntityFolder sent = db.folder().getFolderByType(identity.account, EntityFolder.SENT);
|
|
|
|
EntityFolder sent = db.folder().getFolderByType(identity.account, EntityFolder.SENT);
|
|
|
|
if (sent != null) {
|
|
|
|
if (sent != null) {
|
|
|
@ -1574,7 +1569,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
|
|
|
|
|
|
|
|
case THREAD:
|
|
|
|
case THREAD:
|
|
|
|
messages = new LivePagedListBuilder<>(
|
|
|
|
messages = new LivePagedListBuilder<>(
|
|
|
|
db.message().pagedThread(account, thread, threading ? null : id, found, sort, debug), LOCAL_PAGE_SIZE).build();
|
|
|
|
db.message().pagedThread(account, thread, threading ? null : id, sort, debug), LOCAL_PAGE_SIZE).build();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|