mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-26 11:12:15 -05:00
Bugfix: OI really not required anymore for open dialog
This commit is contained in:
parent
fd60316448
commit
7e0a4c9d20
@ -44,12 +44,16 @@ namespace keepass2android
|
|||||||
* @return True if an Intent with the specified action can be sent and
|
* @return True if an Intent with the specified action can be sent and
|
||||||
* responded to, false otherwise.
|
* responded to, false otherwise.
|
||||||
*/
|
*/
|
||||||
public static bool isIntentAvailable(Context context, String action) {
|
public static bool isIntentAvailable(Context context, String action, String type) {
|
||||||
PackageManager packageManager = context.PackageManager;
|
PackageManager packageManager = context.PackageManager;
|
||||||
Intent intent = new Intent(action);
|
Intent intent = new Intent(action);
|
||||||
|
if (type != null)
|
||||||
|
intent.SetType(type);
|
||||||
IList<ResolveInfo> list =
|
IList<ResolveInfo> list =
|
||||||
packageManager.QueryIntentActivities(intent,
|
packageManager.QueryIntentActivities(intent,
|
||||||
PackageInfoFlags.MatchDefaultOnly);
|
PackageInfoFlags.MatchDefaultOnly);
|
||||||
|
foreach (ResolveInfo i in list)
|
||||||
|
Android.Util.Log.Debug("DEBUG", i.ActivityInfo.ApplicationInfo.PackageName);
|
||||||
return list.Count > 0;
|
return list.Count > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,14 +90,14 @@ namespace keepass2android
|
|||||||
|
|
||||||
public static void showBrowseDialog(string filename, Activity act, int requestCodeBrowse, bool forSaving)
|
public static void showBrowseDialog(string filename, Activity act, int requestCodeBrowse, bool forSaving)
|
||||||
{
|
{
|
||||||
if ((!forSaving) && (Interaction.isIntentAvailable(act, Intent.ActionGetContent))) {
|
if ((!forSaving) && (Interaction.isIntentAvailable(act, Intent.ActionGetContent, "file/*"))) {
|
||||||
Intent i = new Intent(Intent.ActionGetContent);
|
Intent i = new Intent(Intent.ActionGetContent);
|
||||||
i.SetType("file/*");
|
i.SetType("file/*");
|
||||||
|
|
||||||
act.StartActivityForResult(i, requestCodeBrowse);
|
act.StartActivityForResult(i, requestCodeBrowse);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Interaction.isIntentAvailable(act, Intents.FILE_BROWSE))
|
if (Interaction.isIntentAvailable(act, Intents.FILE_BROWSE, null))
|
||||||
{
|
{
|
||||||
Intent i = new Intent(Intents.FILE_BROWSE);
|
Intent i = new Intent(Intents.FILE_BROWSE);
|
||||||
if (filename != null)
|
if (filename != null)
|
||||||
|
Loading…
Reference in New Issue
Block a user