diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java
index 9564307071..b0dca3dbe8 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java
@@ -248,6 +248,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swThreadByRef;
private SwitchCompat swMdn;
private SwitchCompat swAppChooser;
+ private SwitchCompat swAdjacent;
private SwitchCompat swDeleteConfirmation;
private SwitchCompat swDmarcViewer;
private EditText etKeywords;
@@ -313,7 +314,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"exact_alarms",
"native_dkim", "native_arc", "native_arc_whitelist",
"webp", "easy_correct", "infra", "tld_flags", "dup_msgids", "thread_byref", "mdn",
- "app_chooser", "delete_confirmation", "global_keywords", "test_iab"
+ "app_chooser", "adjacent", "delete_confirmation", "global_keywords", "test_iab"
};
private final static String[] RESET_QUESTIONS = new String[]{
@@ -510,6 +511,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swThreadByRef = view.findViewById(R.id.swThreadByRef);
swMdn = view.findViewById(R.id.swMdn);
swAppChooser = view.findViewById(R.id.swAppChooser);
+ swAdjacent = view.findViewById(R.id.swAdjacent);
swDeleteConfirmation = view.findViewById(R.id.swDeleteConfirmation);
swDmarcViewer = view.findViewById(R.id.swDmarcViewer);
etKeywords = view.findViewById(R.id.etKeywords);
@@ -1942,6 +1944,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
+ swAdjacent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("adjacent", checked).apply();
+ }
+ });
+
swDeleteConfirmation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -2724,6 +2733,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swThreadByRef.setChecked(prefs.getBoolean("thread_byref", true));
swMdn.setChecked(prefs.getBoolean("mdn", swExperiments.isChecked()));
swAppChooser.setChecked(prefs.getBoolean("app_chooser", false));
+ swAdjacent.setChecked(prefs.getBoolean("adjacent", false));
swDeleteConfirmation.setChecked(prefs.getBoolean("delete_confirmation", true));
swDmarcViewer.setChecked(Helper.isComponentEnabled(getContext(), ActivityDmarc.class));
etKeywords.setText(prefs.getString("global_keywords", null));
diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java
index 6de910ef0a..9fa9c95d99 100644
--- a/app/src/main/java/eu/faircode/email/Helper.java
+++ b/app/src/main/java/eu/faircode/email/Helper.java
@@ -1008,6 +1008,14 @@ public class Helper {
intent.setDataAndTypeAndNormalize(uri, type);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ // https://developer.android.com/guide/topics/large-screens/multi-window-support#launch_adjacent
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ boolean adjacent = prefs.getBoolean("adjacent", false);
+ if (adjacent &&
+ context instanceof ActivityView &&
+ !((ActivityView) context).isSplit())
+ intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
+
if (!TextUtils.isEmpty(name))
intent.putExtra(Intent.EXTRA_TITLE, Helper.sanitizeFilename(name));
Log.i("Intent=" + intent + " type=" + type);
@@ -1119,6 +1127,13 @@ public class Helper {
if (task)
view.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ // https://developer.android.com/guide/topics/large-screens/multi-window-support#launch_adjacent
+ boolean adjacent = prefs.getBoolean("adjacent", false);
+ if (adjacent &&
+ context instanceof ActivityView &&
+ !((ActivityView) context).isSplit())
+ view.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
+
if ("chooser".equals(open_with_pkg) && !open_with_tabs) {
try {
EntityLog.log(context, "Launching chooser uri=" + uri +
diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml
index e8648da249..a7b0362aba 100644
--- a/app/src/main/res/layout/fragment_options_misc.xml
+++ b/app/src/main/res/layout/fragment_options_misc.xml
@@ -2380,6 +2380,18 @@
app:layout_constraintTop_toBottomOf="@id/swMdn"
app:switchPadding="12dp" />
+
+
Thread by common reference
Process MDNs
Use Android app chooser
+ Open side-by-side
Permanent deletion confirmation
If you turn this off, please do not complain if you accidentally delete messages irreversibly
DMARC viewer