Added chooser w/o task

pull/209/head
M66B 2 years ago
parent 969d48dab3
commit 62b7d4cc75

@ -587,7 +587,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
}
}
Drawable android = context.getDrawable(R.drawable.twotone_android_24);
Drawable android = context.getDrawable(R.drawable.android_robot);
android.setBounds(0, 0, dp24, dp24);
pkgs.add(new Package(
android,
@ -595,6 +595,12 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
"chooser",
false,
true));
pkgs.add(new Package(
android,
context.getString(R.string.title_select_app),
"chooser",
true,
true));
return pkgs;
}

@ -915,33 +915,44 @@ public class Helper {
open_with_tabs = false;
}
if (open_with_pkg != null && !isInstalled(context, open_with_pkg)) {
open_with_pkg = null;
open_with_tabs = false;
if (!"chooser".equals(open_with_pkg)) {
if (open_with_pkg != null && !isInstalled(context, open_with_pkg)) {
open_with_pkg = null;
open_with_tabs = false;
}
if (open_with_tabs && !hasCustomTabs(context, uri, open_with_pkg))
open_with_tabs = false;
}
if (open_with_tabs && !hasCustomTabs(context, uri, open_with_pkg))
open_with_tabs = false;
Intent view = new Intent(Intent.ACTION_VIEW);
if (mimeType == null)
view.setData(uri);
else
view.setDataAndType(uri, mimeType);
if (task)
view.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if ("chooser".equals(open_with_pkg)) {
Intent view = new Intent(Intent.ACTION_VIEW, uri);
Intent chooser = Intent.createChooser(view, context.getString(R.string.title_select_app));
try {
EntityLog.log(context, "Launching chooser uri=" + uri);
context.startActivity(chooser);
if (open_with_tabs) {
EntityLog.log(context, "Launching direct uri=" + uri +
" intent=" + view +
" extras=" + TextUtils.join(", ", Log.getExtras(view.getExtras())));
context.startActivity(view);
} else {
EntityLog.log(context, "Launching chooser uri=" + uri +
" intent=" + view +
" extras=" + TextUtils.join(", ", Log.getExtras(view.getExtras())));
Intent chooser = Intent.createChooser(view, context.getString(R.string.title_select_app));
context.startActivity(chooser);
}
} catch (ActivityNotFoundException ex) {
Log.w(ex);
reportNoViewer(context, uri, ex);
}
} else if (browse || !open_with_tabs) {
try {
Intent view = new Intent(Intent.ACTION_VIEW);
if (mimeType == null)
view.setData(uri);
else
view.setDataAndType(uri, mimeType);
if (task)
view.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
view.setPackage(open_with_pkg);
EntityLog.log(context, "Launching view uri=" + uri +
" intent=" + view +

@ -11,7 +11,7 @@
android:layout_height="wrap_content"
android:drawableStart="@drawable/twotone_language_24"
android:drawableEnd="@drawable/twotone_open_in_new_24"
android:drawablePadding="6dp"
android:drawablePadding="12dp"
android:minHeight="24dp"
android:text="Package"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="1274.4dp"
android:height="1274.4dp"
android:viewportWidth="1274.4"
android:viewportHeight="1274.4">
<group android:translateY="278.2">
<path
android:fillColor="#3ddc84"
android:pathData="M930.8,536.4a53.1,53.1 0,1 1,53.1 -53.1,53.1 53.1,0 0,1 -53.1,53.1m-586.5,0a53.1,53.1 0,1 1,53.1 -53.1,53.1 53.1,0 0,1 -53.1,53.1M949.8,216.8 L1055.8,33.1A22.1,22.1 0,1 0,1017.6 11L910.3,197c-82.1,-37.5 -174.4,-58.3 -272.8,-58.3S446.9,159.6 364.7,197L257.4,11a22.1,22.1 0,1 0,-38.2 22.1L325.2,216.8C143.1,315.8 18.5,500.2 0.3,718H1274.7c-18.2,-217.8 -142.8,-402.2 -324.9,-501.2" />
</group>
</vector>
Loading…
Cancel
Save