From d3761184fe142f00ff4d03463938f2603447c1a4 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 7 Apr 2019 07:58:34 +0200 Subject: [PATCH] Set default maximum attachment download size to 64 KB --- app/src/main/java/eu/faircode/email/Core.java | 2 +- app/src/main/java/eu/faircode/email/FragmentMessages.java | 2 +- app/src/main/java/eu/faircode/email/FragmentOptions.java | 2 +- app/src/main/java/eu/faircode/email/MessageHelper.java | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 46860d54cf..184ea8ca5c 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -1406,7 +1406,7 @@ class Core { return; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - long maxSize = prefs.getInt("download", 32768); + long maxSize = prefs.getInt("download", MessageHelper.DEFAULT_ATTACHMENT_DOWNLOAD_SIZE); if (maxSize == 0) maxSize = Long.MAX_VALUE; diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 23f31df7ea..8ef3ea0377 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -2247,7 +2247,7 @@ public class FragmentMessages extends FragmentBase { autoExpanded = false; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); - long download = prefs.getInt("download", 32768); + long download = prefs.getInt("download", MessageHelper.DEFAULT_ATTACHMENT_DOWNLOAD_SIZE); if (download == 0) download = Long.MAX_VALUE; diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java index 176a6c9913..10e5a7f211 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptions.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java @@ -605,7 +605,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O swMetered.setChecked(prefs.getBoolean("metered", true)); - int download = prefs.getInt("download", 32768); + int download = prefs.getInt("download", MessageHelper.DEFAULT_ATTACHMENT_DOWNLOAD_SIZE); int[] downloadValues = getResources().getIntArray(R.array.downloadValues); for (int pos = 0; pos < downloadValues.length; pos++) if (downloadValues[pos] == download) { diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 0fb36de572..cccd5326e5 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -71,6 +71,7 @@ public class MessageHelper { private final static int POOL_TIMEOUT = 45 * 1000; // milliseconds, default 45 sec static final int ATTACHMENT_BUFFER_SIZE = 8192; // bytes + static final int DEFAULT_ATTACHMENT_DOWNLOAD_SIZE = 65536; // bytes static void setSystemProperties() { System.setProperty("mail.mime.decodetext.strict", "false");