Dirty after adding attachment

pull/147/head
M66B 6 years ago
parent 701c798519
commit e4ec609949

@ -159,6 +159,7 @@ public class FragmentCompose extends FragmentEx {
private State state = State.NONE; private State state = State.NONE;
private boolean autosave = false; private boolean autosave = false;
private boolean busy = false; private boolean busy = false;
private boolean dirty = false;
private OpenPgpServiceConnection pgpService; private OpenPgpServiceConnection pgpService;
@ -1002,6 +1003,11 @@ public class FragmentCompose extends FragmentEx {
args.putParcelable("uri", uri); args.putParcelable("uri", uri);
new SimpleTask<EntityAttachment>() { new SimpleTask<EntityAttachment>() {
@Override
protected void onPostExecute(Bundle args) {
dirty = true;
}
@Override @Override
protected EntityAttachment onExecute(Context context, Bundle args) throws IOException { protected EntityAttachment onExecute(Context context, Bundle args) throws IOException {
Long id = args.getLong("id"); Long id = args.getLong("id");
@ -1079,7 +1085,6 @@ public class FragmentCompose extends FragmentEx {
args.putString("cc", etCc.getText().toString()); args.putString("cc", etCc.getText().toString());
args.putString("bcc", etBcc.getText().toString()); args.putString("bcc", etBcc.getText().toString());
args.putString("subject", etSubject.getText().toString()); args.putString("subject", etSubject.getText().toString());
args.putBoolean("empty", isEmpty());
Spannable spannable = etBody.getText(); Spannable spannable = etBody.getText();
UnderlineSpan[] uspans = spannable.getSpans(0, spannable.length(), UnderlineSpan.class); UnderlineSpan[] uspans = spannable.getSpans(0, spannable.length(), UnderlineSpan.class);
@ -1088,6 +1093,10 @@ public class FragmentCompose extends FragmentEx {
args.putString("body", Html.toHtml(spannable)); args.putString("body", Html.toHtml(spannable));
args.putBoolean("empty", isEmpty());
args.putBoolean("dirty", dirty);
dirty = false;
Log.i("Run execute id=" + working); Log.i("Run execute id=" + working);
actionLoader.execute(this, args); actionLoader.execute(this, args);
} }
@ -1713,7 +1722,9 @@ public class FragmentCompose extends FragmentEx {
String bcc = args.getString("bcc"); String bcc = args.getString("bcc");
String subject = args.getString("subject"); String subject = args.getString("subject");
String body = args.getString("body"); String body = args.getString("body");
boolean empty = args.getBoolean("empty"); boolean empty = args.getBoolean("empty");
boolean dirty = args.getBoolean("dirty");
EntityMessage draft; EntityMessage draft;
@ -1785,7 +1796,7 @@ public class FragmentCompose extends FragmentEx {
extra = null; extra = null;
Long ident = (identity == null ? null : identity.id); Long ident = (identity == null ? null : identity.id);
boolean dirty = dirty = dirty ||
((draft.identity == null ? ident != null : !draft.identity.equals(ident)) || ((draft.identity == null ? ident != null : !draft.identity.equals(ident)) ||
(draft.extra == null ? extra != null : !draft.extra.equals(extra)) || (draft.extra == null ? extra != null : !draft.extra.equals(extra)) ||
!MessageHelper.equal(draft.from, afrom) || !MessageHelper.equal(draft.from, afrom) ||

Loading…
Cancel
Save