Browse Source

Compose in message lists only

main
M66B 6 years ago
parent
commit
f336306606
1 changed files with 43 additions and 41 deletions
  1. +43
    -41
      app/src/main/java/eu/faircode/email/FragmentMessages.java

+ 43
- 41
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

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


Loading…
Cancel
Save