Added option for automatically resizing of images

pull/147/head
M66B 6 years ago
parent 78e2b232d6
commit 9a8b9bb8f2

@ -985,9 +985,11 @@ If your provider requires an unsupported authentication method, you'll likely ge
<a name="faq63"></a>
**(63) How are images resized for displaying on screens?**
After adding an inline image or an image attachment you might be asked if you want to reduce the image size for displaying on a screens.
If you answer "yes", the image will be resized to a maximum width and height of about 1920 pixels and saved with a compression ratio of 90 out of 100.
Large inline or attached images will automatically be resized for displaying on screens.
This is because email messages are limited in size, depending on the provider mostly between 10 and 50 MB.
Image will be resized to a maximum width and height of about 1280 pixels and saved with a compression ratio of 90 out of 100.
Images are scaled down using whole number factors to reduce memory usage and to retain image quality.
There is an advanced option to disable automatically resizing of image attachments.
<br />

@ -1312,7 +1312,10 @@ public class FragmentCompose extends FragmentEx {
}
}
if (image &&
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean autoresize = prefs.getBoolean("autoresize", true);
if ((image || autoresize) &&
("image/jpeg".equals(attachment.type) || "image/png".equals(attachment.type))) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;

@ -76,6 +76,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
private SwitchCompat swAutoMove;
private SwitchCompat swConfirm;
private SwitchCompat swSender;
private SwitchCompat swAutoResize;
private SwitchCompat swAutoSend;
private SwitchCompat swLight;
@ -118,6 +119,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
swAutoMove = view.findViewById(R.id.swAutoMove);
swConfirm = view.findViewById(R.id.swConfirm);
swSender = view.findViewById(R.id.swSender);
swAutoResize = view.findViewById(R.id.swAutoResize);
swAutoSend = view.findViewById(R.id.swAutoSend);
swLight = view.findViewById(R.id.swLight);
@ -348,6 +350,14 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
}
});
swAutoResize.setChecked(prefs.getBoolean("autoresize", true));
swAutoResize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autoresize", checked).apply();
}
});
swAutoSend.setChecked(!prefs.getBoolean("autosend", false));
swAutoSend.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override

@ -444,6 +444,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSender" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoResize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_autoresize"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSenderHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoSend"
android:layout_width="match_parent"
@ -453,7 +465,7 @@
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_autosend"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSenderHint"
app:layout_constraintTop_toBottomOf="@id/swAutoResize"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -143,6 +143,7 @@
<string name="title_advanced_automove">Confirm moving messages</string>
<string name="title_advanced_confirm">Confirm actions that might leak privacy sensitive information</string>
<string name="title_advanced_sender">Allow editing sender address</string>
<string name="title_advanced_autoresize">Automatically resize images for displaying on screens</string>
<string name="title_advanced_autosend">Confirm sending messages</string>
<string name="title_advanced_updates">Check for updates</string>
@ -319,7 +320,6 @@
<string name="title_send">Send</string>
<string name="title_view">View</string>
<string name="title_send_after">Send after &#8230;</string>
<string name="title_ask_resize">Reduce size of %1$s for displaying on screens?</string>
<string name="title_no_selection">Nothing selected</string>
<string name="title_style_bold">Bold</string>

Loading…
Cancel
Save