1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-21 23:32:51 +00:00

Added debug option to show full 'from' for junk

This commit is contained in:
M66B 2024-12-15 08:12:18 +01:00
parent bef891d930
commit 04bb4695e1
5 changed files with 32 additions and 4 deletions

View file

@ -283,6 +283,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean hide_attachments_default;
private MessageHelper.AddressFormat email_format;
private boolean email_junk;
private boolean prefer_contact;
private boolean only_contact;
private boolean distinguish_contacts;
@ -1511,7 +1512,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
}
tvFrom.setText(MessageHelper.formatAddresses(senders, format, false));
tvFrom.setText(MessageHelper.formatAddresses(senders,
EntityFolder.JUNK.equals(message.folderType) && email_junk
? MessageHelper.AddressFormat.EMAIL_NAME : email_format,
false));
}
tvFrom.setPaintFlags(tvFrom.getPaintFlags() & ~Paint.UNDERLINE_TEXT_FLAG);
@ -8396,6 +8400,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.hide_attachments_default = prefs.getBoolean("hide_attachments", false);
this.email_format = MessageHelper.getAddressFormat(context);
this.email_junk = prefs.getBoolean("email_junk", 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);

View file

@ -175,7 +175,8 @@ public class FragmentOptions extends FragmentBase {
"biometrics",
"default_light",
"vt_enabled", "vt_apikey",
"pdf_preview", "webp"
"pdf_preview", "webp",
"email_junk"
};
@Override

View file

@ -235,6 +235,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swPastePlain;
private SwitchCompat swPasteQuote;
private EditText etFaviconUri;
private SwitchCompat swEmailJunk;
private SwitchCompat swInfra;
private SwitchCompat swTldFlags;
private SwitchCompat swJsonLd;
@ -313,7 +314,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"native_dkim", "native_arc", "native_arc_whitelist", "strict_alignment",
"webp", "animate_images",
"preview_hidden", "preview_quotes",
"easy_correct", "paste_plain", "paste_quote", "favicon_uri", "infra", "tld_flags", "json_ld", "dup_msgids", "thread_byref", "save_user_flags", "mdn",
"easy_correct", "paste_plain", "paste_quote", "favicon_uri", "email_junk", "infra", "tld_flags", "json_ld", "dup_msgids", "thread_byref", "save_user_flags", "mdn",
"app_chooser", "app_chooser_share", "share_task",
"adjacent_links", "adjacent_documents", "adjacent_portrait", "adjacent_landscape",
"delete_confirmation", "delete_notification", "global_keywords", "test_iab"
@ -504,6 +505,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swPastePlain = view.findViewById(R.id.swPastePlain);
swPasteQuote = view.findViewById(R.id.swPasteQuote);
etFaviconUri = view.findViewById(R.id.etFaviconUri);
swEmailJunk = view.findViewById(R.id.swEmailJunk);
swInfra = view.findViewById(R.id.swInfra);
swTldFlags = view.findViewById(R.id.swTldFlags);
swJsonLd = view.findViewById(R.id.swJsonLd);
@ -1745,6 +1747,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swEmailJunk.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("email_junk", checked).apply();
}
});
swInfra.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -2617,6 +2626,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swPasteQuote.setChecked(prefs.getBoolean("paste_quote", false));
etFaviconUri.setText(prefs.getString("favicon_uri", null));
swInfra.setChecked(prefs.getBoolean("infra", false));
swEmailJunk.setChecked(prefs.getBoolean("email_junk", false));
swTldFlags.setChecked(prefs.getBoolean("tld_flags", false));
swJsonLd.setChecked(prefs.getBoolean("json_ld", false));
swDupMsgId.setChecked(prefs.getBoolean("dup_msgids", false));

View file

@ -1838,6 +1838,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etFaviconUri" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swEmailJunk"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_email_junk"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvFaviconUriHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swInfra"
android:layout_width="0dp"
@ -1846,7 +1857,7 @@
android:text="@string/title_advanced_infra"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvFaviconUriHint"
app:layout_constraintTop_toBottomOf="@id/swEmailJunk"
app:switchPadding="12dp" />
<androidx.constraintlayout.helper.widget.Flow

View file

@ -1008,6 +1008,7 @@
<string name="title_advanced_paste_quote" translatable="false">Add paste as quote</string>
<string name="title_advanced_favicon_uri" translatable="false">Favicon alternative URI</string>
<string name="title_advanced_favicon_uri_hint" translatable="false">{domain} will be replaced</string>
<string name="title_advanced_email_junk" translatable="false">Show full \'from\' address for spam messages</string>
<string name="title_advanced_infra" translatable="false">Show infrastructure</string>
<string name="title_advanced_tld_flags" translatable="false">Show TLD flags</string>
<string name="title_advanced_json_ld" translatable="false">Show Linked Data (JSON-LD)</string>