revert removal of external file pickers to fix #77

This commit is contained in:
Philipp Crocoll
2017-11-13 09:53:19 +01:00
parent 635d06df87
commit ba840822bc
3 changed files with 6 additions and 12 deletions

View File

@@ -805,7 +805,7 @@ namespace keepass2android
addBinaryButton.Enabled = !State.Entry.Binaries.Any();
addBinaryButton.Click += (sender, e) =>
{
Util.ShowBrowseDialog(this, Intents.RequestCodeFileBrowseForBinary, false, false);
Util.ShowBrowseDialog(this, Intents.RequestCodeFileBrowseForBinary, false, true /*force OpenDocument if available, GetContent is not well support starting with Android 7 */);
};
binariesGroup.AddView(addBinaryButton,layoutParams);

View File

@@ -74,7 +74,7 @@ namespace keepass2android
}
if ((context.Intent.GetBooleanExtra(AllowThirdPartyAppGet, false)) && (Util.ActionGetContentAvailable))
if (context.Intent.GetBooleanExtra(AllowThirdPartyAppGet, false))
_displayedProtocolIds.Add("androidget");
if (context.Intent.GetBooleanExtra(AllowThirdPartyAppSend, false))
_displayedProtocolIds.Add("androidsend");

View File

@@ -200,10 +200,10 @@ namespace keepass2android
/// is more for one-time access, but therefore allows possibly more available sources.</param>
public static void ShowBrowseDialog(Activity activity, int requestCodeBrowse, bool forSaving, bool tryGetPermanentAccess)
{
var loadAction = (tryGetPermanentAccess && IsKitKatOrLater) || !ActionGetContentAvailable
? Intent.ActionOpenDocument
: Intent.ActionGetContent;
//even though GetContent is not well supported (since Android 7, see https://commonsware.com/Android/previews/appendix-b-android-70)
//we still offer it.
var loadAction = (tryGetPermanentAccess && IsKitKatOrLater) ?
Intent.ActionOpenDocument : Intent.ActionGetContent;
if ((!forSaving) && (IsIntentAvailable(activity, loadAction, "*/*", new List<string> { Intent.CategoryOpenable})))
{
Intent i = new Intent(loadAction);
@@ -232,12 +232,6 @@ namespace keepass2android
}
}
public static bool ActionGetContentAvailable
{
//https://commonsware.com/Android/previews/appendix-b-android-70
get { return ((int) Build.VERSION.SdkInt < 24); }
}
public static bool IsKitKatOrLater
{
get { return (int)Build.VERSION.SdkInt >= 19; }