Added debug option to view files in a separate task

pull/215/head
M66B 6 months ago
parent f0b4472f03
commit d3de1ae38f

@ -233,6 +233,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swMdn;
private SwitchCompat swAppChooser;
private SwitchCompat swAppChooserShare;
private SwitchCompat swShareTask;
private SwitchCompat swAdjacentLinks;
private SwitchCompat swAdjacentDocuments;
private SwitchCompat swAdjacentPortrait;
@ -301,7 +302,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"native_dkim", "native_arc", "native_arc_whitelist", "strict_alignment",
"webp", "animate_images",
"easy_correct", "paste_plain", "infra", "tld_flags", "json_ld", "dup_msgids", "thread_byref", "save_user_flags", "mdn",
"app_chooser", "app_chooser_share", "adjacent_links", "adjacent_documents", "adjacent_portrait", "adjacent_landscape",
"app_chooser", "app_chooser_share", "share_task",
"adjacent_links", "adjacent_documents", "adjacent_portrait", "adjacent_landscape",
"delete_confirmation", "delete_notification", "global_keywords", "test_iab"
));
@ -486,6 +488,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swMdn = view.findViewById(R.id.swMdn);
swAppChooser = view.findViewById(R.id.swAppChooser);
swAppChooserShare = view.findViewById(R.id.swAppChooserShare);
swShareTask = view.findViewById(R.id.swShareTask);
swAdjacentLinks = view.findViewById(R.id.swAdjacentLinks);
swAdjacentDocuments = view.findViewById(R.id.swAdjacentDocuments);
swAdjacentPortrait = view.findViewById(R.id.swAdjacentPortrait);
@ -1676,6 +1679,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swShareTask.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("share_task", checked).apply();
}
});
swAdjacentLinks.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -2467,6 +2477,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swMdn.setChecked(prefs.getBoolean("mdn", swExperiments.isChecked()));
swAppChooser.setChecked(prefs.getBoolean("app_chooser", false));
swAppChooserShare.setChecked(prefs.getBoolean("app_chooser_share", false));
swShareTask.setChecked(prefs.getBoolean("share_task", false));
swAdjacentLinks.setChecked(prefs.getBoolean("adjacent_links", false));
swAdjacentDocuments.setChecked(prefs.getBoolean("adjacent_documents", true));
swAdjacentPortrait.setChecked(prefs.getBoolean("adjacent_portrait", false));

@ -1015,6 +1015,11 @@ public class Helper {
intent.setDataAndTypeAndNormalize(uri, type);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean share_task = prefs.getBoolean("share_task", false);
if (share_task)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (launchAdjacent(context, true))
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);

@ -1995,6 +1995,17 @@
app:layout_constraintTop_toBottomOf="@id/swAppChooser"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swShareTask"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_share_task"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAppChooserShare"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvSideBySide"
android:layout_width="0dp"
@ -2005,7 +2016,7 @@
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAppChooserShare" />
app:layout_constraintTop_toBottomOf="@id/swShareTask" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAdjacentLinks"

@ -985,6 +985,7 @@
<string name="title_advanced_mdn" translatable="false">Process MDNs</string>
<string name="title_advanced_app_chooser" translatable="false">Use Android app chooser for links</string>
<string name="title_advanced_app_chooser_share" translatable="false">Use Android app chooser for files</string>
<string name="title_advanced_share_task" translatable="false">View files in a separate task</string>
<string name="title_advanced_adjacent" translatable="false">Open side-by-side</string>
<string name="title_advanced_adjacent_links" translatable="false">Links</string>
<string name="title_advanced_adjacent_documents" translatable="false">Documents</string>

Loading…
Cancel
Save