Compose in message lists only

pull/145/head
M66B 7 years ago
parent 4948e2b9ba
commit f336306606

@ -529,54 +529,56 @@ public class FragmentMessages extends FragmentEx {
loadMessages(); loadMessages();
// Compose FAB // Compose FAB
Bundle args = new Bundle(); if (viewType != AdapterMessage.ViewType.THREAD) {
args.putLong("folder", folder); Bundle args = new Bundle();
args.putLong("thread", thread); args.putLong("folder", folder);
args.putLong("thread", thread);
new SimpleTask<Long>() {
@Override new SimpleTask<Long>() {
protected Long onLoad(Context context, Bundle args) { @Override
long fid = args.getLong("folder", -1); protected Long onLoad(Context context, Bundle args) {
long thread = args.getLong("thread", -1); // message ID long fid = args.getLong("folder", -1);
long thread = args.getLong("thread", -1); // message ID
DB db = DB.getInstance(context);
DB db = DB.getInstance(context);
Long account = null;
if (thread < 0) {
if (folder >= 0) {
EntityFolder folder = db.folder().getFolder(fid);
if (folder != null)
account = folder.account;
}
} else {
EntityMessage threaded = db.message().getMessage(thread);
if (threaded != null)
account = threaded.account;
}
Long account = null; if (account == null) {
if (thread < 0) { // outbox
if (folder >= 0) { EntityFolder primary = db.folder().getPrimaryDrafts();
EntityFolder folder = db.folder().getFolder(fid); if (primary != null)
if (folder != null) account = primary.account;
account = folder.account;
} }
} else {
EntityMessage threaded = db.message().getMessage(thread);
if (threaded != null)
account = threaded.account;
}
if (account == null) { return account;
// outbox
EntityFolder primary = db.folder().getPrimaryDrafts();
if (primary != null)
account = primary.account;
} }
return account; @Override
} protected void onLoaded(Bundle args, Long account) {
if (account != null) {
@Override fab.setTag(account);
protected void onLoaded(Bundle args, Long account) { fab.show();
if (account != null) { }
fab.setTag(account);
fab.show();
} }
}
@Override @Override
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), ex); Helper.unexpectedError(getContext(), ex);
} }
}.load(this, args); }.load(this, args);
}
} }
@Override @Override

Loading…
Cancel
Save