Added option to always show images

This commit is contained in:
M66B 2019-07-22 12:31:30 +02:00
parent b316486119
commit 45ddabc9f0
7 changed files with 59 additions and 19 deletions

4
FAQ.md
View File

@ -63,8 +63,8 @@ Fonts, sizes, colors, etc should be material design wherever possible.
Since FairEmail is meant to be privacy friendly, the following will not be added:
* Open links without confirmation
* Show images and original messages without confirmation, see also [this FAQ](#user-content-faq35)
* Opening links without confirmation
* Showing original messages without confirmation, see also [this FAQ](#user-content-faq35)
* Direct file/folder access: for security/privacy reasons (other) apps should use the [Storage Access Framework](https://developer.android.com/guide/topics/providers/document-provider), see also [this FAQ](#user-content-faq49)
Confirmation is just one tap, which is just a small price for better privacy.

View File

@ -180,7 +180,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean attachments_alt;
private boolean contrast;
private boolean monospaced;
private boolean autoimages;
private boolean contact_images;
private boolean all_images;
private boolean collapse_quotes;
private boolean authentication;
private static boolean debug;
@ -770,10 +771,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} else
bindContactInfo(info, message);
if (message.avatar != null) {
if (autoimages)
properties.setValue("images", message.id, true);
}
if (all_images || (contact_images && message.avatar != null))
properties.setValue("images", message.id, true);
if (viewType == ViewType.THREAD) {
if (expanded)
@ -2947,7 +2946,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.attachments_alt = prefs.getBoolean("attachments_alt", false);
this.contrast = prefs.getBoolean("contrast", false);
this.monospaced = prefs.getBoolean("monospaced", false);
this.autoimages = (this.contacts && prefs.getBoolean("autoimages", true));
this.contact_images = (this.contacts && prefs.getBoolean("contact_images", true));
this.all_images = prefs.getBoolean("all_images", false);
this.collapse_quotes = prefs.getBoolean("collapse_quotes", false);
this.authentication = prefs.getBoolean("authentication", true);

View File

@ -260,32 +260,37 @@ public class ApplicationEx extends Application {
static void upgrade(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
int version = prefs.getInt("version", BuildConfig.VERSION_CODE);
if (version < 468) {
Log.i("Upgrading from " + version + " to " + BuildConfig.VERSION_CODE);
SharedPreferences.Editor editor = prefs.edit();
editor.remove("notify_trash");
editor.remove("notify_archive");
editor.remove("notify_reply");
editor.remove("notify_flag");
editor.remove("notify_seen");
editor.putInt("version", BuildConfig.VERSION_CODE);
editor.apply();
} else if (version < 601) {
Log.i("Upgrading from " + version + " to " + BuildConfig.VERSION_CODE);
editor.putBoolean("contact_images", prefs.getBoolean("autoimages", true));
editor.remove("autoimages");
}
if (BuildConfig.DEBUG && false) {
SharedPreferences.Editor editor = prefs.edit();
editor.remove("app_support");
editor.remove("notify_archive");
editor.remove("message_swipe");
editor.remove("message_select");
editor.remove("folder_actions");
editor.remove("folder_sync");
editor.apply();
}
editor.putInt("version", BuildConfig.VERSION_CODE);
editor.apply();
}
static Context getLocalizedContext(Context context) {

View File

@ -39,7 +39,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"startup", "date", "threading", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic", "flags", "preview",
"addresses", "attachments_alt", "contrast", "monospaced", "autohtml", "autoimages", "actionbar",
"addresses", "attachments_alt", "contrast", "monospaced", "inline_images", "contact_images", "all_images", "collapse_quotes", "autocontent", "actionbar",
"autoscroll", "swipenav", "autoexpand", "autoclose", "autonext",
"subscriptions", "debug",
"biometrics"

View File

@ -61,6 +61,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swMonospaced;
private SwitchCompat swImagesInline;
private SwitchCompat swImagesContacts;
private SwitchCompat swImagesAll;
private SwitchCompat swCollapseQuotes;
private SwitchCompat swRemoteContent;
private SwitchCompat swActionbar;
@ -68,7 +69,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "date", "threading", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic",
"flags", "preview", "addresses", "attachments_alt",
"contrast", "monospaced", "inline_images", "autoimages", "collapse_quotes", "autocontent", "actionbar",
"contrast", "monospaced", "inline_images", "contact_images", "all_images", "collapse_quotes", "autocontent", "actionbar",
};
@Override
@ -99,6 +100,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swMonospaced = view.findViewById(R.id.swMonospaced);
swImagesInline = view.findViewById(R.id.swImagesInline);
swImagesContacts = view.findViewById(R.id.swImagesContacts);
swImagesAll = view.findViewById(R.id.swImagesAll);
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
swRemoteContent = view.findViewById(R.id.swRemoteContent);
swActionbar = view.findViewById(R.id.swActionbar);
@ -242,7 +244,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swImagesContacts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autoimages", checked).apply();
prefs.edit().putBoolean("contact_images", checked).apply();
}
});
swImagesAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("all_images", checked).apply();
}
});
@ -338,7 +347,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swContrast.setChecked(prefs.getBoolean("contrast", false));
swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
swImagesContacts.setChecked(prefs.getBoolean("autoimages", true));
swImagesContacts.setChecked(prefs.getBoolean("contact_images", true));
swImagesAll.setChecked(prefs.getBoolean("all_images", false));
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
swRemoteContent.setChecked(prefs.getBoolean("autocontent", false));
swActionbar.setChecked(prefs.getBoolean("actionbar", true));

View File

@ -306,6 +306,30 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesContactsHint" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swImagesAll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_images_all"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesPermissionHint"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvImagesAllHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_ask_show_image"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?colorWarning"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swImagesAll" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCollapseQuotes"
android:layout_width="0dp"
@ -314,7 +338,7 @@
android:text="@string/title_advanced_collapse_quotes"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesPermissionHint"
app:layout_constraintTop_toBottomOf="@id/tvImagesAllHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -222,6 +222,7 @@
<string name="title_advanced_monospaced">Use monospaced font for message text</string>
<string name="title_advanced_images_inline">Automatically show inline images</string>
<string name="title_advanced_images">Automatically show images for known contacts</string>
<string name="title_advanced_images_all">Automatically show all images</string>
<string name="title_advanced_collapse_quotes">Collapse quoted text</string>
<string name="title_advanced_remote_content">Automatically show remote content when viewing original messages</string>
<string name="title_advanced_actionbar">Conversation action bar</string>