Convert mailto body to HTML

This commit is contained in:
M66B 2020-09-03 13:52:37 +02:00
parent 783a38da03
commit 69fdfdfe7d
1 changed files with 7 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import android.content.Intent;
import android.net.MailTo;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
@ -108,8 +109,12 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
args.putString("subject", subject);
String body = mailto.getBody();
if (body != null)
args.putString("body", body);
if (body != null) {
StringBuilder sb = new StringBuilder();
for (String line : body.split("\\r?\\n"))
sb.append("<span>").append(Html.escapeHtml(line)).append("<span><br>");
args.putString("body", sb.toString());
}
}
if (intent.hasExtra(Intent.EXTRA_SHORTCUT_ID)) {