Added options to disable asking for showing images / original messages

pull/194/merge
M66B 3 years ago
parent b6359b0485
commit c06518608b

@ -4167,7 +4167,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean current = properties.getValue(full ? "full" : "images", message.id); boolean current = properties.getValue(full ? "full" : "images", message.id);
boolean asked = properties.getValue(full ? "full_asked" : "images_asked", message.id); boolean asked = properties.getValue(full ? "full_asked" : "images_asked", message.id);
boolean confirm = prefs.getBoolean(full ? "confirm_html" : "confirm_images", true); boolean confirm = prefs.getBoolean(full ? "confirm_html" : "confirm_images", true);
if (current || asked || !confirm) { boolean ask = prefs.getBoolean(full ? "ask_html" : "ask_images", true);
if (current || asked || !confirm || !ask) {
if (current && message.from != null) { if (current && message.from != null) {
SharedPreferences.Editor editor = prefs.edit(); SharedPreferences.Editor editor = prefs.edit();
for (Address sender : message.from) { for (Address sender : message.from) {

@ -63,8 +63,10 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private SwitchCompat swCheckLinksDbl; private SwitchCompat swCheckLinksDbl;
private SwitchCompat swBrowseLinks; private SwitchCompat swBrowseLinks;
private SwitchCompat swConfirmImages; private SwitchCompat swConfirmImages;
private SwitchCompat swAskImages;
private SwitchCompat swHtmlImages; private SwitchCompat swHtmlImages;
private SwitchCompat swConfirmHtml; private SwitchCompat swConfirmHtml;
private SwitchCompat swAskHtml;
private SwitchCompat swDisableTracking; private SwitchCompat swDisableTracking;
private SwitchCompat swHideTimeZone; private SwitchCompat swHideTimeZone;
private Button btnPin; private Button btnPin;
@ -92,7 +94,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{ private final static String[] RESET_OPTIONS = new String[]{
"confirm_links", "check_links_dbl", "browse_links", "confirm_links", "check_links_dbl", "browse_links",
"confirm_images", "html_always_images", "confirm_html", "confirm_images", "ask_images", "html_always_images", "confirm_html", "ask_html",
"disable_tracking", "hide_timezone", "disable_tracking", "hide_timezone",
"pin", "biometrics", "biometrics_timeout", "autolock", "pin", "biometrics", "biometrics_timeout", "autolock",
"client_id", "display_hidden", "incognito_keyboard", "secure", "client_id", "display_hidden", "incognito_keyboard", "secure",
@ -114,8 +116,10 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swCheckLinksDbl = view.findViewById(R.id.swCheckLinksDbl); swCheckLinksDbl = view.findViewById(R.id.swCheckLinksDbl);
swBrowseLinks = view.findViewById(R.id.swBrowseLinks); swBrowseLinks = view.findViewById(R.id.swBrowseLinks);
swConfirmImages = view.findViewById(R.id.swConfirmImages); swConfirmImages = view.findViewById(R.id.swConfirmImages);
swAskImages = view.findViewById(R.id.swAskImages);
swHtmlImages = view.findViewById(R.id.swHtmlImages); swHtmlImages = view.findViewById(R.id.swHtmlImages);
swConfirmHtml = view.findViewById(R.id.swConfirmHtml); swConfirmHtml = view.findViewById(R.id.swConfirmHtml);
swAskHtml = view.findViewById(R.id.swAskHtml);
swDisableTracking = view.findViewById(R.id.swDisableTracking); swDisableTracking = view.findViewById(R.id.swDisableTracking);
swHideTimeZone = view.findViewById(R.id.swHideTimeZone); swHideTimeZone = view.findViewById(R.id.swHideTimeZone);
btnPin = view.findViewById(R.id.btnPin); btnPin = view.findViewById(R.id.btnPin);
@ -174,6 +178,14 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm_images", checked).apply(); prefs.edit().putBoolean("confirm_images", checked).apply();
swAskImages.setEnabled(checked);
}
});
swAskImages.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("ask_images", checked).apply();
} }
}); });
@ -188,6 +200,14 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm_html", checked).apply(); prefs.edit().putBoolean("confirm_html", checked).apply();
swAskHtml.setEnabled(checked);
}
});
swAskHtml.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("ask_html", checked).apply();
} }
}); });
@ -431,8 +451,12 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swBrowseLinks.setChecked(prefs.getBoolean("browse_links", false)); swBrowseLinks.setChecked(prefs.getBoolean("browse_links", false));
swBrowseLinks.setEnabled(!swConfirmLinks.isChecked()); swBrowseLinks.setEnabled(!swConfirmLinks.isChecked());
swConfirmImages.setChecked(prefs.getBoolean("confirm_images", true)); swConfirmImages.setChecked(prefs.getBoolean("confirm_images", true));
swAskImages.setChecked(prefs.getBoolean("ask_images", true));
swAskImages.setEnabled(swConfirmImages.isChecked());
swHtmlImages.setChecked(prefs.getBoolean("html_always_images", false)); swHtmlImages.setChecked(prefs.getBoolean("html_always_images", false));
swConfirmHtml.setChecked(prefs.getBoolean("confirm_html", true)); swConfirmHtml.setChecked(prefs.getBoolean("confirm_html", true));
swAskHtml.setChecked(prefs.getBoolean("ask_html", true));
swAskHtml.setEnabled(swConfirmHtml.isChecked());
swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true)); swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true));
swHideTimeZone.setChecked(prefs.getBoolean("hide_timezone", true)); swHideTimeZone.setChecked(prefs.getBoolean("hide_timezone", true));

