diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java index ba3553ba4e..d257ec3f43 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java @@ -27,10 +27,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.AdapterView; import android.widget.CompoundButton; -import android.widget.Spinner; -import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -47,13 +44,10 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe private SwitchCompat swCollapse; private SwitchCompat swAutoRead; private SwitchCompat swAutoMove; - private SwitchCompat swAutoResize; - private Spinner spAutoResize; - private TextView tvAutoResize; private final static String[] RESET_OPTIONS = new String[]{ "pull", "autoscroll", "swipenav", "autoexpand", "autoclose", "autonext", - "collapse", "autoread", "automove", "autoresize", "resize" + "collapse", "autoread", "automove" }; @Override @@ -75,9 +69,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe swCollapse = view.findViewById(R.id.swCollapse); swAutoRead = view.findViewById(R.id.swAutoRead); swAutoMove = view.findViewById(R.id.swAutoMove); - swAutoResize = view.findViewById(R.id.swAutoResize); - spAutoResize = view.findViewById(R.id.spAutoResize); - tvAutoResize = view.findViewById(R.id.tvAutoResize); setOptions(); @@ -149,28 +140,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe } }); - swAutoResize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("autoresize", checked).apply(); - spAutoResize.setEnabled(checked); - } - }); - - spAutoResize.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView adapterView, View view, int position, long id) { - int[] values = getResources().getIntArray(R.array.resizeValues); - prefs.edit().putInt("resize", values[position]).apply(); - tvAutoResize.setText(getString(R.string.title_advanced_resize_pixels, values[position])); - } - - @Override - public void onNothingSelected(AdapterView parent) { - prefs.edit().remove("resize").apply(); - } - }); - PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this); return view; @@ -225,16 +194,5 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe swCollapse.setChecked(prefs.getBoolean("collapse", false)); swAutoRead.setChecked(prefs.getBoolean("autoread", false)); swAutoMove.setChecked(!prefs.getBoolean("automove", false)); - swAutoResize.setChecked(prefs.getBoolean("autoresize", true)); - - int resize = prefs.getInt("resize", FragmentCompose.REDUCED_IMAGE_SIZE); - int[] resizeValues = getResources().getIntArray(R.array.resizeValues); - for (int pos = 0; pos < resizeValues.length; pos++) - if (resizeValues[pos] == resize) { - spAutoResize.setSelection(pos); - tvAutoResize.setText(getString(R.string.title_advanced_resize_pixels, resizeValues[pos])); - break; - } - spAutoResize.setEnabled(swAutoResize.isChecked()); } } diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java index 9b64ea4bd5..a4b6439fe8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java @@ -30,6 +30,7 @@ import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.CompoundButton; import android.widget.Spinner; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -38,11 +39,14 @@ import androidx.preference.PreferenceManager; public class FragmentOptionsSend extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener { private SwitchCompat swPrefixOnce; + private SwitchCompat swAutoResize; + private Spinner spAutoResize; + private TextView tvAutoResize; private SwitchCompat swAutoSend; private Spinner spSendDelayed; private final static String[] RESET_OPTIONS = new String[]{ - "prefix_once", "autosend", "send_delayed" + "prefix_once", "autoresize", "resize", "autosend", "send_delayed" }; @Override @@ -56,6 +60,9 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc // Get controls swPrefixOnce = view.findViewById(R.id.swPrefixOnce); + swAutoResize = view.findViewById(R.id.swAutoResize); + spAutoResize = view.findViewById(R.id.spAutoResize); + tvAutoResize = view.findViewById(R.id.tvAutoResize); swAutoSend = view.findViewById(R.id.swAutoSend); spSendDelayed = view.findViewById(R.id.spSendDelayed); @@ -72,6 +79,28 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc } }); + swAutoResize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("autoresize", checked).apply(); + spAutoResize.setEnabled(checked); + } + }); + + spAutoResize.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int position, long id) { + int[] values = getResources().getIntArray(R.array.resizeValues); + prefs.edit().putInt("resize", values[position]).apply(); + tvAutoResize.setText(getString(R.string.title_advanced_resize_pixels, values[position])); + } + + @Override + public void onNothingSelected(AdapterView parent) { + prefs.edit().remove("resize").apply(); + } + }); + swAutoSend.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -137,6 +166,19 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", false)); + + swAutoResize.setChecked(prefs.getBoolean("autoresize", true)); + + int resize = prefs.getInt("resize", FragmentCompose.REDUCED_IMAGE_SIZE); + int[] resizeValues = getResources().getIntArray(R.array.resizeValues); + for (int pos = 0; pos < resizeValues.length; pos++) + if (resizeValues[pos] == resize) { + spAutoResize.setSelection(pos); + tvAutoResize.setText(getString(R.string.title_advanced_resize_pixels, resizeValues[pos])); + break; + } + spAutoResize.setEnabled(swAutoResize.isChecked()); + swAutoSend.setChecked(!prefs.getBoolean("autosend", false)); int send_delayed = prefs.getInt("send_delayed", 0); diff --git a/app/src/main/res/layout/fragment_options_behavior.xml b/app/src/main/res/layout/fragment_options_behavior.xml index cae67f4c70..1205fbf2b3 100644 --- a/app/src/main/res/layout/fragment_options_behavior.xml +++ b/app/src/main/res/layout/fragment_options_behavior.xml @@ -144,34 +144,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swAutoRead" app:switchPadding="12dp" /> - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_options_send.xml b/app/src/main/res/layout/fragment_options_send.xml index fed2c15f88..02f49f360d 100644 --- a/app/src/main/res/layout/fragment_options_send.xml +++ b/app/src/main/res/layout/fragment_options_send.xml @@ -28,6 +28,34 @@ app:layout_constraintTop_toTopOf="parent" app:switchPadding="12dp" /> + + + + + + All unread messages All starred messages + Prefix subject only once on replying or forwarding + Automatically resize attached and embedded images + < %1$d pixels + Confirm sending messages + Delay sending messages + Use metered connections Automatically download messages and attachments on a metered connection up to Download messages and attachments while roaming @@ -197,13 +203,6 @@ Automatically go to next conversation on close conversation Automatically mark messages read on moving messages Confirm moving messages - Automatically resize attached and embedded images - < %1$d pixels - Allow editing sender address - - Prefix subject only once on replying or forwarding - Confirm sending messages - Delay sending messages Group new message notifications Show message preview in notifications @@ -253,6 +252,7 @@ Select … Your name Your email address + Allow editing sender address Reply to address Encrypt by default In case of \'invalid greeting\', \'requires valid address\' or a similar error, try to change this setting