Sort on sender: show email/name

This commit is contained in:
M66B 2022-07-03 07:37:06 +02:00
parent 2acf49e955
commit cdb3a782f0
2 changed files with 5 additions and 3 deletions

View File

@ -7040,7 +7040,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.check_blocklist = prefs.getBoolean("check_blocklist", false);
this.email_format = ("sender".equals(sort)
? MessageHelper.AddressFormat.EMAIL_ONLY
? MessageHelper.AddressFormat.EMAIL_NAME
: MessageHelper.getAddressFormat(context));
this.prefer_contact = prefs.getBoolean("prefer_contact", false);
this.only_contact = prefs.getBoolean("only_contact", false);
@ -7711,7 +7711,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (!sort.equals(this.sort)) {
this.sort = sort;
this.email_format = ("sender".equals(sort)
? MessageHelper.AddressFormat.EMAIL_ONLY
? MessageHelper.AddressFormat.EMAIL_NAME
: MessageHelper.getAddressFormat(context));
properties.refresh();
// Needed to redraw item decorators / add/remove size

View File

@ -2721,7 +2721,7 @@ public class MessageHelper {
}
}
enum AddressFormat {NAME_ONLY, EMAIL_ONLY, NAME_EMAIL}
enum AddressFormat {NAME_ONLY, EMAIL_ONLY, NAME_EMAIL, EMAIL_NAME}
static AddressFormat getAddressFormat(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
@ -2792,6 +2792,8 @@ public class MessageHelper {
if (format == AddressFormat.NAME_EMAIL && !TextUtils.isEmpty(email))
formatted.add(personal + " <" + email + ">");
else if (format == AddressFormat.EMAIL_NAME && !TextUtils.isEmpty(email))
formatted.add("<" + email + "> " + personal);
else
formatted.add(personal);
}