Allow translating/transliterating 'from' email address

This commit is contained in:
M66B 2023-11-27 12:20:35 +01:00
parent 6e668fe374
commit 49d9286b56
1 changed files with 15 additions and 3 deletions

View File

@ -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<TupleIdentityEx> 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()