revert removal of external file pickers to fix #77
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
| @@ -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"); | ||||
|   | ||||
| @@ -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; } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Philipp Crocoll
					Philipp Crocoll