Browse Source

Fixed showing draft saved on finish

main
M66B 6 years ago
parent
commit
14108aea8f
1 changed files with 16 additions and 4 deletions
  1. +16
    -4
      app/src/main/java/eu/faircode/email/FragmentCompose.java

+ 16
- 4
app/src/main/java/eu/faircode/email/FragmentCompose.java View File

@ -31,6 +31,7 @@ import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
import android.text.Html; import android.text.Html;
@ -1106,7 +1107,7 @@ public class FragmentCompose extends FragmentEx {
private SimpleTask<EntityMessage> actionLoader = new SimpleTask<EntityMessage>() { private SimpleTask<EntityMessage> actionLoader = new SimpleTask<EntityMessage>() {
@Override @Override
protected EntityMessage onLoad(Context context, Bundle args) throws Throwable {
protected EntityMessage onLoad(final Context context, Bundle args) throws Throwable {
// Get data // Get data
long id = args.getLong("id"); long id = args.getLong("id");
int action = args.getInt("action"); int action = args.getInt("action");
@ -1156,12 +1157,25 @@ public class FragmentCompose extends FragmentEx {
EntityOperation.queue(db, draft, EntityOperation.DELETE); EntityOperation.queue(db, draft, EntityOperation.DELETE);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
Toast.makeText(context, R.string.title_draft_deleted, Toast.LENGTH_LONG).show();
}
});
} else if (action == R.id.action_save) { } else if (action == R.id.action_save) {
db.message().updateMessage(draft); db.message().updateMessage(draft);
draft.write(context, body); draft.write(context, body);
EntityOperation.queue(db, draft, EntityOperation.ADD); EntityOperation.queue(db, draft, EntityOperation.ADD);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
Toast.makeText(context, R.string.title_draft_saved, Toast.LENGTH_LONG).show();
}
});
} else if (action == R.id.action_send) { } else if (action == R.id.action_send) {
db.message().updateMessage(draft); db.message().updateMessage(draft);
draft.write(context, body); draft.write(context, body);
@ -1230,11 +1244,9 @@ public class FragmentCompose extends FragmentEx {
if (action == R.id.action_delete) { if (action == R.id.action_delete) {
autosave = false; autosave = false;
getFragmentManager().popBackStack(); getFragmentManager().popBackStack();
Toast.makeText(getContext(), R.string.title_draft_deleted, Toast.LENGTH_LONG).show();
} else if (action == R.id.action_save) { } else if (action == R.id.action_save) {
if (draft != null)
Toast.makeText(getContext(), R.string.title_draft_saved, Toast.LENGTH_LONG).show();
// Do nothing
} else if (action == R.id.action_send) { } else if (action == R.id.action_send) {
autosave = false; autosave = false;


Loading…
Cancel
Save