mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 19:34:15 +01:00
Added chooser w/o task
This commit is contained in:
@@ -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);
|
android.setBounds(0, 0, dp24, dp24);
|
||||||
pkgs.add(new Package(
|
pkgs.add(new Package(
|
||||||
android,
|
android,
|
||||||
@@ -595,6 +595,12 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||||||
"chooser",
|
"chooser",
|
||||||
false,
|
false,
|
||||||
true));
|
true));
|
||||||
|
pkgs.add(new Package(
|
||||||
|
android,
|
||||||
|
context.getString(R.string.title_select_app),
|
||||||
|
"chooser",
|
||||||
|
true,
|
||||||
|
true));
|
||||||
|
|
||||||
return pkgs;
|
return pkgs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -915,33 +915,44 @@ public class Helper {
|
|||||||
open_with_tabs = false;
|
open_with_tabs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open_with_pkg != null && !isInstalled(context, open_with_pkg)) {
|
if (!"chooser".equals(open_with_pkg)) {
|
||||||
open_with_pkg = null;
|
if (open_with_pkg != null && !isInstalled(context, open_with_pkg)) {
|
||||||
open_with_tabs = false;
|
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))
|
Intent view = new Intent(Intent.ACTION_VIEW);
|
||||||
open_with_tabs = false;
|
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)) {
|
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 {
|
try {
|
||||||
EntityLog.log(context, "Launching chooser uri=" + uri);
|
if (open_with_tabs) {
|
||||||
context.startActivity(chooser);
|
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) {
|
} catch (ActivityNotFoundException ex) {
|
||||||
Log.w(ex);
|
Log.w(ex);
|
||||||
reportNoViewer(context, uri, ex);
|
reportNoViewer(context, uri, ex);
|
||||||
}
|
}
|
||||||
} else if (browse || !open_with_tabs) {
|
} else if (browse || !open_with_tabs) {
|
||||||
try {
|
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);
|
view.setPackage(open_with_pkg);
|
||||||
EntityLog.log(context, "Launching view uri=" + uri +
|
EntityLog.log(context, "Launching view uri=" + uri +
|
||||||
" intent=" + view +
|
" intent=" + view +
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawableStart="@drawable/twotone_language_24"
|
android:drawableStart="@drawable/twotone_language_24"
|
||||||
android:drawableEnd="@drawable/twotone_open_in_new_24"
|
android:drawableEnd="@drawable/twotone_open_in_new_24"
|
||||||
android:drawablePadding="6dp"
|
android:drawablePadding="12dp"
|
||||||
android:minHeight="24dp"
|
android:minHeight="24dp"
|
||||||
android:text="Package"
|
android:text="Package"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||||
|
|||||||
11
app/src/main/resExtra/drawable/android_robot.xml
Normal file
11
app/src/main/resExtra/drawable/android_robot.xml
Normal file
@@ -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>
|
||||||
Reference in New Issue
Block a user