mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Added option for contact names only
This commit is contained in:
parent
14389f9efa
commit
48a259a9ef
6 changed files with 31 additions and 7 deletions
|
@ -244,6 +244,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
private boolean color_stripe;
|
||||
private boolean name_email;
|
||||
private boolean prefer_contact;
|
||||
private boolean only_contact;
|
||||
private boolean distinguish_contacts;
|
||||
private boolean show_recipients;
|
||||
private Float font_size_sender;
|
||||
|
@ -935,9 +936,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
boolean reverse = (outgoing && (viewType != ViewType.THREAD || !threading));
|
||||
Address[] addresses = (reverse ? message.to : message.from);
|
||||
Address[] senders = ContactInfo.fillIn(
|
||||
reverse && !show_recipients ? message.to : message.senders, prefer_contact);
|
||||
reverse && !show_recipients ? message.to : message.senders, prefer_contact, only_contact);
|
||||
Address[] recipients = ContactInfo.fillIn(
|
||||
reverse && !show_recipients ? message.from : message.recipients, prefer_contact);
|
||||
reverse && !show_recipients ? message.from : message.recipients, prefer_contact, only_contact);
|
||||
boolean authenticated =
|
||||
!(Boolean.FALSE.equals(message.dkim) ||
|
||||
Boolean.FALSE.equals(message.spf) ||
|
||||
|
@ -5328,6 +5329,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
this.color_stripe = prefs.getBoolean("color_stripe", true);
|
||||
this.name_email = prefs.getBoolean("name_email", false);
|
||||
this.prefer_contact = prefs.getBoolean("prefer_contact", false);
|
||||
this.only_contact = prefs.getBoolean("only_contact", false);
|
||||
this.distinguish_contacts = prefs.getBoolean("distinguish_contacts", false);
|
||||
this.show_recipients = prefs.getBoolean("show_recipients", false);
|
||||
|
||||
|
|
|
@ -691,7 +691,7 @@ public class ContactInfo {
|
|||
return null;
|
||||
}
|
||||
|
||||
static Address[] fillIn(Address[] addresses, boolean prefer_contact) {
|
||||
static Address[] fillIn(Address[] addresses, boolean prefer_contact, boolean only_contact) {
|
||||
if (addresses == null)
|
||||
return null;
|
||||
|
||||
|
@ -699,7 +699,7 @@ public class ContactInfo {
|
|||
for (int i = 0; i < addresses.length; i++) {
|
||||
InternetAddress address = (InternetAddress) addresses[i];
|
||||
String email = address.getAddress();
|
||||
String personal = address.getPersonal();
|
||||
String personal = (only_contact ? null : address.getPersonal());
|
||||
if (!TextUtils.isEmpty(email)) {
|
||||
Lookup lookup = emailLookup.get(email.toLowerCase(Locale.ROOT));
|
||||
if (lookup != null &&
|
||||
|
|
|
@ -84,7 +84,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
"indentation", "date", "threading", "threading_unread",
|
||||
"highlight_unread", "highlight_color", "color_stripe",
|
||||
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
"name_email", "prefer_contact", "distinguish_contacts", "show_recipients", "authentication",
|
||||
"name_email", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients", "authentication",
|
||||
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
|
||||
"keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
|
||||
"message_zoom", "overview_mode", "addresses", "attachments_alt", "thumbnails",
|
||||
|
|
|
@ -99,6 +99,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SeekBar sbThreshold;
|
||||
private SwitchCompat swNameEmail;
|
||||
private SwitchCompat swPreferContact;
|
||||
private SwitchCompat swOnlyContact;
|
||||
private SwitchCompat swDistinguishContacts;
|
||||
private SwitchCompat swShowRecipients;
|
||||
private SwitchCompat swSubjectTop;
|
||||
|
@ -145,7 +146,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
|
||||
"highlight_unread", "highlight_color", "color_stripe",
|
||||
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
"name_email", "prefer_contact", "distinguish_contacts", "show_recipients",
|
||||
"name_email", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients",
|
||||
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
|
||||
"keywords_header", "labels_header", "flags", "flags_background",
|
||||
"preview", "preview_italic", "preview_lines",
|
||||
|
@ -205,6 +206,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
sbThreshold = view.findViewById(R.id.sbThreshold);
|
||||
swNameEmail = view.findViewById(R.id.swNameEmail);
|
||||
swPreferContact = view.findViewById(R.id.swPreferContact);
|
||||
swOnlyContact = view.findViewById(R.id.swOnlyContact);
|
||||
swDistinguishContacts = view.findViewById(R.id.swDistinguishContacts);
|
||||
swShowRecipients = view.findViewById(R.id.swShowRecipients);
|
||||
swSubjectTop = view.findViewById(R.id.swSubjectTop);
|
||||
|
@ -554,6 +556,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
}
|
||||
});
|
||||
|
||||
swOnlyContact.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("only_contact", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swDistinguishContacts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -950,6 +959,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
|
||||
swNameEmail.setChecked(prefs.getBoolean("name_email", false));
|
||||
swPreferContact.setChecked(prefs.getBoolean("prefer_contact", false));
|
||||
swOnlyContact.setChecked(prefs.getBoolean("only_contact", false));
|
||||
swDistinguishContacts.setChecked(prefs.getBoolean("distinguish_contacts", false));
|
||||
swShowRecipients.setChecked(prefs.getBoolean("show_recipients", false));
|
||||
swSubjectTop.setChecked(prefs.getBoolean("subject_top", false));
|
||||
|
|
|
@ -603,6 +603,17 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/tvNameEmailHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swOnlyContact"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_only_name"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swPreferContact"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swDistinguishContacts"
|
||||
android:layout_width="0dp"
|
||||
|
@ -611,7 +622,7 @@
|
|||
android:text="@string/title_advanced_distinguish_contacts"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swPreferContact"
|
||||
app:layout_constraintTop_toBottomOf="@id/swOnlyContact"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -375,6 +375,7 @@
|
|||
<string name="title_advanced_color_threshold">Threshold letter color: %1$s %%</string>
|
||||
<string name="title_advanced_name_email">Show names and email addresses</string>
|
||||
<string name="title_advanced_replace_name">Prefer a contact name over a sent name</string>
|
||||
<string name="title_advanced_only_name">Display contact names only</string>
|
||||
<string name="title_advanced_distinguish_contacts">Underline the sender when the sender is known as local \'to\' contact</string>
|
||||
<string name="title_advanced_show_recipients">Show recipients in message header</string>
|
||||
<string name="title_advanced_font_size_sender">Text size sender</string>
|
||||
|
|
Loading…
Reference in a new issue