Added option to always show images

pull/159/head
M66B 6 years ago
parent b316486119
commit 45ddabc9f0

@ -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: Since FairEmail is meant to be privacy friendly, the following will not be added:
* Open links without confirmation * Opening links without confirmation
* Show images and original messages without confirmation, see also [this FAQ](#user-content-faq35) * 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) * 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. Confirmation is just one tap, which is just a small price for better privacy.

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

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

@ -39,7 +39,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{ static String[] OPTIONS_RESTART = new String[]{
"startup", "date", "threading", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic", "flags", "preview", "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", "autoscroll", "swipenav", "autoexpand", "autoclose", "autonext",
"subscriptions", "debug", "subscriptions", "debug",
"biometrics" "biometrics"

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

@ -306,6 +306,30 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesContactsHint" /> 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 <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCollapseQuotes" android:id="@+id/swCollapseQuotes"
android:layout_width="0dp" android:layout_width="0dp"
@ -314,7 +338,7 @@
android:text="@string/title_advanced_collapse_quotes" android:text="@string/title_advanced_collapse_quotes"
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/tvImagesPermissionHint" app:layout_constraintTop_toBottomOf="@id/tvImagesAllHint"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat

@ -222,6 +222,7 @@
<string name="title_advanced_monospaced">Use monospaced font for message text</string> <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_inline">Automatically show inline images</string>
<string name="title_advanced_images">Automatically show images for known contacts</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_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_remote_content">Automatically show remote content when viewing original messages</string>
<string name="title_advanced_actionbar">Conversation action bar</string> <string name="title_advanced_actionbar">Conversation action bar</string>

Loading…
Cancel
Save