Load Database task async wait moved to LoadDb runnable rather than blocking UI thread (in case the file is very slow, or the user is very quick to enter their password)
Database Unlocked warning notification now uses a 4.1 extended "Lock Database" button, and the main action is now just to activate the app. PasswordActivity no longer loads the database file into memory ready for loading if it's already loaded and we're showing QuickUnlock instead.
This commit is contained in:
		| @@ -17,19 +17,20 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file | ||||
|  | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Threading.Tasks; | ||||
| using KeePassLib.Serialization; | ||||
|  | ||||
| namespace keepass2android | ||||
| { | ||||
| 	public class LoadDb : RunnableOnFinish { | ||||
| 		private readonly IOConnectionInfo _ioc; | ||||
| 		private readonly MemoryStream _databaseData; | ||||
| 		private readonly Task<MemoryStream> _databaseData; | ||||
| 		private readonly String _pass; | ||||
| 		private readonly String _key; | ||||
| 		private readonly IKp2aApp _app; | ||||
| 		private readonly bool _rememberKeyfile; | ||||
| 		 | ||||
| 		public LoadDb(IKp2aApp app, IOConnectionInfo ioc, MemoryStream databaseData, String pass, String key, OnFinish finish): base(finish) | ||||
| 		public LoadDb(IKp2aApp app, IOConnectionInfo ioc, Task<MemoryStream> databaseData, String pass, String key, OnFinish finish): base(finish) | ||||
| 		{ | ||||
| 			_app = app; | ||||
| 			_ioc = ioc; | ||||
| @@ -47,7 +48,7 @@ namespace keepass2android | ||||
| 			try | ||||
| 			{ | ||||
| 				StatusLogger.UpdateMessage(UiStringKey.loading_database); | ||||
| 				_app.LoadDatabase(_ioc, _databaseData, _pass, _key, StatusLogger); | ||||
| 				_app.LoadDatabase(_ioc, _databaseData.Result, _pass, _key, StatusLogger); | ||||
| 				SaveFileData (_ioc, _key); | ||||
| 				 | ||||
| 			} catch (KeyFileException) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 AlexVallat
					AlexVallat