mirror of https://github.com/M66B/FairEmail.git
Added tld flags debug option
This commit is contained in:
parent
91beda4464
commit
4253164b54
|
@ -312,6 +312,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
private boolean authentication;
|
||||
private boolean authentication_indicator;
|
||||
private boolean infra;
|
||||
private boolean tld_flags;
|
||||
|
||||
private boolean autoclose_unseen;
|
||||
private boolean collapse_marked;
|
||||
|
@ -1428,19 +1429,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
if (viewType == ViewType.THREAD)
|
||||
if (outgoing || message.from == null || message.from.length == 0)
|
||||
tvFrom.setCompoundDrawablesRelative(null, null, null, null);
|
||||
else if (BuildConfig.DEBUG) {
|
||||
else if (tld_flags) {
|
||||
String email = ((InternetAddress) message.from[0]).getAddress();
|
||||
String domain = UriHelper.getEmailDomain(email);
|
||||
String tld = UriHelper.getTld(context, domain);
|
||||
int resid = context.getResources().getIdentifier(
|
||||
"flag_" + tld, "drawable", context.getPackageName());
|
||||
Drawable d = (resid > 0 ? context.getDrawable(resid) : null);
|
||||
if (d == null)
|
||||
tvFrom.setCompoundDrawablesRelative(null, null, null, null);
|
||||
else {
|
||||
d.setBounds(0, 0, dp24, dp24);
|
||||
tvFrom.setCompoundDrawablesRelative(d, null, null, null);
|
||||
}
|
||||
tvFrom.setCompoundDrawablesRelativeWithIntrinsicBounds(d, null, null, null);
|
||||
}
|
||||
|
||||
tvFrom.setText(MessageHelper.formatAddresses(senders, format, false));
|
||||
|
@ -7718,7 +7714,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
this.dp1 = Helper.dp2pixels(context, 1);
|
||||
this.dp12 = Helper.dp2pixels(context, 12);
|
||||
this.dp24 = Helper.dp2pixels(context, 24);
|
||||
this.dp60 = Helper.dp2pixels(context, 60);
|
||||
|
||||
this.accessibility = Helper.isAccessibilityEnabled(context);
|
||||
|
@ -7828,6 +7823,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
this.authentication = prefs.getBoolean("authentication", true);
|
||||
this.authentication_indicator = prefs.getBoolean("authentication_indicator", false);
|
||||
this.infra = prefs.getBoolean("infra", false);
|
||||
this.tld_flags = prefs.getBoolean("tld_flags", false);
|
||||
this.language_detection = prefs.getBoolean("language_detection", false);
|
||||
this.autoclose_unseen = prefs.getBoolean("autoclose_unseen", false);
|
||||
this.collapse_marked = prefs.getBoolean("collapse_marked", true);
|
||||
|
|
|
@ -236,6 +236,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private SwitchCompat swNativeArc;
|
||||
private EditText etNativeArcWhitelist;
|
||||
private SwitchCompat swInfra;
|
||||
private SwitchCompat swTldFlags;
|
||||
private SwitchCompat swDupMsgId;
|
||||
private SwitchCompat swThreadByRef;
|
||||
private EditText etKeywords;
|
||||
|
@ -300,7 +301,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
"max_backoff_power", "logarithmic_backoff",
|
||||
"exact_alarms",
|
||||
"native_dkim", "native_arc", "native_arc_whitelist",
|
||||
"infra", "dup_msgids", "thread_byref", "global_keywords", "test_iab"
|
||||
"infra", "tld_flags", "dup_msgids", "thread_byref", "global_keywords", "test_iab"
|
||||
};
|
||||
|
||||
private final static String[] RESET_QUESTIONS = new String[]{
|
||||
|
@ -484,6 +485,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
swNativeArc = view.findViewById(R.id.swNativeArc);
|
||||
etNativeArcWhitelist = view.findViewById(R.id.etNativeArcWhitelist);
|
||||
swInfra = view.findViewById(R.id.swInfra);
|
||||
swTldFlags = view.findViewById(R.id.swTldFlags);
|
||||
swDupMsgId = view.findViewById(R.id.swDupMsgId);
|
||||
swThreadByRef = view.findViewById(R.id.swThreadByRef);
|
||||
etKeywords = view.findViewById(R.id.etKeywords);
|
||||
|
@ -1824,6 +1826,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
swTldFlags.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("tld_flags", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swDupMsgId.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -2580,6 +2589,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
etNativeArcWhitelist.setEnabled(swNativeDkim.isEnabled() && swNativeDkim.isChecked());
|
||||
etNativeArcWhitelist.setText(prefs.getString("native_arc_whitelist", null));
|
||||
swInfra.setChecked(prefs.getBoolean("infra", false));
|
||||
swTldFlags.setChecked(prefs.getBoolean("tld_flags", false));
|
||||
swDupMsgId.setChecked(prefs.getBoolean("dup_msgids", false));
|
||||
swThreadByRef.setChecked(prefs.getBoolean("thread_byref", true));
|
||||
etKeywords.setText(prefs.getString("global_keywords", null));
|
||||
|
|
|
@ -2225,6 +2225,17 @@
|
|||
app:srcCompat="@drawable/infra_zoho"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swTldFlags"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_tld_flags"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/flowInfra"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDkimVerifyHint"
|
||||
android:layout_width="0dp"
|
||||
|
@ -2237,7 +2248,7 @@
|
|||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/flowInfra" />
|
||||
app:layout_constraintTop_toBottomOf="@id/swTldFlags" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swDupMsgId"
|
||||
|
|
|
@ -896,6 +896,7 @@
|
|||
<string name="title_advanced_native_dkim" translatable="false">Native DKIM verification</string>
|
||||
<string name="title_advanced_native_arc" translatable="false">Native ARC verification</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_dup_msgid" translatable="false">Duplicates by message ID</string>
|
||||
<string name="title_advanced_thread_by_ref" translatable="false">Thread by common reference</string>
|
||||
<string name="title_advanced_global_keywords" translatable="false">Global keywords</string>
|
||||
|
|
Loading…
Reference in New Issue