@ -137,6 +137,19 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swConfirmImages" /> app:layout_constraintTop_toBottomOf="@id/swConfirmImages" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAskImages"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_ask_images"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvConfirmImagesHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHtmlImages" android:id="@+id/swHtmlImages"
android:layout_width="0dp" android:layout_width="0dp"
@ -145,7 +158,7 @@
android:text="@string/title_ask_show_html_images" android:text="@string/title_ask_show_html_images"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvConfirmImagesHint" app:layout_constraintTop_toBottomOf="@+id/swAskImages"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
@ -173,6 +186,19 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swConfirmHtml" /> app:layout_constraintTop_toBottomOf="@id/swConfirmHtml" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAskHtml"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_ask_html"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvConfirmHtmlHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDisableTracking" android:id="@+id/swDisableTracking"
android:layout_width="0dp" android:layout_width="0dp"
@ -182,7 +208,7 @@
android:text="@string/title_advanced_tracking" android:text="@string/title_advanced_tracking"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvConfirmHtmlHint" app:layout_constraintTop_toBottomOf="@+id/swAskHtml"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat

@ -588,8 +588,10 @@
<string name="title_advanced_confirm_links">Confirm opening links</string> <string name="title_advanced_confirm_links">Confirm opening links</string>
<string name="title_advanced_check_links_dbl">Check domain block lists for suspicious links</string> <string name="title_advanced_check_links_dbl">Check domain block lists for suspicious links</string>
<string name="title_advanced_browse_links">Delegate opening links to Android</string> <string name="title_advanced_browse_links">Delegate opening links to Android</string>
<string name="title_advanced_confirm_images">Confirm showing images</string> <string name="title_advanced_confirm_images">Show no images by default</string>
<string name="title_advanced_ask_images">Confirm showing images</string>
<string name="title_advanced_confirm_html">Show reformatted messages by default</string> <string name="title_advanced_confirm_html">Show reformatted messages by default</string>
<string name="title_advanced_ask_html">Confirm showing original messages</string>
<string name="title_advanced_tracking">Attempt to recognize and disable tracking images</string> <string name="title_advanced_tracking">Attempt to recognize and disable tracking images</string>
<string name="title_advanced_hide_timezone">Send messages without timezone data</string> <string name="title_advanced_hide_timezone">Send messages without timezone data</string>
<string name="title_advanced_client_id">Send app name and version to email server</string> <string name="title_advanced_client_id">Send app name and version to email server</string>

Loading…
Cancel
Save