rename OnFinish => OnOperationFinishedHandler
This commit is contained in:
@@ -89,7 +89,7 @@ namespace keepass2android
|
|||||||
SetupProgressDialog(app);
|
SetupProgressDialog(app);
|
||||||
|
|
||||||
// Set code to run when this is finished
|
// Set code to run when this is finished
|
||||||
_task.OnFinishToRun = new AfterTask(activity, task.OnFinishToRun, _handler, this);
|
_task.operationFinishedHandler = new AfterTask(activity, task.operationFinishedHandler, _handler, this);
|
||||||
|
|
||||||
_task.SetStatusLogger(_progressDialogStatusLogger);
|
_task.SetStatusLogger(_progressDialogStatusLogger);
|
||||||
|
|
||||||
@@ -144,10 +144,10 @@ namespace keepass2android
|
|||||||
_thread.Join();
|
_thread.Join();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AfterTask : OnFinish {
|
private class AfterTask : OnOperationFinishedHandler {
|
||||||
readonly ProgressTask _progressTask;
|
readonly ProgressTask _progressTask;
|
||||||
|
|
||||||
public AfterTask (Activity activity, OnFinish finish, Handler handler, ProgressTask pt): base(activity, finish, handler)
|
public AfterTask (Activity activity, OnOperationFinishedHandler operationFinishedHandler, Handler handler, ProgressTask pt): base(activity, operationFinishedHandler, handler)
|
||||||
{
|
{
|
||||||
_progressTask = pt;
|
_progressTask = pt;
|
||||||
}
|
}
|
||||||
|
@@ -19,8 +19,8 @@ namespace keepass2android
|
|||||||
private readonly IKp2aApp _app;
|
private readonly IKp2aApp _app;
|
||||||
|
|
||||||
|
|
||||||
public CheckDatabaseForChanges(Activity context, IKp2aApp app, OnFinish finish)
|
public CheckDatabaseForChanges(Activity context, IKp2aApp app, OnOperationFinishedHandler operationFinishedHandler)
|
||||||
: base(context, finish)
|
: base(context, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_app = app;
|
_app = app;
|
||||||
|
@@ -16,8 +16,8 @@ namespace keepass2android
|
|||||||
private readonly IKp2aApp _app;
|
private readonly IKp2aApp _app;
|
||||||
private SaveDb _saveDb;
|
private SaveDb _saveDb;
|
||||||
|
|
||||||
public SynchronizeCachedDatabase(Activity context, IKp2aApp app, OnFinish finish)
|
public SynchronizeCachedDatabase(Activity context, IKp2aApp app, OnOperationFinishedHandler operationFinishedHandler)
|
||||||
: base(context, finish)
|
: base(context, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_app = app;
|
_app = app;
|
||||||
@@ -64,7 +64,7 @@ namespace keepass2android
|
|||||||
if (cachingFileStorage.HasLocalChanges(ioc))
|
if (cachingFileStorage.HasLocalChanges(ioc))
|
||||||
{
|
{
|
||||||
//conflict! need to merge
|
//conflict! need to merge
|
||||||
_saveDb = new SaveDb(_context, _app, new ActionOnFinish(ActiveActivity, (success, result, activity) =>
|
_saveDb = new SaveDb(_context, _app, new ActionOnOperationFinished(ActiveActivity, (success, result, activity) =>
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
@@ -21,18 +21,18 @@ using Android.OS;
|
|||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
public class ActionOnFinish: OnFinish
|
public class ActionOnOperationFinished: OnOperationFinishedHandler
|
||||||
{
|
{
|
||||||
public delegate void ActionToPerformOnFinsh(bool success, String message, Activity activeActivity);
|
public delegate void ActionToPerformOnFinsh(bool success, String message, Activity activeActivity);
|
||||||
|
|
||||||
readonly ActionToPerformOnFinsh _actionToPerform;
|
readonly ActionToPerformOnFinsh _actionToPerform;
|
||||||
|
|
||||||
public ActionOnFinish(Activity activity, ActionToPerformOnFinsh actionToPerform) : base(activity, null, null)
|
public ActionOnOperationFinished(Activity activity, ActionToPerformOnFinsh actionToPerform) : base(activity, null, null)
|
||||||
{
|
{
|
||||||
_actionToPerform = actionToPerform;
|
_actionToPerform = actionToPerform;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionOnFinish(Activity activity, ActionToPerformOnFinsh actionToPerform, OnFinish finish) : base(activity, finish)
|
public ActionOnOperationFinished(Activity activity, ActionToPerformOnFinsh actionToPerform, OnOperationFinishedHandler operationFinishedHandler) : base(activity, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_actionToPerform = actionToPerform;
|
_actionToPerform = actionToPerform;
|
||||||
}
|
}
|
@@ -33,19 +33,19 @@ namespace keepass2android
|
|||||||
private readonly Activity _ctx;
|
private readonly Activity _ctx;
|
||||||
private readonly Database _db;
|
private readonly Database _db;
|
||||||
|
|
||||||
public static AddEntry GetInstance(Activity ctx, IKp2aApp app, PwEntry entry, PwGroup parentGroup, OnFinish finish, Database db) {
|
public static AddEntry GetInstance(Activity ctx, IKp2aApp app, PwEntry entry, PwGroup parentGroup, OnOperationFinishedHandler operationFinishedHandler, Database db) {
|
||||||
|
|
||||||
return new AddEntry(ctx, db, app, entry, parentGroup, finish);
|
return new AddEntry(ctx, db, app, entry, parentGroup, operationFinishedHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AddEntry(Activity ctx, Database db, IKp2aApp app, PwEntry entry, PwGroup parentGroup, OnFinish finish):base(ctx, finish) {
|
public AddEntry(Activity ctx, Database db, IKp2aApp app, PwEntry entry, PwGroup parentGroup, OnOperationFinishedHandler operationFinishedHandler):base(ctx, operationFinishedHandler) {
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
_db = db;
|
_db = db;
|
||||||
_parentGroup = parentGroup;
|
_parentGroup = parentGroup;
|
||||||
_app = app;
|
_app = app;
|
||||||
_entry = entry;
|
_entry = entry;
|
||||||
|
|
||||||
_onFinishToRun = new AfterAdd(ctx, app.CurrentDb, entry, app,OnFinishToRun);
|
_operationFinishedHandler = new AfterAdd(ctx, app.CurrentDb, entry, app,operationFinishedHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -65,17 +65,17 @@ namespace keepass2android
|
|||||||
_db.Elements.Add(_entry);
|
_db.Elements.Add(_entry);
|
||||||
|
|
||||||
// Commit to disk
|
// Commit to disk
|
||||||
SaveDb save = new SaveDb(_ctx, _app, _app.CurrentDb, OnFinishToRun);
|
SaveDb save = new SaveDb(_ctx, _app, _app.CurrentDb, operationFinishedHandler);
|
||||||
save.SetStatusLogger(StatusLogger);
|
save.SetStatusLogger(StatusLogger);
|
||||||
save.Run();
|
save.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AfterAdd : OnFinish {
|
private class AfterAdd : OnOperationFinishedHandler {
|
||||||
private readonly Database _db;
|
private readonly Database _db;
|
||||||
private readonly PwEntry _entry;
|
private readonly PwEntry _entry;
|
||||||
private readonly IKp2aApp _app;
|
private readonly IKp2aApp _app;
|
||||||
|
|
||||||
public AfterAdd(Activity activity, Database db, PwEntry entry, IKp2aApp app, OnFinish finish):base(activity, finish) {
|
public AfterAdd(Activity activity, Database db, PwEntry entry, IKp2aApp app, OnOperationFinishedHandler operationFinishedHandler):base(activity, operationFinishedHandler) {
|
||||||
_db = db;
|
_db = db;
|
||||||
_entry = entry;
|
_entry = entry;
|
||||||
_app = app;
|
_app = app;
|
||||||
|
@@ -41,13 +41,13 @@ namespace keepass2android
|
|||||||
readonly Activity _ctx;
|
readonly Activity _ctx;
|
||||||
|
|
||||||
|
|
||||||
public static AddGroup GetInstance(Activity ctx, IKp2aApp app, string name, int iconid, PwUuid groupCustomIconId, PwGroup parent, OnFinish finish, bool dontSave) {
|
public static AddGroup GetInstance(Activity ctx, IKp2aApp app, string name, int iconid, PwUuid groupCustomIconId, PwGroup parent, OnOperationFinishedHandler operationFinishedHandler, bool dontSave) {
|
||||||
return new AddGroup(ctx, app, name, iconid, groupCustomIconId, parent, finish, dontSave);
|
return new AddGroup(ctx, app, name, iconid, groupCustomIconId, parent, operationFinishedHandler, dontSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private AddGroup(Activity ctx, IKp2aApp app, String name, int iconid, PwUuid groupCustomIconId, PwGroup parent, OnFinish finish, bool dontSave)
|
private AddGroup(Activity ctx, IKp2aApp app, String name, int iconid, PwUuid groupCustomIconId, PwGroup parent, OnOperationFinishedHandler operationFinishedHandler, bool dontSave)
|
||||||
: base(ctx, finish)
|
: base(ctx, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
_name = name;
|
_name = name;
|
||||||
@@ -57,7 +57,7 @@ namespace keepass2android
|
|||||||
DontSave = dontSave;
|
DontSave = dontSave;
|
||||||
_app = app;
|
_app = app;
|
||||||
|
|
||||||
_onFinishToRun = new AfterAdd(ctx, this, OnFinishToRun);
|
_operationFinishedHandler = new AfterAdd(ctx, this, operationFinishedHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -74,15 +74,15 @@ namespace keepass2android
|
|||||||
_app.CurrentDb.Elements.Add(Group);
|
_app.CurrentDb.Elements.Add(Group);
|
||||||
|
|
||||||
// Commit to disk
|
// Commit to disk
|
||||||
SaveDb save = new SaveDb(_ctx, _app, _app.CurrentDb, OnFinishToRun, DontSave);
|
SaveDb save = new SaveDb(_ctx, _app, _app.CurrentDb, operationFinishedHandler, DontSave);
|
||||||
save.SetStatusLogger(StatusLogger);
|
save.SetStatusLogger(StatusLogger);
|
||||||
save.Run();
|
save.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AfterAdd : OnFinish {
|
private class AfterAdd : OnOperationFinishedHandler {
|
||||||
readonly AddGroup _addGroup;
|
readonly AddGroup _addGroup;
|
||||||
|
|
||||||
public AfterAdd(Activity activity, AddGroup addGroup,OnFinish finish): base(activity, finish) {
|
public AfterAdd(Activity activity, AddGroup addGroup,OnOperationFinishedHandler operationFinishedHandler): base(activity, operationFinishedHandler) {
|
||||||
_addGroup = addGroup;
|
_addGroup = addGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -132,13 +132,13 @@ namespace keepass2android
|
|||||||
private readonly IKp2aApp _app;
|
private readonly IKp2aApp _app;
|
||||||
private readonly Activity _ctx;
|
private readonly Activity _ctx;
|
||||||
|
|
||||||
public AddTemplateEntries(Activity ctx, IKp2aApp app, OnFinish finish)
|
public AddTemplateEntries(Activity ctx, IKp2aApp app, OnOperationFinishedHandler operationFinishedHandler)
|
||||||
: base(ctx, finish)
|
: base(ctx, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
_app = app;
|
_app = app;
|
||||||
|
|
||||||
//_onFinishToRun = new AfterAdd(this, OnFinishToRun);
|
//_operationFinishedHandler = new AfterAdd(this, operationFinishedHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly List<TemplateEntry> TemplateEntries = new List<TemplateEntry>()
|
public static readonly List<TemplateEntry> TemplateEntries = new List<TemplateEntry>()
|
||||||
@@ -313,7 +313,7 @@ namespace keepass2android
|
|||||||
_app.DirtyGroups.Add(templateGroup);
|
_app.DirtyGroups.Add(templateGroup);
|
||||||
|
|
||||||
// Commit to disk
|
// Commit to disk
|
||||||
SaveDb save = new SaveDb(_ctx, _app, _app.CurrentDb, OnFinishToRun);
|
SaveDb save = new SaveDb(_ctx, _app, _app.CurrentDb, operationFinishedHandler);
|
||||||
save.SetStatusLogger(StatusLogger);
|
save.SetStatusLogger(StatusLogger);
|
||||||
save.Run();
|
save.Run();
|
||||||
}
|
}
|
||||||
@@ -369,11 +369,11 @@ namespace keepass2android
|
|||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AfterAdd : OnFinish {
|
private class AfterAdd : OnOperationFinishedHandler {
|
||||||
private readonly Database _db;
|
private readonly Database _db;
|
||||||
private readonly List<PwEntry> _entries;
|
private readonly List<PwEntry> _entries;
|
||||||
|
|
||||||
public AfterAdd(Activity activity, Database db, List<PwEntry> entries, OnFinish finish):base(activity, finish) {
|
public AfterAdd(Activity activity, Database db, List<PwEntry> entries, OnOperationFinishedHandler operationFinishedHandler):base(activity, operationFinishedHandler) {
|
||||||
_db = db;
|
_db = db;
|
||||||
_entries = entries;
|
_entries = entries;
|
||||||
|
|
||||||
|
@@ -16,8 +16,8 @@ namespace keepass2android.database.edit
|
|||||||
{
|
{
|
||||||
public class CopyEntry: AddEntry
|
public class CopyEntry: AddEntry
|
||||||
{
|
{
|
||||||
public CopyEntry(Activity ctx, IKp2aApp app, PwEntry entry, OnFinish finish, Database db)
|
public CopyEntry(Activity ctx, IKp2aApp app, PwEntry entry, OnOperationFinishedHandler operationFinishedHandler, Database db)
|
||||||
: base(ctx, db, app, CreateCopy(entry, app), entry.ParentGroup, finish)
|
: base(ctx, db, app, CreateCopy(entry, app), entry.ParentGroup, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ namespace keepass2android
|
|||||||
private CompositeKey _key;
|
private CompositeKey _key;
|
||||||
private readonly bool _makeCurrent;
|
private readonly bool _makeCurrent;
|
||||||
|
|
||||||
public CreateDb(IKp2aApp app, Activity ctx, IOConnectionInfo ioc, OnFinish finish, bool dontSave, bool makeCurrent): base(ctx, finish) {
|
public CreateDb(IKp2aApp app, Activity ctx, IOConnectionInfo ioc, OnOperationFinishedHandler operationFinishedHandler, bool dontSave, bool makeCurrent): base(ctx, operationFinishedHandler) {
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
_ioc = ioc;
|
_ioc = ioc;
|
||||||
_dontSave = dontSave;
|
_dontSave = dontSave;
|
||||||
@@ -42,8 +42,8 @@ namespace keepass2android
|
|||||||
_app = app;
|
_app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreateDb(IKp2aApp app, Activity ctx, IOConnectionInfo ioc, OnFinish finish, bool dontSave, CompositeKey key, bool makeCurrent)
|
public CreateDb(IKp2aApp app, Activity ctx, IOConnectionInfo ioc, OnOperationFinishedHandler operationFinishedHandler, bool dontSave, CompositeKey key, bool makeCurrent)
|
||||||
: base(ctx, finish)
|
: base(ctx, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
_ioc = ioc;
|
_ioc = ioc;
|
||||||
@@ -87,9 +87,9 @@ namespace keepass2android
|
|||||||
addTemplates.AddTemplates(out addedEntries);
|
addTemplates.AddTemplates(out addedEntries);
|
||||||
|
|
||||||
// Commit changes
|
// Commit changes
|
||||||
SaveDb save = new SaveDb(_ctx, _app, db, OnFinishToRun, _dontSave);
|
SaveDb save = new SaveDb(_ctx, _app, db, operationFinishedHandler, _dontSave);
|
||||||
save.SetStatusLogger(StatusLogger);
|
save.SetStatusLogger(StatusLogger);
|
||||||
_onFinishToRun = null;
|
_operationFinishedHandler = null;
|
||||||
save.Run();
|
save.Run();
|
||||||
|
|
||||||
db.UpdateGlobals();
|
db.UpdateGlobals();
|
||||||
|
@@ -29,7 +29,7 @@ namespace keepass2android
|
|||||||
private readonly PwEntry _entry;
|
private readonly PwEntry _entry;
|
||||||
private UiStringKey _statusMessage;
|
private UiStringKey _statusMessage;
|
||||||
|
|
||||||
public DeleteEntry(Activity activiy, IKp2aApp app, PwEntry entry, OnFinish finish):base(activiy, finish, app) {
|
public DeleteEntry(Activity activiy, IKp2aApp app, PwEntry entry, OnOperationFinishedHandler operationFinishedHandler):base(activiy, operationFinishedHandler, app) {
|
||||||
Ctx = activiy;
|
Ctx = activiy;
|
||||||
Db = app.FindDatabaseForElement(entry);
|
Db = app.FindDatabaseForElement(entry);
|
||||||
_entry = entry;
|
_entry = entry;
|
||||||
|
@@ -29,19 +29,19 @@ namespace keepass2android
|
|||||||
private PwGroup _group;
|
private PwGroup _group;
|
||||||
protected bool DontSave;
|
protected bool DontSave;
|
||||||
|
|
||||||
public DeleteGroup(Activity activity, IKp2aApp app, PwGroup group, OnFinish finish)
|
public DeleteGroup(Activity activity, IKp2aApp app, PwGroup group, OnOperationFinishedHandler operationFinishedHandler)
|
||||||
: base(activity, finish, app)
|
: base(activity, operationFinishedHandler, app)
|
||||||
{
|
{
|
||||||
SetMembers(activity, app, group, false);
|
SetMembers(activity, app, group, false);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
public DeleteGroup(Context ctx, Database db, PwGroup group, Activity act, OnFinish finish, bool dontSave)
|
public DeleteGroup(Context ctx, Database db, PwGroup group, Activity act, OnOperationFinishedHandler operationFinishedHandler, bool dontSave)
|
||||||
: base(finish)
|
: base(operationFinishedHandler)
|
||||||
{
|
{
|
||||||
SetMembers(ctx, db, group, act, dontSave);
|
SetMembers(ctx, db, group, act, dontSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeleteGroup(Context ctx, Database db, PwGroup group, OnFinish finish, bool dontSave):base(finish) {
|
public DeleteGroup(Context ctx, Database db, PwGroup group, OnOperationFinishedHandler operationFinishedHandler, bool dontSave):base(operationFinishedHandler) {
|
||||||
SetMembers(ctx, db, group, null, dontSave);
|
SetMembers(ctx, db, group, null, dontSave);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@@ -12,8 +12,8 @@ namespace keepass2android
|
|||||||
private readonly List<IStructureItem> _elementsToDelete;
|
private readonly List<IStructureItem> _elementsToDelete;
|
||||||
private readonly bool _canRecycle;
|
private readonly bool _canRecycle;
|
||||||
|
|
||||||
public DeleteMultipleItemsFromOneDatabase(Activity activity, Database db, List<IStructureItem> elementsToDelete, OnFinish finish, IKp2aApp app)
|
public DeleteMultipleItemsFromOneDatabase(Activity activity, Database db, List<IStructureItem> elementsToDelete, OnOperationFinishedHandler operationFinishedHandler, IKp2aApp app)
|
||||||
: base(activity, finish, app)
|
: base(activity, operationFinishedHandler, app)
|
||||||
{
|
{
|
||||||
_elementsToDelete = elementsToDelete;
|
_elementsToDelete = elementsToDelete;
|
||||||
SetMembers(activity, db);
|
SetMembers(activity, db);
|
||||||
|
@@ -8,8 +8,8 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
public abstract class DeleteRunnable : RunnableOnFinish
|
public abstract class DeleteRunnable : RunnableOnFinish
|
||||||
{
|
{
|
||||||
protected DeleteRunnable(Activity activity, OnFinish finish, IKp2aApp app)
|
protected DeleteRunnable(Activity activity, OnOperationFinishedHandler operationFinishedHandler, IKp2aApp app)
|
||||||
: base(activity, finish)
|
: base(activity, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
App = app;
|
App = app;
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ namespace keepass2android
|
|||||||
Android.Util.Log.Debug("KP2A", "Calling PerformDelete..");
|
Android.Util.Log.Debug("KP2A", "Calling PerformDelete..");
|
||||||
PerformDelete(touchedGroups, permanentlyDeletedGroups);
|
PerformDelete(touchedGroups, permanentlyDeletedGroups);
|
||||||
|
|
||||||
_onFinishToRun = new ActionOnFinish(ActiveActivity,(success, message, activity) =>
|
_operationFinishedHandler = new ActionOnOperationFinished(ActiveActivity,(success, message, activity) =>
|
||||||
{
|
{
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
@@ -236,10 +236,10 @@ namespace keepass2android
|
|||||||
// Let's not bother recovering from a failure to save. It is too much work.
|
// Let's not bother recovering from a failure to save. It is too much work.
|
||||||
App.Lock(false, false);
|
App.Lock(false, false);
|
||||||
}
|
}
|
||||||
}, OnFinishToRun);
|
}, operationFinishedHandler);
|
||||||
|
|
||||||
// Commit database
|
// Commit database
|
||||||
SaveDb save = new SaveDb(Ctx, App, Db, OnFinishToRun, false);
|
SaveDb save = new SaveDb(Ctx, App, Db, operationFinishedHandler, false);
|
||||||
save.ShowDatabaseIocInStatus = ShowDatabaseIocInStatus;
|
save.ShowDatabaseIocInStatus = ShowDatabaseIocInStatus;
|
||||||
|
|
||||||
save.SetStatusLogger(StatusLogger);
|
save.SetStatusLogger(StatusLogger);
|
||||||
|
@@ -38,8 +38,8 @@ namespace keepass2android
|
|||||||
internal PwGroup Group;
|
internal PwGroup Group;
|
||||||
readonly Activity _ctx;
|
readonly Activity _ctx;
|
||||||
|
|
||||||
public EditGroup(Activity ctx, IKp2aApp app, String name, PwIcon iconid, PwUuid customIconId, PwGroup group, OnFinish finish)
|
public EditGroup(Activity ctx, IKp2aApp app, String name, PwIcon iconid, PwUuid customIconId, PwGroup group, OnOperationFinishedHandler operationFinishedHandler)
|
||||||
: base(ctx, finish)
|
: base(ctx, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
_name = name;
|
_name = name;
|
||||||
@@ -48,7 +48,7 @@ namespace keepass2android
|
|||||||
_customIconId = customIconId;
|
_customIconId = customIconId;
|
||||||
_app = app;
|
_app = app;
|
||||||
|
|
||||||
_onFinishToRun = new AfterEdit(ctx, this, OnFinishToRun);
|
_operationFinishedHandler = new AfterEdit(ctx, this, operationFinishedHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -60,16 +60,16 @@ namespace keepass2android
|
|||||||
Group.Touch(true);
|
Group.Touch(true);
|
||||||
|
|
||||||
// Commit to disk
|
// Commit to disk
|
||||||
SaveDb save = new SaveDb(_ctx, _app, Db, OnFinishToRun);
|
SaveDb save = new SaveDb(_ctx, _app, Db, operationFinishedHandler);
|
||||||
save.SetStatusLogger(StatusLogger);
|
save.SetStatusLogger(StatusLogger);
|
||||||
save.Run();
|
save.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AfterEdit : OnFinish {
|
private class AfterEdit : OnOperationFinishedHandler {
|
||||||
readonly EditGroup _editGroup;
|
readonly EditGroup _editGroup;
|
||||||
|
|
||||||
public AfterEdit(Activity ctx, EditGroup editGroup, OnFinish finish)
|
public AfterEdit(Activity ctx, EditGroup editGroup, OnOperationFinishedHandler operationFinishedHandler)
|
||||||
: base(ctx, finish)
|
: base(ctx, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_editGroup = editGroup;
|
_editGroup = editGroup;
|
||||||
}
|
}
|
||||||
|
@@ -21,10 +21,10 @@ using Android.App;
|
|||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
|
|
||||||
public abstract class FileOnFinish : OnFinish {
|
public abstract class FileOnFinish : OnOperationFinishedHandler {
|
||||||
private String _filename = "";
|
private String _filename = "";
|
||||||
|
|
||||||
protected FileOnFinish(Activity activity, FileOnFinish finish):base(activity, finish) {
|
protected FileOnFinish(Activity activity, FileOnFinish operationFinishedHandler):base(activity, operationFinishedHandler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Filename
|
public string Filename
|
||||||
|
@@ -38,7 +38,7 @@ namespace keepass2android
|
|||||||
private readonly bool _rememberKeyfile;
|
private readonly bool _rememberKeyfile;
|
||||||
IDatabaseFormat _format;
|
IDatabaseFormat _format;
|
||||||
|
|
||||||
public LoadDb(Activity activity, IKp2aApp app, IOConnectionInfo ioc, Task<MemoryStream> databaseData, CompositeKey compositeKey, String keyfileOrProvider, OnFinish finish, bool updateLastUsageTimestamp, bool makeCurrent): base(activity, finish)
|
public LoadDb(Activity activity, IKp2aApp app, IOConnectionInfo ioc, Task<MemoryStream> databaseData, CompositeKey compositeKey, String keyfileOrProvider, OnOperationFinishedHandler operationFinishedHandler, bool updateLastUsageTimestamp, bool makeCurrent): base(activity, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_app = app;
|
_app = app;
|
||||||
_ioc = ioc;
|
_ioc = ioc;
|
||||||
|
@@ -17,7 +17,7 @@ namespace keepass2android.database.edit
|
|||||||
private readonly Activity _ctx;
|
private readonly Activity _ctx;
|
||||||
private readonly IKp2aApp _app;
|
private readonly IKp2aApp _app;
|
||||||
|
|
||||||
public MoveElements(List<IStructureItem> elementsToMove, PwGroup targetGroup, Activity ctx, IKp2aApp app, OnFinish finish) : base(ctx, finish)
|
public MoveElements(List<IStructureItem> elementsToMove, PwGroup targetGroup, Activity ctx, IKp2aApp app, OnOperationFinishedHandler operationFinishedHandler) : base(ctx, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_elementsToMove = elementsToMove;
|
_elementsToMove = elementsToMove;
|
||||||
_targetGroup = targetGroup;
|
_targetGroup = targetGroup;
|
||||||
@@ -129,18 +129,18 @@ namespace keepass2android.database.edit
|
|||||||
indexToSave++;
|
indexToSave++;
|
||||||
if (indexToSave == allDatabasesToSave.Count)
|
if (indexToSave == allDatabasesToSave.Count)
|
||||||
{
|
{
|
||||||
OnFinishToRun.SetResult(allSavesSuccess);
|
operationFinishedHandler.SetResult(allSavesSuccess);
|
||||||
OnFinishToRun.Run();
|
operationFinishedHandler.Run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SaveDb saveDb = new SaveDb(_ctx, _app, allDatabasesToSave[indexToSave], new ActionOnFinish(activeActivity, ContinueSave), false);
|
SaveDb saveDb = new SaveDb(_ctx, _app, allDatabasesToSave[indexToSave], new ActionOnOperationFinished(activeActivity, ContinueSave), false);
|
||||||
saveDb.SetStatusLogger(StatusLogger);
|
saveDb.SetStatusLogger(StatusLogger);
|
||||||
saveDb.ShowDatabaseIocInStatus = allDatabasesToSave.Count > 1;
|
saveDb.ShowDatabaseIocInStatus = allDatabasesToSave.Count > 1;
|
||||||
saveDb.Run();
|
saveDb.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SaveDb save = new SaveDb(_ctx, _app, allDatabasesToSave[0], new ActionOnFinish(ActiveActivity, ContinueSave), false);
|
SaveDb save = new SaveDb(_ctx, _app, allDatabasesToSave[0], new ActionOnOperationFinished(ActiveActivity, ContinueSave), false);
|
||||||
save.SetStatusLogger(StatusLogger);
|
save.SetStatusLogger(StatusLogger);
|
||||||
save.ShowDatabaseIocInStatus = allDatabasesToSave.Count > 1;
|
save.ShowDatabaseIocInStatus = allDatabasesToSave.Count > 1;
|
||||||
save.Run();
|
save.Run();
|
||||||
|
@@ -25,7 +25,7 @@ using Google.Android.Material.Dialog;
|
|||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
public abstract class OnFinish
|
public abstract class OnOperationFinishedHandler
|
||||||
{
|
{
|
||||||
protected bool Success;
|
protected bool Success;
|
||||||
protected String Message;
|
protected String Message;
|
||||||
@@ -37,7 +37,7 @@ namespace keepass2android
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected OnFinish BaseOnFinish;
|
protected OnOperationFinishedHandler NextOnOperationFinishedHandler;
|
||||||
protected Handler Handler;
|
protected Handler Handler;
|
||||||
private ProgressDialogStatusLogger _statusLogger = new ProgressDialogStatusLogger(); //default: no logging but not null -> can be used whenever desired
|
private ProgressDialogStatusLogger _statusLogger = new ProgressDialogStatusLogger(); //default: no logging but not null -> can be used whenever desired
|
||||||
private Activity _activeActivity, _previouslyActiveActivity;
|
private Activity _activeActivity, _previouslyActiveActivity;
|
||||||
@@ -60,9 +60,9 @@ namespace keepass2android
|
|||||||
|
|
||||||
}
|
}
|
||||||
_activeActivity = value;
|
_activeActivity = value;
|
||||||
if (BaseOnFinish != null)
|
if (NextOnOperationFinishedHandler != null)
|
||||||
{
|
{
|
||||||
BaseOnFinish.ActiveActivity = value;
|
NextOnOperationFinishedHandler.ActiveActivity = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,25 +75,25 @@ namespace keepass2android
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected OnFinish(Activity activeActivity, Handler handler)
|
protected OnOperationFinishedHandler(Activity activeActivity, Handler handler)
|
||||||
{
|
{
|
||||||
ActiveActivity = activeActivity;
|
ActiveActivity = activeActivity;
|
||||||
BaseOnFinish = null;
|
NextOnOperationFinishedHandler = null;
|
||||||
Handler = handler;
|
Handler = handler;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected OnFinish(Activity activeActivity, OnFinish finish, Handler handler)
|
protected OnOperationFinishedHandler(Activity activeActivity, OnOperationFinishedHandler operationFinishedHandler, Handler handler)
|
||||||
{
|
{
|
||||||
ActiveActivity = activeActivity;
|
ActiveActivity = activeActivity;
|
||||||
BaseOnFinish = finish;
|
NextOnOperationFinishedHandler = operationFinishedHandler;
|
||||||
Handler = handler;
|
Handler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected OnFinish(Activity activeActivity, OnFinish finish)
|
protected OnOperationFinishedHandler(Activity activeActivity, OnOperationFinishedHandler operationFinishedHandler)
|
||||||
{
|
{
|
||||||
ActiveActivity = activeActivity;
|
ActiveActivity = activeActivity;
|
||||||
BaseOnFinish = finish;
|
NextOnOperationFinishedHandler = operationFinishedHandler;
|
||||||
Handler = null;
|
Handler = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,14 +110,14 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Run() {
|
public virtual void Run() {
|
||||||
if (BaseOnFinish == null) return;
|
if (NextOnOperationFinishedHandler == null) return;
|
||||||
// Pass on result on call finish
|
// Pass on result on call finish
|
||||||
BaseOnFinish.SetResult(Success, Message, ImportantMessage, Exception);
|
NextOnOperationFinishedHandler.SetResult(Success, Message, ImportantMessage, Exception);
|
||||||
|
|
||||||
if ( Handler != null ) {
|
if ( Handler != null ) {
|
||||||
Handler.Post(BaseOnFinish.Run);
|
Handler.Post(NextOnOperationFinishedHandler.Run);
|
||||||
} else {
|
} else {
|
||||||
BaseOnFinish.Run();
|
NextOnOperationFinishedHandler.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ namespace keepass2android
|
|||||||
public static void DisplayMessage(Context ctx, string message, bool makeDialog)
|
public static void DisplayMessage(Context ctx, string message, bool makeDialog)
|
||||||
{
|
{
|
||||||
if ( !String.IsNullOrEmpty(message) ) {
|
if ( !String.IsNullOrEmpty(message) ) {
|
||||||
Kp2aLog.Log("OnFinish message: " + message);
|
Kp2aLog.Log("OnOperationFinishedHandler message: " + message);
|
||||||
if (makeDialog && ctx != null)
|
if (makeDialog && ctx != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
@@ -23,20 +23,20 @@ namespace keepass2android
|
|||||||
|
|
||||||
public abstract class RunnableOnFinish {
|
public abstract class RunnableOnFinish {
|
||||||
|
|
||||||
protected OnFinish _onFinishToRun;
|
protected OnOperationFinishedHandler _operationFinishedHandler;
|
||||||
public ProgressDialogStatusLogger StatusLogger = new ProgressDialogStatusLogger(); //default: empty but not null
|
public ProgressDialogStatusLogger StatusLogger = new ProgressDialogStatusLogger(); //default: empty but not null
|
||||||
private Activity _activeActivity;
|
private Activity _activeActivity;
|
||||||
|
|
||||||
protected RunnableOnFinish(Activity activeActivity, OnFinish finish)
|
protected RunnableOnFinish(Activity activeActivity, OnOperationFinishedHandler operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_activeActivity = activeActivity;
|
_activeActivity = activeActivity;
|
||||||
_onFinishToRun = finish;
|
_operationFinishedHandler = operationFinishedHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnFinish OnFinishToRun
|
public OnOperationFinishedHandler operationFinishedHandler
|
||||||
{
|
{
|
||||||
get { return _onFinishToRun; }
|
get { return _operationFinishedHandler; }
|
||||||
set { _onFinishToRun = value; }
|
set { _operationFinishedHandler = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Activity ActiveActivity
|
public Activity ActiveActivity
|
||||||
@@ -45,29 +45,29 @@ namespace keepass2android
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_activeActivity = value;
|
_activeActivity = value;
|
||||||
if (_onFinishToRun != null)
|
if (_operationFinishedHandler != null)
|
||||||
_onFinishToRun.ActiveActivity = _activeActivity;
|
_operationFinishedHandler.ActiveActivity = _activeActivity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Finish(bool result, String message, bool importantMessage = false, Exception exception = null) {
|
protected void Finish(bool result, String message, bool importantMessage = false, Exception exception = null) {
|
||||||
if ( OnFinishToRun != null ) {
|
if ( operationFinishedHandler != null ) {
|
||||||
OnFinishToRun.SetResult(result, message, importantMessage, exception);
|
operationFinishedHandler.SetResult(result, message, importantMessage, exception);
|
||||||
OnFinishToRun.Run();
|
operationFinishedHandler.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Finish(bool result) {
|
protected void Finish(bool result) {
|
||||||
if ( OnFinishToRun != null ) {
|
if ( operationFinishedHandler != null ) {
|
||||||
OnFinishToRun.SetResult(result);
|
operationFinishedHandler.SetResult(result);
|
||||||
OnFinishToRun.Run();
|
operationFinishedHandler.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetStatusLogger(ProgressDialogStatusLogger status) {
|
public void SetStatusLogger(ProgressDialogStatusLogger status) {
|
||||||
if (OnFinishToRun != null)
|
if (operationFinishedHandler != null)
|
||||||
{
|
{
|
||||||
OnFinishToRun.StatusLogger = status;
|
operationFinishedHandler.StatusLogger = status;
|
||||||
}
|
}
|
||||||
StatusLogger = status;
|
StatusLogger = status;
|
||||||
}
|
}
|
||||||
|
@@ -46,8 +46,8 @@ namespace keepass2android
|
|||||||
private readonly Context _ctx;
|
private readonly Context _ctx;
|
||||||
private Java.Lang.Thread _workerThread;
|
private Java.Lang.Thread _workerThread;
|
||||||
|
|
||||||
public SaveDb(Activity ctx, IKp2aApp app, Database db, OnFinish finish, bool dontSave)
|
public SaveDb(Activity ctx, IKp2aApp app, Database db, OnOperationFinishedHandler operationFinishedHandler, bool dontSave)
|
||||||
: base(ctx, finish)
|
: base(ctx, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_db = db;
|
_db = db;
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
@@ -60,11 +60,11 @@ namespace keepass2android
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ctx"></param>
|
/// <param name="ctx"></param>
|
||||||
/// <param name="app"></param>
|
/// <param name="app"></param>
|
||||||
/// <param name="finish"></param>
|
/// <param name="operationFinishedHandler"></param>
|
||||||
/// <param name="dontSave"></param>
|
/// <param name="dontSave"></param>
|
||||||
/// <param name="streamForOrigFile">Stream for reading the data from the (changed) original location</param>
|
/// <param name="streamForOrigFile">Stream for reading the data from the (changed) original location</param>
|
||||||
public SaveDb(Activity ctx, IKp2aApp app, OnFinish finish, Database db, bool dontSave, Stream streamForOrigFile)
|
public SaveDb(Activity ctx, IKp2aApp app, OnOperationFinishedHandler operationFinishedHandler, Database db, bool dontSave, Stream streamForOrigFile)
|
||||||
: base(ctx, finish)
|
: base(ctx, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_db = db;
|
_db = db;
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
@@ -73,8 +73,8 @@ namespace keepass2android
|
|||||||
_streamForOrigFile = streamForOrigFile;
|
_streamForOrigFile = streamForOrigFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SaveDb(Activity ctx, IKp2aApp app, Database db, OnFinish finish)
|
public SaveDb(Activity ctx, IKp2aApp app, Database db, OnOperationFinishedHandler operationFinishedHandler)
|
||||||
: base(ctx, finish)
|
: base(ctx, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
_app = app;
|
_app = app;
|
||||||
|
@@ -30,7 +30,7 @@ namespace keepass2android
|
|||||||
private readonly bool _dontSave;
|
private readonly bool _dontSave;
|
||||||
private readonly Activity _ctx;
|
private readonly Activity _ctx;
|
||||||
|
|
||||||
public SetPassword(Activity ctx, IKp2aApp app, String password, String keyfile, OnFinish finish): base(ctx, finish) {
|
public SetPassword(Activity ctx, IKp2aApp app, String password, String keyfile, OnOperationFinishedHandler operationFinishedHandler): base(ctx, operationFinishedHandler) {
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
_app = app;
|
_app = app;
|
||||||
_password = password;
|
_password = password;
|
||||||
@@ -38,8 +38,8 @@ namespace keepass2android
|
|||||||
_dontSave = false;
|
_dontSave = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SetPassword(Activity ctx, IKp2aApp app, String password, String keyfile, OnFinish finish, bool dontSave)
|
public SetPassword(Activity ctx, IKp2aApp app, String password, String keyfile, OnOperationFinishedHandler operationFinishedHandler, bool dontSave)
|
||||||
: base(ctx, finish)
|
: base(ctx, operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
_app = app;
|
_app = app;
|
||||||
@@ -73,18 +73,18 @@ namespace keepass2android
|
|||||||
pm.MasterKey = newKey;
|
pm.MasterKey = newKey;
|
||||||
|
|
||||||
// Save Database
|
// Save Database
|
||||||
_onFinishToRun = new AfterSave(ActiveActivity, previousKey, previousMasterKeyChanged, pm, OnFinishToRun);
|
_operationFinishedHandler = new AfterSave(ActiveActivity, previousKey, previousMasterKeyChanged, pm, operationFinishedHandler);
|
||||||
SaveDb save = new SaveDb(_ctx, _app, _app.CurrentDb, OnFinishToRun, _dontSave);
|
SaveDb save = new SaveDb(_ctx, _app, _app.CurrentDb, operationFinishedHandler, _dontSave);
|
||||||
save.SetStatusLogger(StatusLogger);
|
save.SetStatusLogger(StatusLogger);
|
||||||
save.Run();
|
save.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AfterSave : OnFinish {
|
private class AfterSave : OnOperationFinishedHandler {
|
||||||
private readonly CompositeKey _backup;
|
private readonly CompositeKey _backup;
|
||||||
private readonly DateTime _previousKeyChanged;
|
private readonly DateTime _previousKeyChanged;
|
||||||
private readonly PwDatabase _db;
|
private readonly PwDatabase _db;
|
||||||
|
|
||||||
public AfterSave(Activity activity, CompositeKey backup, DateTime previousKeyChanged, PwDatabase db, OnFinish finish): base(activity, finish) {
|
public AfterSave(Activity activity, CompositeKey backup, DateTime previousKeyChanged, PwDatabase db, OnOperationFinishedHandler operationFinishedHandler): base(activity, operationFinishedHandler) {
|
||||||
_previousKeyChanged = previousKeyChanged;
|
_previousKeyChanged = previousKeyChanged;
|
||||||
_backup = backup;
|
_backup = backup;
|
||||||
_db = db;
|
_db = db;
|
||||||
|
@@ -26,27 +26,27 @@ namespace keepass2android
|
|||||||
private readonly IKp2aApp _app;
|
private readonly IKp2aApp _app;
|
||||||
private readonly Activity _ctx;
|
private readonly Activity _ctx;
|
||||||
|
|
||||||
public UpdateEntry(Activity ctx, IKp2aApp app, PwEntry oldE, PwEntry newE, OnFinish finish):base(ctx, finish) {
|
public UpdateEntry(Activity ctx, IKp2aApp app, PwEntry oldE, PwEntry newE, OnOperationFinishedHandler operationFinishedHandler):base(ctx, operationFinishedHandler) {
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
_app = app;
|
_app = app;
|
||||||
|
|
||||||
_onFinishToRun = new AfterUpdate(ctx, oldE, newE, app, finish);
|
_operationFinishedHandler = new AfterUpdate(ctx, oldE, newE, app, operationFinishedHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void Run() {
|
public override void Run() {
|
||||||
// Commit to disk
|
// Commit to disk
|
||||||
SaveDb save = new SaveDb(_ctx, _app, _app.CurrentDb, OnFinishToRun);
|
SaveDb save = new SaveDb(_ctx, _app, _app.CurrentDb, operationFinishedHandler);
|
||||||
save.SetStatusLogger(StatusLogger);
|
save.SetStatusLogger(StatusLogger);
|
||||||
save.Run();
|
save.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AfterUpdate : OnFinish {
|
private class AfterUpdate : OnOperationFinishedHandler {
|
||||||
private readonly PwEntry _backup;
|
private readonly PwEntry _backup;
|
||||||
private readonly PwEntry _updatedEntry;
|
private readonly PwEntry _updatedEntry;
|
||||||
private readonly IKp2aApp _app;
|
private readonly IKp2aApp _app;
|
||||||
|
|
||||||
public AfterUpdate(Activity activity, PwEntry backup, PwEntry updatedEntry, IKp2aApp app, OnFinish finish):base(activity, finish) {
|
public AfterUpdate(Activity activity, PwEntry backup, PwEntry updatedEntry, IKp2aApp app, OnOperationFinishedHandler operationFinishedHandler):base(activity, operationFinishedHandler) {
|
||||||
_backup = backup;
|
_backup = backup;
|
||||||
_updatedEntry = updatedEntry;
|
_updatedEntry = updatedEntry;
|
||||||
_app = app;
|
_app = app;
|
||||||
|
@@ -228,7 +228,7 @@ namespace keepass2android
|
|||||||
newEntry.SetUuid(new PwUuid(true), true); // Create new UUID
|
newEntry.SetUuid(new PwUuid(true), true); // Create new UUID
|
||||||
string strTitle = newEntry.Strings.ReadSafe(PwDefs.TitleField);
|
string strTitle = newEntry.Strings.ReadSafe(PwDefs.TitleField);
|
||||||
newEntry.Strings.Set(PwDefs.TitleField, new ProtectedString(false, strTitle + " (" + Android.OS.Build.Model + ")"));
|
newEntry.Strings.Set(PwDefs.TitleField, new ProtectedString(false, strTitle + " (" + Android.OS.Build.Model + ")"));
|
||||||
var addTask = new AddEntry(this, App.Kp2a.CurrentDb, App.Kp2a, newEntry,item.Entry.ParentGroup,new ActionOnFinish(this, (success, message, activity) => ((ConfigureChildDatabasesActivity)activity).Update()));
|
var addTask = new AddEntry(this, App.Kp2a.CurrentDb, App.Kp2a, newEntry,item.Entry.ParentGroup,new ActionOnOperationFinished(this, (success, message, activity) => ((ConfigureChildDatabasesActivity)activity).Update()));
|
||||||
|
|
||||||
ProgressTask pt = new ProgressTask(App.Kp2a, this, addTask);
|
ProgressTask pt = new ProgressTask(App.Kp2a, this, addTask);
|
||||||
pt.Run();
|
pt.Run();
|
||||||
@@ -260,7 +260,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
private void Save(AutoExecItem item)
|
private void Save(AutoExecItem item)
|
||||||
{
|
{
|
||||||
var addTask = new SaveDb(this, App.Kp2a, App.Kp2a.FindDatabaseForElement(item.Entry), new ActionOnFinish(this, (success, message, activity) => ((ConfigureChildDatabasesActivity)activity).Update()));
|
var addTask = new SaveDb(this, App.Kp2a, App.Kp2a.FindDatabaseForElement(item.Entry), new ActionOnOperationFinished(this, (success, message, activity) => ((ConfigureChildDatabasesActivity)activity).Update()));
|
||||||
|
|
||||||
ProgressTask pt = new ProgressTask(App.Kp2a, this, addTask);
|
ProgressTask pt = new ProgressTask(App.Kp2a, this, addTask);
|
||||||
pt.Run();
|
pt.Run();
|
||||||
@@ -367,7 +367,7 @@ namespace keepass2android
|
|||||||
{KeeAutoExecExt.ThisDeviceId, true}
|
{KeeAutoExecExt.ThisDeviceId, true}
|
||||||
})));
|
})));
|
||||||
|
|
||||||
var addTask = new AddEntry(this, db, App.Kp2a, newEntry, autoOpenGroup, new ActionOnFinish(this, (success, message, activity) => (activity as ConfigureChildDatabasesActivity)?.Update()));
|
var addTask = new AddEntry(this, db, App.Kp2a, newEntry, autoOpenGroup, new ActionOnOperationFinished(this, (success, message, activity) => (activity as ConfigureChildDatabasesActivity)?.Update()));
|
||||||
|
|
||||||
ProgressTask pt = new ProgressTask(App.Kp2a, this, addTask);
|
ProgressTask pt = new ProgressTask(App.Kp2a, this, addTask);
|
||||||
pt.Run();
|
pt.Run();
|
||||||
|
@@ -8,8 +8,8 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
private readonly string _filename;
|
private readonly string _filename;
|
||||||
|
|
||||||
public CreateNewFilename(Activity activity, OnFinish finish, string filename)
|
public CreateNewFilename(Activity activity, OnOperationFinishedHandler operationFinishedHandler, string filename)
|
||||||
: base(activity,finish)
|
: base(activity,operationFinishedHandler)
|
||||||
{
|
{
|
||||||
_filename = filename;
|
_filename = filename;
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
protected override void SaveFile(IOConnectionInfo ioc)
|
protected override void SaveFile(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
var task = new EntryActivity.WriteBinaryTask(_activity, App.Kp2a, new ActionOnFinish(_activity, (success, message, activity) =>
|
var task = new EntryActivity.WriteBinaryTask(_activity, App.Kp2a, new ActionOnOperationFinished(_activity, (success, message, activity) =>
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success)
|
||||||
App.Kp2a.ShowMessage(activity, message, MessageSeverity.Error);
|
App.Kp2a.ShowMessage(activity, message, MessageSeverity.Error);
|
||||||
@@ -525,7 +525,7 @@ namespace keepass2android
|
|||||||
App.Kp2a.DirtyGroups.Add(parent);
|
App.Kp2a.DirtyGroups.Add(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
var saveTask = new SaveDb(this, App.Kp2a, App.Kp2a.FindDatabaseForElement(Entry), new ActionOnFinish(this, (success, message, activity) =>
|
var saveTask = new SaveDb(this, App.Kp2a, App.Kp2a.FindDatabaseForElement(Entry), new ActionOnOperationFinished(this, (success, message, activity) =>
|
||||||
{
|
{
|
||||||
activity.SetResult(KeePass.ExitRefresh);
|
activity.SetResult(KeePass.ExitRefresh);
|
||||||
activity.Finish();
|
activity.Finish();
|
||||||
@@ -1266,7 +1266,7 @@ namespace keepass2android
|
|||||||
private readonly ProtectedBinary _data;
|
private readonly ProtectedBinary _data;
|
||||||
private IOConnectionInfo _targetIoc;
|
private IOConnectionInfo _targetIoc;
|
||||||
|
|
||||||
public WriteBinaryTask(Activity activity, IKp2aApp app, OnFinish onFinish, ProtectedBinary data, IOConnectionInfo targetIoc) : base(activity, onFinish)
|
public WriteBinaryTask(Activity activity, IKp2aApp app, OnOperationFinishedHandler onOperationFinishedHandler, ProtectedBinary data, IOConnectionInfo targetIoc) : base(activity, onOperationFinishedHandler)
|
||||||
{
|
{
|
||||||
_app = app;
|
_app = app;
|
||||||
_data = data;
|
_data = data;
|
||||||
@@ -1441,7 +1441,7 @@ namespace keepass2android
|
|||||||
return true;
|
return true;
|
||||||
case Resource.Id.menu_delete:
|
case Resource.Id.menu_delete:
|
||||||
DeleteEntry task = new DeleteEntry(this, App.Kp2a, Entry,
|
DeleteEntry task = new DeleteEntry(this, App.Kp2a, Entry,
|
||||||
new ActionOnFinish(this, (success, message, activity) => { if (success) { RequiresRefresh(); Finish();}}));
|
new ActionOnOperationFinished(this, (success, message, activity) => { if (success) { RequiresRefresh(); Finish();}}));
|
||||||
task.Start();
|
task.Start();
|
||||||
break;
|
break;
|
||||||
case Resource.Id.menu_toggle_pass:
|
case Resource.Id.menu_toggle_pass:
|
||||||
@@ -1504,9 +1504,9 @@ namespace keepass2android
|
|||||||
|
|
||||||
//save the entry:
|
//save the entry:
|
||||||
|
|
||||||
ActionOnFinish closeOrShowError = new ActionOnFinish(this, (success, message, activity) =>
|
ActionOnOperationFinished closeOrShowError = new ActionOnOperationFinished(this, (success, message, activity) =>
|
||||||
{
|
{
|
||||||
OnFinish.DisplayMessage(this, message, true);
|
OnOperationFinishedHandler.DisplayMessage(this, message, true);
|
||||||
finishAction((EntryActivity)activity);
|
finishAction((EntryActivity)activity);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -521,22 +521,22 @@ namespace keepass2android
|
|||||||
|
|
||||||
RunnableOnFinish runnable;
|
RunnableOnFinish runnable;
|
||||||
|
|
||||||
ActionOnFinish closeOrShowError = new ActionOnFinish(this, (success, message, activity) => {
|
ActionOnOperationFinished closeOrShowError = new ActionOnOperationFinished(this, (success, message, activity) => {
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
activity?.Finish();
|
activity?.Finish();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
OnFinish.DisplayMessage(activity, message, true);
|
OnOperationFinishedHandler.DisplayMessage(activity, message, true);
|
||||||
//Re-initialize for editing:
|
//Re-initialize for editing:
|
||||||
State.EditMode.InitializeEntry(State.Entry);
|
State.EditMode.InitializeEntry(State.Entry);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//make sure we can close the EntryEditActivity activity even if the app went to background till we get to the OnFinish Action
|
//make sure we can close the EntryEditActivity activity even if the app went to background till we get to the OnOperationFinishedHandler Action
|
||||||
closeOrShowError.AllowInactiveActivity = true;
|
closeOrShowError.AllowInactiveActivity = true;
|
||||||
|
|
||||||
|
|
||||||
ActionOnFinish afterAddEntry = new ActionOnFinish(this, (success, message, activity) =>
|
ActionOnOperationFinished afterAddEntry = new ActionOnOperationFinished(this, (success, message, activity) =>
|
||||||
{
|
{
|
||||||
if (success && activity is EntryEditActivity entryEditActivity)
|
if (success && activity is EntryEditActivity entryEditActivity)
|
||||||
AppTask.AfterAddNewEntry(entryEditActivity, newEntry);
|
AppTask.AfterAddNewEntry(entryEditActivity, newEntry);
|
||||||
|
@@ -26,7 +26,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
protected override void SaveFile(IOConnectionInfo ioc)
|
protected override void SaveFile(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
var exportDb = new ExportDatabaseActivity.ExportDb(_activity, App.Kp2a, new ActionOnFinish(_activity, (success, message, activity) =>
|
var exportDb = new ExportDatabaseActivity.ExportDb(_activity, App.Kp2a, new ActionOnOperationFinished(_activity, (success, message, activity) =>
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success)
|
||||||
App.Kp2a.ShowMessage(activity, message, MessageSeverity.Error);
|
App.Kp2a.ShowMessage(activity, message, MessageSeverity.Error);
|
||||||
@@ -99,7 +99,7 @@ namespace keepass2android
|
|||||||
private readonly FileFormatProvider _fileFormat;
|
private readonly FileFormatProvider _fileFormat;
|
||||||
private IOConnectionInfo _targetIoc;
|
private IOConnectionInfo _targetIoc;
|
||||||
|
|
||||||
public ExportDb(Activity activity, IKp2aApp app, OnFinish onFinish, FileFormatProvider fileFormat, IOConnectionInfo targetIoc) : base(activity, onFinish)
|
public ExportDb(Activity activity, IKp2aApp app, OnOperationFinishedHandler onOperationFinishedHandler, FileFormatProvider fileFormat, IOConnectionInfo targetIoc) : base(activity, onOperationFinishedHandler)
|
||||||
{
|
{
|
||||||
_app = app;
|
_app = app;
|
||||||
this._fileFormat = fileFormat;
|
this._fileFormat = fileFormat;
|
||||||
|
@@ -103,7 +103,7 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var task = new CreateNewFilename(_activity, new ActionOnFinish(_activity, (success, messageOrFilename, activity) =>
|
var task = new CreateNewFilename(_activity, new ActionOnOperationFinished(_activity, (success, messageOrFilename, activity) =>
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
@@ -781,7 +781,7 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var task = new CreateNewFilename(activity, new ActionOnFinish(activity, (success, messageOrFilename, newActivity) =>
|
var task = new CreateNewFilename(activity, new ActionOnOperationFinished(activity, (success, messageOrFilename, newActivity) =>
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
@@ -224,7 +224,7 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
//yes
|
//yes
|
||||||
ProgressTask pt = new ProgressTask(App.Kp2a, this,
|
ProgressTask pt = new ProgressTask(App.Kp2a, this,
|
||||||
new AddTemplateEntries(this, App.Kp2a, new ActionOnFinish(this,
|
new AddTemplateEntries(this, App.Kp2a, new ActionOnOperationFinished(this,
|
||||||
(success, message, activity) => ((GroupActivity)activity)?.StartAddEntry())));
|
(success, message, activity) => ((GroupActivity)activity)?.StartAddEntry())));
|
||||||
pt.Run();
|
pt.Run();
|
||||||
},
|
},
|
||||||
|
@@ -924,7 +924,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
var moveElement = new MoveElements(elementsToMove.ToList(), Group, this, App.Kp2a, new ActionOnFinish(this,
|
var moveElement = new MoveElements(elementsToMove.ToList(), Group, this, App.Kp2a, new ActionOnOperationFinished(this,
|
||||||
(success, message, activity) =>
|
(success, message, activity) =>
|
||||||
{
|
{
|
||||||
((GroupBaseActivity)activity)?.StopMovingElements();
|
((GroupBaseActivity)activity)?.StopMovingElements();
|
||||||
@@ -1293,7 +1293,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RefreshTask : OnFinish
|
public class RefreshTask : OnOperationFinishedHandler
|
||||||
{
|
{
|
||||||
public RefreshTask(Handler handler, GroupBaseActivity act)
|
public RefreshTask(Handler handler, GroupBaseActivity act)
|
||||||
: base(act, handler)
|
: base(act, handler)
|
||||||
@@ -1312,7 +1312,7 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class AfterDeleteGroup : OnFinish
|
public class AfterDeleteGroup : OnOperationFinishedHandler
|
||||||
{
|
{
|
||||||
public AfterDeleteGroup(Handler handler, GroupBaseActivity act)
|
public AfterDeleteGroup(Handler handler, GroupBaseActivity act)
|
||||||
: base(act, handler)
|
: base(act, handler)
|
||||||
@@ -1631,7 +1631,7 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void DeleteMultipleItems(GroupBaseActivity activity, List<IStructureItem> checkedItems, OnFinish onFinish, Kp2aApp app)
|
public void DeleteMultipleItems(GroupBaseActivity activity, List<IStructureItem> checkedItems, OnOperationFinishedHandler onOperationFinishedHandler, Kp2aApp app)
|
||||||
{
|
{
|
||||||
if (checkedItems.Any() == false)
|
if (checkedItems.Any() == false)
|
||||||
return;
|
return;
|
||||||
@@ -1670,22 +1670,22 @@ namespace keepass2android
|
|||||||
dbIndex++;
|
dbIndex++;
|
||||||
if (dbIndex == itemsForDatabases.Count)
|
if (dbIndex == itemsForDatabases.Count)
|
||||||
{
|
{
|
||||||
onFinish.SetResult(true);
|
onOperationFinishedHandler.SetResult(true);
|
||||||
onFinish.Run();
|
onOperationFinishedHandler.Run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new DeleteMultipleItemsFromOneDatabase(activity, itemsForDatabases[dbIndex].Key,
|
new DeleteMultipleItemsFromOneDatabase(activity, itemsForDatabases[dbIndex].Key,
|
||||||
itemsForDatabases[dbIndex].Value, new ActionOnFinish(activeActivity, (b, s, activity1) => action(b, s, activity1)), app)
|
itemsForDatabases[dbIndex].Value, new ActionOnOperationFinished(activeActivity, (b, s, activity1) => action(b, s, activity1)), app)
|
||||||
.Start();
|
.Start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
onFinish.SetResult(false, message, true, null);
|
onOperationFinishedHandler.SetResult(false, message, true, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
new DeleteMultipleItemsFromOneDatabase(activity, itemsForDatabases[dbIndex].Key,
|
new DeleteMultipleItemsFromOneDatabase(activity, itemsForDatabases[dbIndex].Key,
|
||||||
itemsForDatabases[dbIndex].Value, new ActionOnFinish(activity, (b, s, activity1) => action(b, s, activity1)), app)
|
itemsForDatabases[dbIndex].Value, new ActionOnOperationFinished(activity, (b, s, activity1) => action(b, s, activity1)), app)
|
||||||
.Start();
|
.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1440,11 +1440,11 @@ namespace keepass2android
|
|||||||
MakePasswordMaskedOrVisible();
|
MakePasswordMaskedOrVisible();
|
||||||
|
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
OnFinish onFinish = new AfterLoad(handler, this, _ioConnection);
|
OnOperationFinishedHandler onOperationFinishedHandler = new AfterLoad(handler, this, _ioConnection);
|
||||||
LoadDb task = (KeyProviderTypes.Contains(KeyProviders.Otp))
|
LoadDb task = (KeyProviderTypes.Contains(KeyProviders.Otp))
|
||||||
? new SaveOtpAuxFileAndLoadDb(App.Kp2a, _ioConnection, _loadDbFileTask, compositeKey, GetKeyProviderString(),
|
? new SaveOtpAuxFileAndLoadDb(App.Kp2a, _ioConnection, _loadDbFileTask, compositeKey, GetKeyProviderString(),
|
||||||
onFinish, this, true, _makeCurrent)
|
onOperationFinishedHandler, this, true, _makeCurrent)
|
||||||
: new LoadDb(this, App.Kp2a, _ioConnection, _loadDbFileTask, compositeKey, GetKeyProviderString(), onFinish,true, _makeCurrent);
|
: new LoadDb(this, App.Kp2a, _ioConnection, _loadDbFileTask, compositeKey, GetKeyProviderString(), onOperationFinishedHandler,true, _makeCurrent);
|
||||||
_loadDbFileTask = null; // prevent accidental re-use
|
_loadDbFileTask = null; // prevent accidental re-use
|
||||||
|
|
||||||
new ProgressTask(App.Kp2a, this, task).Run();
|
new ProgressTask(App.Kp2a, this, task).Run();
|
||||||
@@ -1891,10 +1891,10 @@ namespace keepass2android
|
|||||||
// to retry with typing the full password, but that's intended to avoid showing the password to a
|
// to retry with typing the full password, but that's intended to avoid showing the password to a
|
||||||
// a potentially unauthorized user (feature request https://keepass2android.codeplex.com/workitem/274)
|
// a potentially unauthorized user (feature request https://keepass2android.codeplex.com/workitem/274)
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
OnFinish onFinish = new AfterLoad(handler, this, _ioConnection);
|
OnOperationFinishedHandler onOperationFinishedHandler = new AfterLoad(handler, this, _ioConnection);
|
||||||
_performingLoad = true;
|
_performingLoad = true;
|
||||||
LoadDb task = new LoadDb(this, App.Kp2a, _ioConnection, _loadDbFileTask, compositeKeyForImmediateLoad, GetKeyProviderString(),
|
LoadDb task = new LoadDb(this, App.Kp2a, _ioConnection, _loadDbFileTask, compositeKeyForImmediateLoad, GetKeyProviderString(),
|
||||||
onFinish, false, _makeCurrent);
|
onOperationFinishedHandler, false, _makeCurrent);
|
||||||
_loadDbFileTask = null; // prevent accidental re-use
|
_loadDbFileTask = null; // prevent accidental re-use
|
||||||
new ProgressTask(App.Kp2a, this, task).Run();
|
new ProgressTask(App.Kp2a, this, task).Run();
|
||||||
compositeKeyForImmediateLoad = null; //don't reuse or keep in memory
|
compositeKeyForImmediateLoad = null; //don't reuse or keep in memory
|
||||||
@@ -2110,7 +2110,7 @@ namespace keepass2android
|
|||||||
Finish();
|
Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AfterLoad : OnFinish {
|
private class AfterLoad : OnOperationFinishedHandler {
|
||||||
readonly PasswordActivity _act;
|
readonly PasswordActivity _act;
|
||||||
private readonly IOConnectionInfo _ioConnection;
|
private readonly IOConnectionInfo _ioConnection;
|
||||||
|
|
||||||
@@ -2255,7 +2255,7 @@ namespace keepass2android
|
|||||||
private readonly PasswordActivity _act;
|
private readonly PasswordActivity _act;
|
||||||
|
|
||||||
|
|
||||||
public SaveOtpAuxFileAndLoadDb(IKp2aApp app, IOConnectionInfo ioc, Task<MemoryStream> databaseData, CompositeKey compositeKey, string keyfileOrProvider, OnFinish finish, PasswordActivity act, bool updateLastUsageTimestamp, bool makeCurrent) : base(act, app, ioc, databaseData, compositeKey, keyfileOrProvider, finish,updateLastUsageTimestamp,makeCurrent)
|
public SaveOtpAuxFileAndLoadDb(IKp2aApp app, IOConnectionInfo ioc, Task<MemoryStream> databaseData, CompositeKey compositeKey, string keyfileOrProvider, OnOperationFinishedHandler operationFinishedHandler, PasswordActivity act, bool updateLastUsageTimestamp, bool makeCurrent) : base(act, app, ioc, databaseData, compositeKey, keyfileOrProvider, operationFinishedHandler,updateLastUsageTimestamp,makeCurrent)
|
||||||
{
|
{
|
||||||
_act = act;
|
_act = act;
|
||||||
}
|
}
|
||||||
|
@@ -137,6 +137,7 @@
|
|||||||
<string name="NoDonationReminder_key">NoDonationReminder</string>
|
<string name="NoDonationReminder_key">NoDonationReminder</string>
|
||||||
|
|
||||||
<string name="UseOfflineCache_key">UseOfflineCache</string>
|
<string name="UseOfflineCache_key">UseOfflineCache</string>
|
||||||
|
<string name="SyncOfflineCacheInBackground_key">SyncOfflineCacheInBackground_key</string>
|
||||||
<string name="CreateBackups_key">CreateBackups_key</string>
|
<string name="CreateBackups_key">CreateBackups_key</string>
|
||||||
<string name="AcceptAllServerCertificates_key">AcceptAllServerCertificates</string>
|
<string name="AcceptAllServerCertificates_key">AcceptAllServerCertificates</string>
|
||||||
<string name="CheckForFileChangesOnSave_key">CheckForFileChangesOnSave</string>
|
<string name="CheckForFileChangesOnSave_key">CheckForFileChangesOnSave</string>
|
||||||
|
@@ -382,6 +382,8 @@
|
|||||||
<string name="NoDonationReminder_summary">I won\'t give you a dime or I have already donated. Don\'t ask for a donation, not even at the author\'s birthday.</string>
|
<string name="NoDonationReminder_summary">I won\'t give you a dime or I have already donated. Don\'t ask for a donation, not even at the author\'s birthday.</string>
|
||||||
<string name="UseOfflineCache_title">Database caching</string>
|
<string name="UseOfflineCache_title">Database caching</string>
|
||||||
<string name="UseOfflineCache_summary">Keep a copy of the database files in the app\'s cache directory. This allows to use databases even while the database file is not accessible.</string>
|
<string name="UseOfflineCache_summary">Keep a copy of the database files in the app\'s cache directory. This allows to use databases even while the database file is not accessible.</string>
|
||||||
|
<string name="SyncOfflineCacheInBackground_summary">When saving or loading, use the internal cache. Then synchronize with remote storage in a background process.</string>
|
||||||
|
<string name="SyncOfflineCacheInBackground_title">Synchronize in background</string>
|
||||||
<string name="CreateBackups_title">Local backups</string>
|
<string name="CreateBackups_title">Local backups</string>
|
||||||
<string name="CreateBackups_summary">Create a local backup copy after successfully loading a database.</string>
|
<string name="CreateBackups_summary">Create a local backup copy after successfully loading a database.</string>
|
||||||
<string name="UpdatingBackup">Updating local backup...</string>
|
<string name="UpdatingBackup">Updating local backup...</string>
|
||||||
|
@@ -12,7 +12,17 @@
|
|||||||
android:title="@string/UseOfflineCache_title"
|
android:title="@string/UseOfflineCache_title"
|
||||||
android:key="@string/UseOfflineCache_key" />
|
android:key="@string/UseOfflineCache_key" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:enabled="true"
|
||||||
|
android:persistent="true"
|
||||||
|
android:summary="@string/SyncOfflineCacheInBackground_summary"
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:title="@string/SyncOfflineCacheInBackground_title"
|
||||||
|
android:key="@string/SyncOfflineCacheInBackground_key" />
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
android:summary="@string/CreateBackups_summary"
|
android:summary="@string/CreateBackups_summary"
|
||||||
|
@@ -88,21 +88,21 @@ namespace keepass2android
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AfterSave : OnFinish {
|
class AfterSave : OnOperationFinishedHandler {
|
||||||
private readonly FileOnFinish _finish;
|
private readonly FileOnFinish _operationFinishedHandler;
|
||||||
|
|
||||||
readonly SetPasswordDialog _dlg;
|
readonly SetPasswordDialog _dlg;
|
||||||
|
|
||||||
public AfterSave(Activity activity, SetPasswordDialog dlg, FileOnFinish finish, Handler handler): base(activity, finish, handler) {
|
public AfterSave(Activity activity, SetPasswordDialog dlg, FileOnFinish operationFinishedHandler, Handler handler): base(activity, operationFinishedHandler, handler) {
|
||||||
_finish = finish;
|
_operationFinishedHandler = operationFinishedHandler;
|
||||||
_dlg = dlg;
|
_dlg = dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void Run() {
|
public override void Run() {
|
||||||
if ( Success ) {
|
if ( Success ) {
|
||||||
if ( _finish != null ) {
|
if ( _operationFinishedHandler != null ) {
|
||||||
_finish.Filename = _dlg.Keyfile;
|
_operationFinishedHandler.Filename = _dlg.Keyfile;
|
||||||
}
|
}
|
||||||
FingerprintUnlockMode um;
|
FingerprintUnlockMode um;
|
||||||
Enum.TryParse(PreferenceManager.GetDefaultSharedPreferences(_dlg.Context).GetString(App.Kp2a.CurrentDb.CurrentFingerprintModePrefKey, ""), out um);
|
Enum.TryParse(PreferenceManager.GetDefaultSharedPreferences(_dlg.Context).GetString(App.Kp2a.CurrentDb.CurrentFingerprintModePrefKey, ""), out um);
|
||||||
|
@@ -53,7 +53,7 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
var filestorage = App.Kp2a.GetFileStorage(App.Kp2a.CurrentDb.Ioc);
|
var filestorage = App.Kp2a.GetFileStorage(App.Kp2a.CurrentDb.Ioc);
|
||||||
RunnableOnFinish task;
|
RunnableOnFinish task;
|
||||||
OnFinish onFinish = new ActionOnFinish(_activity, (success, message, activity) =>
|
OnOperationFinishedHandler onOperationFinishedHandler = new ActionOnOperationFinished(_activity, (success, message, activity) =>
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(message))
|
if (!String.IsNullOrEmpty(message))
|
||||||
App.Kp2a.ShowMessage(activity, message, MessageSeverity.Error);
|
App.Kp2a.ShowMessage(activity, message, MessageSeverity.Error);
|
||||||
@@ -65,7 +65,7 @@ namespace keepass2android
|
|||||||
if (App.Kp2a.CurrentDb?.OtpAuxFileIoc != null)
|
if (App.Kp2a.CurrentDb?.OtpAuxFileIoc != null)
|
||||||
{
|
{
|
||||||
var task2 = new SyncOtpAuxFile(_activity, App.Kp2a.CurrentDb.OtpAuxFileIoc);
|
var task2 = new SyncOtpAuxFile(_activity, App.Kp2a.CurrentDb.OtpAuxFileIoc);
|
||||||
task2.OnFinishToRun = new ActionOnFinish(_activity, (b, s, activeActivity) =>
|
task2.operationFinishedHandler = new ActionOnOperationFinished(_activity, (b, s, activeActivity) =>
|
||||||
{
|
{
|
||||||
runAfterSuccess();
|
runAfterSuccess();
|
||||||
});
|
});
|
||||||
@@ -80,12 +80,12 @@ namespace keepass2android
|
|||||||
if (filestorage is CachingFileStorage)
|
if (filestorage is CachingFileStorage)
|
||||||
{
|
{
|
||||||
|
|
||||||
task = new SynchronizeCachedDatabase(_activity, App.Kp2a, onFinish);
|
task = new SynchronizeCachedDatabase(_activity, App.Kp2a, onOperationFinishedHandler);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
task = new CheckDatabaseForChanges(_activity, App.Kp2a, onFinish);
|
task = new CheckDatabaseForChanges(_activity, App.Kp2a, onOperationFinishedHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -117,7 +117,7 @@ namespace keepass2android
|
|||||||
var previousUsername = db.KpDatabase.DefaultUserName;
|
var previousUsername = db.KpDatabase.DefaultUserName;
|
||||||
db.KpDatabase.DefaultUserName = e.NewValue.ToString();
|
db.KpDatabase.DefaultUserName = e.NewValue.ToString();
|
||||||
|
|
||||||
SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnFinish(Activity, (success, message, activity) =>
|
SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnOperationFinished(Activity, (success, message, activity) =>
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
@@ -145,7 +145,7 @@ namespace keepass2android
|
|||||||
pref.PreferenceClick += (sender, args) =>
|
pref.PreferenceClick += (sender, args) =>
|
||||||
{
|
{
|
||||||
ProgressTask pt = new ProgressTask(App.Kp2a, Activity,
|
ProgressTask pt = new ProgressTask(App.Kp2a, Activity,
|
||||||
new AddTemplateEntries(Activity, App.Kp2a, new ActionOnFinish(Activity,
|
new AddTemplateEntries(Activity, App.Kp2a, new ActionOnOperationFinished(Activity,
|
||||||
delegate
|
delegate
|
||||||
{
|
{
|
||||||
pref.Enabled = false;
|
pref.Enabled = false;
|
||||||
@@ -183,7 +183,7 @@ namespace keepass2android
|
|||||||
String previousName = db.KpDatabase.Name;
|
String previousName = db.KpDatabase.Name;
|
||||||
db.KpDatabase.Name = e.NewValue.ToString();
|
db.KpDatabase.Name = e.NewValue.ToString();
|
||||||
|
|
||||||
SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnFinish(Activity, (success, message, activity) =>
|
SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnOperationFinished(Activity, (success, message, activity) =>
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
@@ -410,7 +410,7 @@ namespace keepass2android
|
|||||||
var previousCipher = db.KpDatabase.DataCipherUuid;
|
var previousCipher = db.KpDatabase.DataCipherUuid;
|
||||||
db.KpDatabase.DataCipherUuid = new PwUuid(MemUtil.HexStringToByteArray((string)preferenceChangeEventArgs.NewValue));
|
db.KpDatabase.DataCipherUuid = new PwUuid(MemUtil.HexStringToByteArray((string)preferenceChangeEventArgs.NewValue));
|
||||||
|
|
||||||
SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnFinish(Activity, (success, message, activity) =>
|
SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnOperationFinished(Activity, (success, message, activity) =>
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
@@ -1071,7 +1071,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
Kp2aLog.Log("--new kdf: " + KdfPool.Get(db.KpDatabase.KdfParameters.KdfUuid) + " " + db.KpDatabase.KdfParameters.KdfUuid.ToHexString());
|
Kp2aLog.Log("--new kdf: " + KdfPool.Get(db.KpDatabase.KdfParameters.KdfUuid) + " " + db.KpDatabase.KdfParameters.KdfUuid.ToHexString());
|
||||||
|
|
||||||
SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnFinish(Activity, (success, message, activity) =>
|
SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnOperationFinished(Activity, (success, message, activity) =>
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
@@ -18,8 +18,8 @@ namespace keepass2android
|
|||||||
private readonly IKp2aApp _app;
|
private readonly IKp2aApp _app;
|
||||||
private IOConnectionInfo _targetIoc;
|
private IOConnectionInfo _targetIoc;
|
||||||
|
|
||||||
public ExportKeyfile(Activity activity, IKp2aApp app, OnFinish onFinish, IOConnectionInfo targetIoc) : base(
|
public ExportKeyfile(Activity activity, IKp2aApp app, OnOperationFinishedHandler onOperationFinishedHandler, IOConnectionInfo targetIoc) : base(
|
||||||
activity, onFinish)
|
activity, onOperationFinishedHandler)
|
||||||
{
|
{
|
||||||
_app = app;
|
_app = app;
|
||||||
_targetIoc = targetIoc;
|
_targetIoc = targetIoc;
|
||||||
@@ -70,7 +70,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
protected override void SaveFile(IOConnectionInfo ioc)
|
protected override void SaveFile(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
var exportKeyfile = new ExportKeyfile(_activity, App.Kp2a, new ActionOnFinish(_activity,
|
var exportKeyfile = new ExportKeyfile(_activity, App.Kp2a, new ActionOnOperationFinished(_activity,
|
||||||
(success, message, activity) =>
|
(success, message, activity) =>
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@@ -129,7 +129,7 @@ namespace keepass2android.settings
|
|||||||
|
|
||||||
public abstract ulong ParamValue { get; set; }
|
public abstract ulong ParamValue { get; set; }
|
||||||
|
|
||||||
private class AfterSave : OnFinish {
|
private class AfterSave : OnOperationFinishedHandler {
|
||||||
private readonly ulong _oldParamValue;
|
private readonly ulong _oldParamValue;
|
||||||
private readonly Context _ctx;
|
private readonly Context _ctx;
|
||||||
private readonly KdfNumberDialogPreference _pref;
|
private readonly KdfNumberDialogPreference _pref;
|
||||||
|
Reference in New Issue
Block a user