mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 16:43:26 +02:00
Fixed removing prefix
This commit is contained in:
@@ -2261,13 +2261,13 @@ public class FragmentCompose extends FragmentBase {
|
||||
if ("reply".equals(action) || "reply_all".equals(action)) {
|
||||
if (prefix_once) {
|
||||
String re = context.getString(R.string.title_subject_reply, "");
|
||||
subject = subject.replaceAll("(?i)" + Pattern.quote(re.trim()), "").trim();
|
||||
subject = unprefix(subject, re);
|
||||
}
|
||||
data.draft.subject = context.getString(R.string.title_subject_reply, subject);
|
||||
} else if ("forward".equals(action)) {
|
||||
if (prefix_once) {
|
||||
String fwd = context.getString(R.string.title_subject_forward, "");
|
||||
subject = subject.replaceAll("(?i)" + Pattern.quote(fwd.trim()), "").trim();
|
||||
subject = unprefix(subject, fwd);
|
||||
}
|
||||
data.draft.subject = context.getString(R.string.title_subject_forward, subject);
|
||||
} else if ("editasnew".equals(action)) {
|
||||
@@ -3154,6 +3154,14 @@ public class FragmentCompose extends FragmentBase {
|
||||
}
|
||||
};
|
||||
|
||||
private String unprefix(String subject, String prefix) {
|
||||
subject = subject.trim();
|
||||
prefix = prefix.trim().toLowerCase(Locale.ROOT);
|
||||
while (subject.toLowerCase(Locale.ROOT).startsWith(prefix))
|
||||
subject = subject.substring(prefix.length()).trim();
|
||||
return subject;
|
||||
}
|
||||
|
||||
private void showDraft(long id) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", id);
|
||||
|
||||
Reference in New Issue
Block a user