rename RunnableOnFinish => OperationWithFinishHandler, introduce IKp2aStatusLogger
This commit is contained in:
		@@ -86,6 +86,11 @@ namespace KeePassLib.Interfaces
 | 
			
		||||
		/// the current work.</returns>
 | 
			
		||||
		bool SetText(string strNewText, LogStatusType lsType);
 | 
			
		||||
 | 
			
		||||
        void UpdateMessage(String message);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        void UpdateSubMessage(String submessage);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Check if the user cancelled the current work.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
@@ -100,6 +105,12 @@ namespace KeePassLib.Interfaces
 | 
			
		||||
		public void EndLogging() { }
 | 
			
		||||
		public bool SetProgress(uint uPercent) { return true; }
 | 
			
		||||
		public bool SetText(string strNewText, LogStatusType lsType) { return true; }
 | 
			
		||||
        public void UpdateMessage(string message){
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void UpdateSubMessage(string submessage){
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool ContinueWork() { return true; }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,7 @@ namespace keepass2android
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Loads the specified data as the currently open database, as unlocked.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        Database LoadDatabase(IOConnectionInfo ioConnectionInfo, MemoryStream memoryStream, CompositeKey compKey, ProgressDialogStatusLogger statusLogger, IDatabaseFormat databaseFormat, bool makeCurrent);
 | 
			
		||||
        Database LoadDatabase(IOConnectionInfo ioConnectionInfo, MemoryStream memoryStream, CompositeKey compKey, IKp2aStatusLogger statusLogger, IDatabaseFormat databaseFormat, bool makeCurrent);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	    HashSet<PwGroup> DirtyGroups { get; }
 | 
			
		||||
 
 | 
			
		||||
@@ -22,62 +22,60 @@ using KeePassLib.Interfaces;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
	/// <summary>
 | 
			
		||||
	/// StatusLogger implementation which shows the progress in a progress dialog
 | 
			
		||||
	/// </summary>
 | 
			
		||||
	public class ProgressDialogStatusLogger: IStatusLogger {
 | 
			
		||||
		private readonly IProgressDialog _progressDialog;
 | 
			
		||||
		readonly IKp2aApp _app;
 | 
			
		||||
		private readonly Handler _handler;
 | 
			
		||||
		private string _message = "";
 | 
			
		||||
	    private string _submessage;
 | 
			
		||||
    public interface IKp2aStatusLogger : IStatusLogger
 | 
			
		||||
    {
 | 
			
		||||
        void UpdateMessage(UiStringKey stringKey);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        public String SubMessage => _submessage;
 | 
			
		||||
	    public String Message => _message;
 | 
			
		||||
 | 
			
		||||
        public ProgressDialogStatusLogger() {
 | 
			
		||||
    public class Kp2aNullStatusLogger : IKp2aStatusLogger
 | 
			
		||||
    {
 | 
			
		||||
        public void StartLogging(string strOperation, bool bWriteOperationToLog)
 | 
			
		||||
        {
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		public ProgressDialogStatusLogger(IKp2aApp app, Handler handler, IProgressDialog pd) {
 | 
			
		||||
        public void EndLogging()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool SetProgress(uint uPercent)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool SetText(string strNewText, LogStatusType lsType)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void UpdateMessage(string message)
 | 
			
		||||
        {
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void UpdateSubMessage(string submessage)
 | 
			
		||||
        {
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool ContinueWork()
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void UpdateMessage(UiStringKey stringKey)
 | 
			
		||||
        {
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public abstract class Kp2aAppStatusLogger : IKp2aStatusLogger
 | 
			
		||||
    {
 | 
			
		||||
        protected IKp2aApp _app;
 | 
			
		||||
 | 
			
		||||
        public Kp2aAppStatusLogger(IKp2aApp app)
 | 
			
		||||
        {
 | 
			
		||||
            _app = app;
 | 
			
		||||
			_progressDialog = pd;
 | 
			
		||||
			_handler = handler;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public void UpdateMessage(UiStringKey stringKey) {
 | 
			
		||||
			if (_app != null)
 | 
			
		||||
				UpdateMessage(_app.GetResourceString(stringKey));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void UpdateMessage (String message)
 | 
			
		||||
		{
 | 
			
		||||
		    Kp2aLog.Log("status message: " + message);
 | 
			
		||||
            _message = message;
 | 
			
		||||
			if ( _app!= null && _progressDialog != null && _handler != null ) {
 | 
			
		||||
				_handler.Post(() => {_progressDialog.SetMessage(message); } );
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void UpdateSubMessage(String submessage)
 | 
			
		||||
		{
 | 
			
		||||
		    Kp2aLog.Log("status submessage: " + submessage);
 | 
			
		||||
		    _submessage = submessage;
 | 
			
		||||
			if (_app != null && _progressDialog != null && _handler != null)
 | 
			
		||||
			{
 | 
			
		||||
				_handler.Post(() => 
 | 
			
		||||
				{ 
 | 
			
		||||
					if (!String.IsNullOrEmpty(submessage))
 | 
			
		||||
					{
 | 
			
		||||
						_progressDialog.SetMessage(_message + " (" + submessage + ")");
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						_progressDialog.SetMessage(_message);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			);
 | 
			
		||||
			}
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #region IStatusLogger implementation
 | 
			
		||||
@@ -113,6 +111,9 @@ namespace keepass2android
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public abstract void UpdateMessage(string message);
 | 
			
		||||
        public abstract void UpdateSubMessage(string submessage);
 | 
			
		||||
 | 
			
		||||
        private void UpdateMessage(string message, LogStatusType lsType)
 | 
			
		||||
        {
 | 
			
		||||
            if (lsType == LogStatusType.AdditionalInfo)
 | 
			
		||||
@@ -132,6 +133,67 @@ namespace keepass2android
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        public void UpdateMessage(UiStringKey stringKey)
 | 
			
		||||
        {
 | 
			
		||||
            if (_app != null)
 | 
			
		||||
                UpdateMessage(_app.GetResourceString(stringKey));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// StatusLogger implementation which shows the progress in a progress dialog
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class ProgressDialogStatusLogger: Kp2aAppStatusLogger
 | 
			
		||||
    {
 | 
			
		||||
		private readonly IProgressDialog _progressDialog;
 | 
			
		||||
		
 | 
			
		||||
		private readonly Handler _handler;
 | 
			
		||||
		private string _message = "";
 | 
			
		||||
	    private string _submessage;
 | 
			
		||||
 | 
			
		||||
        public String SubMessage => _submessage;
 | 
			
		||||
	    public String Message => _message;
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
		public ProgressDialogStatusLogger(IKp2aApp app, Handler handler, IProgressDialog pd)
 | 
			
		||||
        : base(app){
 | 
			
		||||
			_progressDialog = pd;
 | 
			
		||||
			_handler = handler;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		public override void UpdateMessage (String message)
 | 
			
		||||
		{
 | 
			
		||||
		    Kp2aLog.Log("status message: " + message);
 | 
			
		||||
            _message = message;
 | 
			
		||||
			if ( _app!= null && _progressDialog != null && _handler != null ) {
 | 
			
		||||
				_handler.Post(() => {_progressDialog.SetMessage(message); } );
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public override void UpdateSubMessage(String submessage)
 | 
			
		||||
		{
 | 
			
		||||
		    Kp2aLog.Log("status submessage: " + submessage);
 | 
			
		||||
		    _submessage = submessage;
 | 
			
		||||
			if (_app != null && _progressDialog != null && _handler != null)
 | 
			
		||||
			{
 | 
			
		||||
				_handler.Post(() => 
 | 
			
		||||
				{ 
 | 
			
		||||
					if (!String.IsNullOrEmpty(submessage))
 | 
			
		||||
					{
 | 
			
		||||
						_progressDialog.SetMessage(_message + " (" + submessage + ")");
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						_progressDialog.SetMessage(_message);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -72,14 +72,14 @@ namespace keepass2android
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		private readonly Handler _handler;
 | 
			
		||||
		private readonly RunnableOnFinish _task;
 | 
			
		||||
		private readonly OperationWithFinishHandler _task;
 | 
			
		||||
		private IProgressDialog _progressDialog;
 | 
			
		||||
        private readonly IKp2aApp _app;
 | 
			
		||||
        private Java.Lang.Thread _thread;
 | 
			
		||||
	    private Activity _activeActivity, _previouslyActiveActivity;
 | 
			
		||||
	    private ProgressDialogStatusLogger _progressDialogStatusLogger;
 | 
			
		||||
 | 
			
		||||
	    public ProgressTask(IKp2aApp app, Activity activity, RunnableOnFinish task)
 | 
			
		||||
	    public ProgressTask(IKp2aApp app, Activity activity, OperationWithFinishHandler task)
 | 
			
		||||
		{
 | 
			
		||||
		    _activeActivity = activity;
 | 
			
		||||
			_task = task;
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ using keepass2android.Io;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
	public class CheckDatabaseForChanges: RunnableOnFinish
 | 
			
		||||
	public class CheckDatabaseForChanges: OperationWithFinishHandler
 | 
			
		||||
	{
 | 
			
		||||
		private readonly Context _context;
 | 
			
		||||
		private readonly IKp2aApp _app;
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,7 @@ namespace keepass2android
 | 
			
		||||
		/// <summary>
 | 
			
		||||
		/// Do not call this method directly. Call App.Kp2a.LoadDatabase instead.
 | 
			
		||||
		/// </summary>
 | 
			
		||||
		public void LoadData(IKp2aApp app, IOConnectionInfo iocInfo, MemoryStream databaseData, CompositeKey compositeKey, ProgressDialogStatusLogger status, IDatabaseFormat databaseFormat)
 | 
			
		||||
		public void LoadData(IKp2aApp app, IOConnectionInfo iocInfo, MemoryStream databaseData, CompositeKey compositeKey, IKp2aStatusLogger status, IDatabaseFormat databaseFormat)
 | 
			
		||||
		{
 | 
			
		||||
			PwDatabase pwDatabase = new PwDatabase();
 | 
			
		||||
 | 
			
		||||
@@ -149,7 +149,7 @@ namespace keepass2android
 | 
			
		||||
			get { return GetFingerprintModePrefKey(Ioc); }
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		protected  virtual void PopulateDatabaseFromStream(PwDatabase pwDatabase, Stream s, IOConnectionInfo iocInfo, CompositeKey compositeKey, ProgressDialogStatusLogger status, IDatabaseFormat databaseFormat)
 | 
			
		||||
		protected  virtual void PopulateDatabaseFromStream(PwDatabase pwDatabase, Stream s, IOConnectionInfo iocInfo, CompositeKey compositeKey, IKp2aStatusLogger status, IDatabaseFormat databaseFormat)
 | 
			
		||||
		{
 | 
			
		||||
			IFileStorage fileStorage = _app.GetFileStorage(iocInfo);
 | 
			
		||||
			var filename = fileStorage.GetFilenameWithoutPathAndExt(iocInfo);
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ using KeePass.Util;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
	public class SynchronizeCachedDatabase: RunnableOnFinish 
 | 
			
		||||
	public class SynchronizeCachedDatabase: OperationWithFinishHandler 
 | 
			
		||||
	{
 | 
			
		||||
		private readonly Activity _context;
 | 
			
		||||
		private readonly IKp2aApp _app;
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ using KeePassLib;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
	public class AddEntry : RunnableOnFinish {
 | 
			
		||||
	public class AddEntry : OperationWithFinishHandler {
 | 
			
		||||
		protected Database Db
 | 
			
		||||
		{
 | 
			
		||||
			get { return _app.CurrentDb; }
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ using KeePassLib;
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	public class AddGroup : RunnableOnFinish {
 | 
			
		||||
	public class AddGroup : OperationWithFinishHandler {
 | 
			
		||||
		internal Database Db
 | 
			
		||||
		{
 | 
			
		||||
			get { return _app.CurrentDb; }
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ using KeePassLib.Utility;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
	public class AddTemplateEntries : RunnableOnFinish {
 | 
			
		||||
	public class AddTemplateEntries : OperationWithFinishHandler {
 | 
			
		||||
 | 
			
		||||
		public class TemplateEntry
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ using KeePassLib.Keys;
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
	
 | 
			
		||||
	public class CreateDb : RunnableOnFinish {
 | 
			
		||||
	public class CreateDb : OperationWithFinishHandler {
 | 
			
		||||
	    private readonly IOConnectionInfo _ioc;
 | 
			
		||||
		private readonly bool _dontSave;
 | 
			
		||||
		private readonly Activity _ctx;
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ using KeePassLib;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
	public abstract class DeleteRunnable : RunnableOnFinish
 | 
			
		||||
	public abstract class DeleteRunnable : OperationWithFinishHandler
 | 
			
		||||
	{
 | 
			
		||||
		protected DeleteRunnable(Activity activity, OnOperationFinishedHandler operationFinishedHandler, IKp2aApp app)
 | 
			
		||||
			: base(activity, operationFinishedHandler)
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ using KeePassLib;
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	public class EditGroup : RunnableOnFinish {
 | 
			
		||||
	public class EditGroup : OperationWithFinishHandler {
 | 
			
		||||
		internal Database Db
 | 
			
		||||
		{
 | 
			
		||||
			get { return _app.FindDatabaseForElement(Group); }
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ using KeePassLib.Serialization;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
	public class LoadDb : RunnableOnFinish {
 | 
			
		||||
	public class LoadDb : OperationWithFinishHandler {
 | 
			
		||||
		private readonly IOConnectionInfo _ioc;
 | 
			
		||||
		private readonly Task<MemoryStream> _databaseData;
 | 
			
		||||
		private readonly CompositeKey _compositeKey;
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ using KeePassLib.Interfaces;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android.database.edit
 | 
			
		||||
{
 | 
			
		||||
	public class MoveElements: RunnableOnFinish
 | 
			
		||||
	public class MoveElements: OperationWithFinishHandler
 | 
			
		||||
	{
 | 
			
		||||
		private readonly List<IStructureItem> _elementsToMove;
 | 
			
		||||
		private readonly PwGroup _targetGroup;
 | 
			
		||||
 
 | 
			
		||||
@@ -22,6 +22,7 @@ using Android.Content;
 | 
			
		||||
using Android.OS;
 | 
			
		||||
using Android.Widget;
 | 
			
		||||
using Google.Android.Material.Dialog;
 | 
			
		||||
using KeePassLib.Interfaces;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
@@ -39,11 +40,11 @@ namespace keepass2android
 | 
			
		||||
 | 
			
		||||
        protected OnOperationFinishedHandler NextOnOperationFinishedHandler;
 | 
			
		||||
		protected Handler Handler;
 | 
			
		||||
		private ProgressDialogStatusLogger _statusLogger = new ProgressDialogStatusLogger(); //default: no logging but not null -> can be used whenever desired
 | 
			
		||||
		private IKp2aStatusLogger _statusLogger = new Kp2aNullStatusLogger(); //default: no logging but not null -> can be used whenever desired
 | 
			
		||||
	    private Activity _activeActivity, _previouslyActiveActivity;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	    public ProgressDialogStatusLogger StatusLogger
 | 
			
		||||
	    public IKp2aStatusLogger StatusLogger
 | 
			
		||||
		{
 | 
			
		||||
			get { return _statusLogger; }
 | 
			
		||||
			set { _statusLogger = value; }
 | 
			
		||||
 
 | 
			
		||||
@@ -17,17 +17,18 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file
 | 
			
		||||
using System;
 | 
			
		||||
using Android.App;
 | 
			
		||||
using Android.Content;
 | 
			
		||||
using KeePassLib.Interfaces;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	public abstract class RunnableOnFinish  {
 | 
			
		||||
	public abstract class OperationWithFinishHandler  {
 | 
			
		||||
		
 | 
			
		||||
		protected OnOperationFinishedHandler _operationFinishedHandler;
 | 
			
		||||
		public ProgressDialogStatusLogger StatusLogger = new ProgressDialogStatusLogger(); //default: empty but not null
 | 
			
		||||
		public IKp2aStatusLogger StatusLogger = new Kp2aNullStatusLogger(); //default: empty but not null
 | 
			
		||||
	    private Activity _activeActivity;
 | 
			
		||||
 | 
			
		||||
	    protected RunnableOnFinish(Activity activeActivity, OnOperationFinishedHandler operationFinishedHandler)
 | 
			
		||||
	    protected OperationWithFinishHandler(Activity activeActivity, OnOperationFinishedHandler operationFinishedHandler)
 | 
			
		||||
	    {
 | 
			
		||||
	        _activeActivity = activeActivity;
 | 
			
		||||
			_operationFinishedHandler = operationFinishedHandler;
 | 
			
		||||
@@ -64,12 +65,12 @@ namespace keepass2android
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public void SetStatusLogger(ProgressDialogStatusLogger status) {
 | 
			
		||||
		public void SetStatusLogger(IKp2aStatusLogger statusLogger) {
 | 
			
		||||
			if (operationFinishedHandler != null)
 | 
			
		||||
			{
 | 
			
		||||
				operationFinishedHandler.StatusLogger = status;
 | 
			
		||||
				operationFinishedHandler.StatusLogger = statusLogger;
 | 
			
		||||
			}
 | 
			
		||||
			StatusLogger = status;
 | 
			
		||||
			StatusLogger = statusLogger;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public abstract void Run();
 | 
			
		||||
@@ -34,7 +34,7 @@ using KeePass.Util;
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	public class SaveDb : RunnableOnFinish {
 | 
			
		||||
	public class SaveDb : OperationWithFinishHandler {
 | 
			
		||||
		private readonly IKp2aApp _app;
 | 
			
		||||
	    private readonly Database _db;
 | 
			
		||||
	    private readonly bool _dontSave;
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ using KeePassLib.Keys;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
	public class SetPassword : RunnableOnFinish {
 | 
			
		||||
	public class SetPassword : OperationWithFinishHandler {
 | 
			
		||||
		
 | 
			
		||||
		private readonly String _password;
 | 
			
		||||
		private readonly String _keyfile;
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ using KeePassLib;
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	public class UpdateEntry : RunnableOnFinish {
 | 
			
		||||
	public class UpdateEntry : OperationWithFinishHandler {
 | 
			
		||||
		private readonly IKp2aApp _app;
 | 
			
		||||
		private readonly Activity _ctx;
 | 
			
		||||
		
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ using KeePassLib.Serialization;
 | 
			
		||||
 | 
			
		||||
namespace keepass2android
 | 
			
		||||
{
 | 
			
		||||
	class CreateNewFilename : RunnableOnFinish
 | 
			
		||||
	class CreateNewFilename : OperationWithFinishHandler
 | 
			
		||||
	{
 | 
			
		||||
		private readonly string _filename;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1260,7 +1260,7 @@ namespace keepass2android
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	    public class WriteBinaryTask : RunnableOnFinish
 | 
			
		||||
	    public class WriteBinaryTask : OperationWithFinishHandler
 | 
			
		||||
	    {
 | 
			
		||||
	        private readonly IKp2aApp _app;
 | 
			
		||||
	        private readonly ProtectedBinary _data;
 | 
			
		||||
@@ -1511,7 +1511,7 @@ namespace keepass2android
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			RunnableOnFinish runnable = new UpdateEntry(this, App.Kp2a, initialEntry, newEntry, closeOrShowError);
 | 
			
		||||
			OperationWithFinishHandler runnable = new UpdateEntry(this, App.Kp2a, initialEntry, newEntry, closeOrShowError);
 | 
			
		||||
 | 
			
		||||
			ProgressTask pt = new ProgressTask(App.Kp2a, this, runnable);
 | 
			
		||||
			pt.Run();
 | 
			
		||||
 
 | 
			
		||||
@@ -519,7 +519,7 @@ namespace keepass2android
 | 
			
		||||
			SetResult(KeePass.ExitRefreshTitle);
 | 
			
		||||
			//}
 | 
			
		||||
			
 | 
			
		||||
			RunnableOnFinish runnable;
 | 
			
		||||
			OperationWithFinishHandler runnable;
 | 
			
		||||
 | 
			
		||||
			ActionOnOperationFinished closeOrShowError = new ActionOnOperationFinished(this, (success, message, activity) => {
 | 
			
		||||
				if (success)
 | 
			
		||||
 
 | 
			
		||||
@@ -93,7 +93,7 @@ namespace keepass2android
 | 
			
		||||
			get { return 0; }
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public class ExportDb : RunnableOnFinish
 | 
			
		||||
		public class ExportDb : OperationWithFinishHandler
 | 
			
		||||
		{
 | 
			
		||||
			private readonly IKp2aApp _app;
 | 
			
		||||
			private readonly FileFormatProvider _fileFormat;
 | 
			
		||||
 
 | 
			
		||||
@@ -202,7 +202,7 @@ namespace keepass2android
 | 
			
		||||
                String strGroupUuid = data.Extras.GetString(GroupEditActivity.KeyGroupUuid);
 | 
			
		||||
                GroupBaseActivity act = this;
 | 
			
		||||
                Handler handler = new Handler();
 | 
			
		||||
                RunnableOnFinish task;
 | 
			
		||||
                OperationWithFinishHandler task;
 | 
			
		||||
                if (strGroupUuid == null)
 | 
			
		||||
                {
 | 
			
		||||
                    task = AddGroup.GetInstance(this, App.Kp2a, groupName, groupIconId, groupCustomIconId, Group, new RefreshTask(handler, this), false);
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ namespace keepass2android
 | 
			
		||||
            _activity = activity;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public class SyncOtpAuxFile : RunnableOnFinish
 | 
			
		||||
        public class SyncOtpAuxFile : OperationWithFinishHandler
 | 
			
		||||
        {
 | 
			
		||||
            private readonly IOConnectionInfo _ioc;
 | 
			
		||||
 | 
			
		||||
@@ -52,7 +52,7 @@ namespace keepass2android
 | 
			
		||||
        public void SynchronizeDatabase(Action runAfterSuccess)
 | 
			
		||||
        {
 | 
			
		||||
            var filestorage = App.Kp2a.GetFileStorage(App.Kp2a.CurrentDb.Ioc);
 | 
			
		||||
            RunnableOnFinish task;
 | 
			
		||||
            OperationWithFinishHandler task;
 | 
			
		||||
            OnOperationFinishedHandler onOperationFinishedHandler = new ActionOnOperationFinished(_activity, (success, message, activity) =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!String.IsNullOrEmpty(message))
 | 
			
		||||
 
 | 
			
		||||
@@ -186,7 +186,7 @@ namespace keepass2android
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	    public Database LoadDatabase(IOConnectionInfo ioConnectionInfo, MemoryStream memoryStream, CompositeKey compositeKey, ProgressDialogStatusLogger statusLogger, IDatabaseFormat databaseFormat, bool makeCurrent)
 | 
			
		||||
	    public Database LoadDatabase(IOConnectionInfo ioConnectionInfo, MemoryStream memoryStream, CompositeKey compositeKey, IKp2aStatusLogger statusLogger, IDatabaseFormat databaseFormat, bool makeCurrent)
 | 
			
		||||
	    {
 | 
			
		||||
	        var prefs = PreferenceManager.GetDefaultSharedPreferences(LocaleManager.LocalizedAppContext);
 | 
			
		||||
	        var createBackup = prefs.GetBoolean(LocaleManager.LocalizedAppContext.GetString(Resource.String.CreateBackups_key), true)
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ namespace keepass2android
 | 
			
		||||
    public class ExportKeyfileActivity : LockCloseActivity
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public class ExportKeyfile : RunnableOnFinish
 | 
			
		||||
        public class ExportKeyfile : OperationWithFinishHandler
 | 
			
		||||
        {
 | 
			
		||||
            private readonly IKp2aApp _app;
 | 
			
		||||
            private IOConnectionInfo _targetIoc;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user