diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogTranslate.java b/app/src/main/java/eu/faircode/email/FragmentDialogTranslate.java index f584f4b94f..7d0281163f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogTranslate.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogTranslate.java @@ -32,6 +32,7 @@ import android.os.Bundle; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.Spanned; +import android.text.TextUtils; import android.text.method.ArrowKeyMovementMethod; import android.text.style.ForegroundColorSpan; import android.text.style.ImageSpan; @@ -62,6 +63,8 @@ import java.io.IOException; import java.util.List; import java.util.Locale; +import javax.mail.Address; + public class FragmentDialogTranslate extends FragmentDialogBase { @NonNull @Override @@ -360,9 +363,18 @@ public class FragmentDialogTranslate extends FragmentDialogBase { SpannableStringBuilder ssb = HtmlHelper.fromDocument(context, d, null, null); - if (message != null && message.subject != null) { - ssb.insert(0, "\n\n"); - ssb.insert(0, message.subject); + if (message != null) { + if (!TextUtils.isEmpty(message.subject)) { + ssb.insert(0, "\n\n"); + ssb.insert(0, message.subject); + } + + List identities = db.identity().getComposableIdentities(message.account); + Address[] from = (message.fromSelf(identities) ? message.to : message.from); + if (from != null && from.length > 0) { + ssb.insert(0, "\n\n"); + ssb.insert(0, MessageHelper.formatAddresses(from)); + } } return ssb.toString()