Small improvement

pull/167/head
M66B 6 years ago
parent 6cf2fae5fb
commit e40372a9ed

@ -755,7 +755,7 @@ public class FragmentCompose extends FragmentBase {
args.putBoolean("plain", plain); args.putBoolean("plain", plain);
args.putString("body", HtmlHelper.toHtml(etBody.getText())); args.putString("body", HtmlHelper.toHtml(etBody.getText()));
new SimpleTask<Spanned>() { new SimpleTask<String>() {
@Override @Override
protected void onPreExecute(Bundle args) { protected void onPreExecute(Bundle args) {
ibReferenceDelete.setEnabled(false); ibReferenceDelete.setEnabled(false);
@ -769,7 +769,7 @@ public class FragmentCompose extends FragmentBase {
} }
@Override @Override
protected Spanned onExecute(Context context, Bundle args) throws Throwable { protected String onExecute(Context context, Bundle args) throws Throwable {
long id = args.getLong("id"); long id = args.getLong("id");
boolean plain = args.getBoolean("plain"); boolean plain = args.getBoolean("plain");
String body = args.getString("body"); String body = args.getString("body");
@ -784,13 +784,13 @@ public class FragmentCompose extends FragmentBase {
html = HtmlHelper.sanitize(context, ref, true); html = HtmlHelper.sanitize(context, ref, true);
refFile.delete(); refFile.delete();
return HtmlHelper.fromHtml(body + html); return body + html;
} }
@Override @Override
protected void onExecuted(Bundle args, Spanned body) { protected void onExecuted(Bundle args, String html) {
etBody.setText(body);
Bundle extras = new Bundle(); Bundle extras = new Bundle();
extras.putString("html", html);
extras.putBoolean("show", true); extras.putBoolean("show", true);
onAction(R.id.action_save, extras); onAction(R.id.action_save, extras);
} }
@ -1959,6 +1959,10 @@ public class FragmentCompose extends FragmentBase {
args.putString("cc", etCc.getText().toString().trim()); args.putString("cc", etCc.getText().toString().trim());
args.putString("bcc", etBcc.getText().toString().trim()); args.putString("bcc", etBcc.getText().toString().trim());
args.putString("subject", etSubject.getText().toString().trim()); args.putString("subject", etSubject.getText().toString().trim());
if (extras.containsKey("html")) {
args.putString("body", extras.getString("html"));
extras.remove("html");
} else
args.putString("body", HtmlHelper.toHtml(etBody.getText())); args.putString("body", HtmlHelper.toHtml(etBody.getText()));
args.putBoolean("empty", isEmpty()); args.putBoolean("empty", isEmpty());
args.putBundle("extras", extras); args.putBundle("extras", extras);

Loading…
Cancel
Save