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

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));