mirror of https://github.com/M66B/FairEmail.git
Added app chooser for files option
This commit is contained in:
parent
c2a0f205df
commit
81c1481dd5
|
@ -252,6 +252,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private SwitchCompat swThreadByRef;
|
||||
private SwitchCompat swMdn;
|
||||
private SwitchCompat swAppChooser;
|
||||
private SwitchCompat swAppChooserShare;
|
||||
private SwitchCompat swAdjacentLinks;
|
||||
private SwitchCompat swAdjacentDocuments;
|
||||
private SwitchCompat swAdjacentPortrait;
|
||||
|
@ -321,7 +322,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", "adjacent_links", "adjacent_documents", "adjacent_portrait", "adjacent_landscape",
|
||||
"app_chooser", "app_chooser_share", "adjacent_links", "adjacent_documents", "adjacent_portrait", "adjacent_landscape",
|
||||
"delete_confirmation", "global_keywords", "test_iab"
|
||||
};
|
||||
|
||||
|
@ -523,6 +524,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);
|
||||
swAppChooserShare = view.findViewById(R.id.swAppChooserShare);
|
||||
swAdjacentLinks = view.findViewById(R.id.swAdjacentLinks);
|
||||
swAdjacentDocuments = view.findViewById(R.id.swAdjacentDocuments);
|
||||
swAdjacentPortrait = view.findViewById(R.id.swAdjacentPortrait);
|
||||
|
@ -1988,6 +1990,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
swAppChooserShare.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("app_chooser_share", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swAdjacentLinks.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -2800,6 +2809,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));
|
||||
swAppChooserShare.setChecked(prefs.getBoolean("app_chooser_share", false));
|
||||
swAdjacentLinks.setChecked(prefs.getBoolean("adjacent_links", false));
|
||||
swAdjacentDocuments.setChecked(prefs.getBoolean("adjacent_documents", true));
|
||||
swAdjacentPortrait.setChecked(prefs.getBoolean("adjacent_portrait", false));
|
||||
|
|
|
@ -975,9 +975,14 @@ public class Helper {
|
|||
}
|
||||
|
||||
static Intent getChooser(Context context, Intent intent) {
|
||||
return getChooser(context, intent, false);
|
||||
}
|
||||
|
||||
static Intent getChooser(Context context, Intent intent, boolean share) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean app_chooser = prefs.getBoolean("app_chooser", false);
|
||||
if (!app_chooser)
|
||||
boolean app_chooser_share = prefs.getBoolean("app_chooser_share", false);
|
||||
if (share ? !app_chooser_share : !app_chooser)
|
||||
return intent;
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||
|
@ -1047,9 +1052,9 @@ public class Helper {
|
|||
else
|
||||
reportNoViewer(context, intent, null);
|
||||
else
|
||||
context.startActivity(intent);
|
||||
context.startActivity(getChooser(context, intent, true));
|
||||
} else
|
||||
context.startActivity(intent);
|
||||
context.startActivity(getChooser(context, intent, true));
|
||||
}
|
||||
|
||||
static boolean isTnef(String type, String name) {
|
||||
|
|
|
@ -2421,13 +2421,23 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_app_chooser"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swMdn"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAppChooserShare"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_app_chooser_share"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAppChooser"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSideBySide"
|
||||
android:layout_width="0dp"
|
||||
|
@ -2438,7 +2448,7 @@
|
|||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAppChooser" />
|
||||
app:layout_constraintTop_toBottomOf="@id/swAppChooserShare" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAdjacentLinks"
|
||||
|
|
|
@ -924,7 +924,8 @@
|
|||
<string name="title_advanced_dup_msgid" translatable="false">Duplicates by message ID</string>
|
||||
<string name="title_advanced_thread_by_ref" translatable="false">Thread by common reference</string>
|
||||
<string name="title_advanced_mdn" translatable="false">Process MDNs</string>
|
||||
<string name="title_advanced_app_chooser" translatable="false">Use Android app chooser</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_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…
Reference in New Issue