Bugfix: OI really not required anymore for open dialog

This commit is contained in:
PhilippC 2013-05-11 22:11:11 +02:00
parent fd60316448
commit 7e0a4c9d20
2 changed files with 7 additions and 3 deletions

View File

@ -44,12 +44,16 @@ namespace keepass2android
* @return True if an Intent with the specified action can be sent and
* 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;
Intent intent = new Intent(action);
if (type != null)
intent.SetType(type);
IList<ResolveInfo> list =
packageManager.QueryIntentActivities(intent,
PackageInfoFlags.MatchDefaultOnly);
foreach (ResolveInfo i in list)
Android.Util.Log.Debug("DEBUG", i.ActivityInfo.ApplicationInfo.PackageName);
return list.Count > 0;
}
}

View File

@ -90,14 +90,14 @@ namespace keepass2android
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);
i.SetType("file/*");
act.StartActivityForResult(i, requestCodeBrowse);
return;
}
if (Interaction.isIntentAvailable(act, Intents.FILE_BROWSE))
if (Interaction.isIntentAvailable(act, Intents.FILE_BROWSE, null))
{
Intent i = new Intent(Intents.FILE_BROWSE);
if (filename != null)