fixed file selection workflow for FTP/HTTP
This commit is contained in:
		| @@ -20,7 +20,7 @@ | ||||
|     <DebugType>full</DebugType> | ||||
|     <Optimize>False</Optimize> | ||||
|     <OutputPath>bin\Debug</OutputPath> | ||||
|     <DefineConstants>DEBUG;INCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_KEYTRANSFORM;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE</DefineConstants> | ||||
|     <DefineConstants>DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_KEYTRANSFORM;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|     <ConsolePause>False</ConsolePause> | ||||
|   | ||||
| @@ -20,7 +20,7 @@ | ||||
|     <DebugType>full</DebugType> | ||||
|     <Optimize>false</Optimize> | ||||
|     <OutputPath>bin\Debug\</OutputPath> | ||||
|     <DefineConstants>TRACE;DEBUG;INCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_KEYTRANSFORM;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE</DefineConstants> | ||||
|     <DefineConstants>TRACE;DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_KEYTRANSFORM;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|   </PropertyGroup> | ||||
|   | ||||
| @@ -35,7 +35,7 @@ public class Utils { | ||||
|      | ||||
|     public static boolean doLog() | ||||
|     { | ||||
|     	return true; | ||||
|     	return false; | ||||
|     	//return BuildConfig.DEBUG; //not working with Mono for Android | ||||
|     	 | ||||
|     } | ||||
|   | ||||
| @@ -278,7 +278,7 @@ namespace keepass2android | ||||
| 			confirmButton.Click += (sender, e) => | ||||
| 				{ | ||||
| 					App.Kp2a.GetFileStorage(_ioConnection) | ||||
| 					   .PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult), _ioConnection, 0); | ||||
| 					   .PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult, null), _ioConnection, 0); | ||||
| 				}; | ||||
| 			 | ||||
| 			/*CheckBox checkBox = (CheckBox) FindViewById(Resource.Id.show_password); | ||||
|   | ||||
| @@ -337,9 +337,9 @@ | ||||
| 	<string name="ChangeLog_title">Change log</string> | ||||
|  | ||||
| 	<string name="ChangeLog_0_9"> | ||||
| 		<b>Version 0.9</b>\n | ||||
| 		* Support for Dropbox (Keepass2Android regular edition only)\n | ||||
| 		* Integrated custom filechooser (based on android-filechooser by HBA) | ||||
| 		<b>Version 0.9 preview</b>\n | ||||
| 		* Integrated Dropbox support (read/write databases; Keepass2Android regular edition only)\n | ||||
| 		* Integrated custom file browser (based on android-filechooser by HBA) | ||||
| 	</string> | ||||
|  | ||||
| 	 | ||||
|   | ||||
| @@ -148,7 +148,7 @@ namespace keepass2android | ||||
| 		{ | ||||
| 			const string fileProviderAuthority = "keepass2android.keepass2android.android-filechooser.localfile"; | ||||
|  | ||||
|  | ||||
| #if !EXCLUDE_FILECHOOSER | ||||
| 			Intent i = Keepass2android.Kp2afilechooser.Kp2aFileChooserBridge.GetLaunchFileChooserIntent(act, | ||||
| 			                                                                                            fileProviderAuthority, | ||||
| 			                                                                                            defaultPath); | ||||
| @@ -156,6 +156,9 @@ namespace keepass2android | ||||
| 				i.PutExtra("group.pals.android.lib.ui.filechooser.FileChooserActivity.save_dialog", true); | ||||
|  | ||||
| 			act.StartActivityForResult(i, requestCodeBrowse); | ||||
| #else | ||||
| 			Toast.MakeText(act, "File Chooser excluded!",ToastLength.Long).Show(); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| 		public static string IntentToFilename(Intent data, Context ctx) | ||||
|   | ||||
| @@ -445,7 +445,7 @@ namespace keepass2android | ||||
|  | ||||
| 			if (resultCode == KeePass.ExitFileStorageSelectionOk) | ||||
| 			{ | ||||
| #if !EXCLUDE_FILECHOOSER | ||||
|  | ||||
| 				string protocolId = data.GetStringExtra("protocolId"); | ||||
|  | ||||
| 				if (protocolId == "androidget") | ||||
| @@ -456,18 +456,16 @@ namespace keepass2android | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					App.Kp2a.GetFileStorage(protocolId).StartSelectFile(new FileStorageSetupInitiatorActivity(this, OnActivityResult), false, 0, protocolId); | ||||
| 					App.Kp2a.GetFileStorage(protocolId).StartSelectFile(new FileStorageSetupInitiatorActivity(this,  | ||||
| 						OnActivityResult, | ||||
| 						defaultPath => | ||||
| 							{ | ||||
| 								ShowFilenameDialog(true, false, false, defaultPath, GetString(Resource.String.enter_filename_details_url), | ||||
| 								                    Intents.RequestCodeFileBrowseForOpen); | ||||
| 							} | ||||
| 						), false, 0, protocolId); | ||||
| 				} | ||||
|  | ||||
| #else | ||||
| 				Toast.MakeText(this, "TODO: make this more flexible.", ToastLength.Long).Show(); | ||||
| 				IOConnectionInfo ioc = new IOConnectionInfo | ||||
| 				{ | ||||
| 					Path = Environment.ExternalStorageDirectory+"/keepass/keepass.kdbx" | ||||
| 				}; | ||||
|  | ||||
| 				LaunchPasswordActivityForIoc(ioc); | ||||
| #endif | ||||
| 				 | ||||
| 			} | ||||
| 			 | ||||
| @@ -515,7 +513,7 @@ namespace keepass2android | ||||
| #endif | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		#if !EXCLUDE_FILECHOOSER | ||||
| 		private void StartFileChooser(string defaultPath) | ||||
| 		{ | ||||
| 			Kp2aLog.Log("FSA: defaultPath="+defaultPath); | ||||
| @@ -531,7 +529,7 @@ namespace keepass2android | ||||
| 			StartActivityForResult(i, Intents.RequestCodeFileBrowseForOpen); | ||||
| 		} | ||||
|  | ||||
|  | ||||
| #endif | ||||
| 		protected override void OnResume() | ||||
| 		{ | ||||
| 			base.OnResume(); | ||||
|   | ||||
| @@ -10,16 +10,14 @@ using Android.Runtime; | ||||
| using Android.Views; | ||||
| using Android.Widget; | ||||
| using KeePassLib.Serialization; | ||||
| using Keepass2android.Javafilestorage; | ||||
| using keepass2android.Io; | ||||
| using JavaFileStorage = Keepass2android.Javafilestorage.JavaFileStorage; | ||||
|  | ||||
| namespace keepass2android.fileselect | ||||
| { | ||||
| 	[Activity(Label = "@string/filestorage_setup_title",Theme="@style/Base")] | ||||
| 	public class FileStorageSetupActivity : Activity, IFileStorageSetupActivity | ||||
| #if !EXCLUDE_JAVAFILESTORAGE | ||||
| 		,IJavaFileStorageFileStorageSetupActivity | ||||
| 		,Keepass2android.Javafilestorage.IJavaFileStorageFileStorageSetupActivity | ||||
| #endif | ||||
| 	{ | ||||
| 		protected override void OnCreate(Bundle bundle) | ||||
|   | ||||
| @@ -2,7 +2,6 @@ using System; | ||||
| using Android.App; | ||||
| using Android.Content; | ||||
| using KeePassLib.Serialization; | ||||
| using Keepass2android.Javafilestorage; | ||||
| using keepass2android.Io; | ||||
| using keepass2android.fileselect; | ||||
|  | ||||
| @@ -11,17 +10,22 @@ namespace keepass2android | ||||
| 	public class FileStorageSetupInitiatorActivity:  | ||||
| #if !EXCLUDE_JAVAFILESTORAGE | ||||
| 		Java.Lang.Object | ||||
| 		,IJavaFileStorageFileStorageSetupInitiatorActivity | ||||
| 		,Keepass2android.Javafilestorage.IJavaFileStorageFileStorageSetupInitiatorActivity | ||||
| 		, | ||||
| #endif | ||||
| 		, IFileStorageSetupInitiatorActivity | ||||
|  IFileStorageSetupInitiatorActivity | ||||
| 	{ | ||||
| 		private readonly Activity _activity; | ||||
| 		private readonly Action<int, Result, Intent> _onActivityResult; | ||||
| 		private readonly Action<string> _startManualFileSelect; | ||||
|  | ||||
| 		public FileStorageSetupInitiatorActivity(Activity activity, Action<int,Result,Intent> onActivityResult) | ||||
| 		public FileStorageSetupInitiatorActivity(Activity activity,  | ||||
| 			Action<int,Result,Intent> onActivityResult, | ||||
| 			Action<String> startManualFileSelect) | ||||
| 		{ | ||||
| 			_activity = activity; | ||||
| 			_onActivityResult = onActivityResult; | ||||
| 			_startManualFileSelect = startManualFileSelect; | ||||
| 		} | ||||
|  | ||||
| 		public void StartSelectFileProcess(IOConnectionInfo ioc, bool isForSave, int requestCode) | ||||
| @@ -60,7 +64,7 @@ namespace keepass2android | ||||
|  | ||||
| 		public void PerformManualFileSelect(bool isForSave, int requestCode, string protocolId) | ||||
| 		{ | ||||
| 			throw new NotImplementedException(); | ||||
| 			_startManualFileSelect(protocolId + "://"); | ||||
| 		} | ||||
|  | ||||
| 		public void StartFileUsageProcess(string p0, int p1) | ||||
|   | ||||
| @@ -24,7 +24,7 @@ | ||||
|     <DebugType>full</DebugType> | ||||
|     <Optimize>False</Optimize> | ||||
|     <OutputPath>bin\Debug</OutputPath> | ||||
|     <DefineConstants>DEBUG;INCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_KEYTRANSFORM;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE</DefineConstants> | ||||
|     <DefineConstants>DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_KEYTRANSFORM;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|     <ConsolePause>False</ConsolePause> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Philipp Crocoll
					Philipp Crocoll