protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (_exportBinaryProcessManager?.OnActivityResult(requestCode, resultCode, data) == true) { return; } if (AppTask.TryGetFromActivityResult(data, ref _appTask)) { //make sure app task is passed to calling activity. //the result code might be modified later. Intent retData = new Intent(); _appTask.ToIntent(retData); SetResult(KeePass.ExitNormal, retData); } if (resultCode == KeePass.ExitRefresh || resultCode == KeePass.ExitRefreshTitle) { if (resultCode == KeePass.ExitRefreshTitle) { RequiresRefresh(); } Recreate(); } }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); //update app task. //this is important even if we're about to close, because then we should get a NullTask here //in order not to do the same task next time again! AppTask.TryGetFromActivityResult(data, ref AppTask); if (resultCode == KeePass.ExitCloseAfterTaskComplete) { //no need to set the result ExitCloseAfterTaskComplete here, there's no parent Activity on the stack Finish(); return; } FillData(); if (resultCode == (Result)FileStorageResults.FileUsagePrepared) { IOConnectionInfo ioc = new IOConnectionInfo(); PasswordActivity.SetIoConnectionFromIntent(ioc, data); LaunchPasswordActivityForIoc(ioc); } if ((resultCode == Result.Ok) && (requestCode == RequestCodeSelectIoc)) { IOConnectionInfo ioc = new IOConnectionInfo(); PasswordActivity.SetIoConnectionFromIntent(ioc, data); LaunchPasswordActivityForIoc(ioc); } }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (AppTask.TryGetFromActivityResult(data, ref AppTask)) { //make sure the app task is passed to the calling activity AppTask.SetActivityResult(this, KeePass.ExitNormal); } if ((GroupEditActivity.RequestCodeGroupEdit == requestCode) && (resultCode == Result.Ok)) { String groupName = data.Extras.GetString(GroupEditActivity.KeyName); int groupIconId = data.Extras.GetInt(GroupEditActivity.KeyIconId); PwUuid groupCustomIconId = new PwUuid(MemUtil.HexStringToByteArray(data.Extras.GetString(GroupEditActivity.KeyCustomIconId))); String strGroupUuid = data.Extras.GetString(GroupEditActivity.KeyGroupUuid); GroupBaseActivity act = this; Handler handler = new Handler(); RunnableOnFinish task; if (strGroupUuid == null) { task = AddGroup.GetInstance(this, App.Kp2a, groupName, groupIconId, groupCustomIconId, Group, new RefreshTask(handler, this), false); } else { PwUuid groupUuid = new PwUuid(MemUtil.HexStringToByteArray(strGroupUuid)); task = new EditGroup(this, App.Kp2a, groupName, (PwIcon)groupIconId, groupCustomIconId, App.Kp2a.GetDb().Groups[groupUuid], new RefreshTask(handler, this)); } ProgressTask pt = new ProgressTask(App.Kp2a, act, task); pt.Run(); } if (resultCode == KeePass.ExitCloseAfterTaskComplete) { AppTask.SetActivityResult(this, KeePass.ExitCloseAfterTaskComplete); Finish(); } if (resultCode == KeePass.ExitReloadDb) { AppTask.SetActivityResult(this, KeePass.ExitReloadDb); Finish(); } }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); Kp2aLog.Log("StackBaseActivity.OnActivityResult " + resultCode + "/" + requestCode); AppTask.TryGetFromActivityResult(data, ref AppTask); if (requestCode == ReqCodeOpenNewDb) { switch ((int)resultCode) { case (int)Result.Ok: string iocString = data?.GetStringExtra("ioc"); IOConnectionInfo ioc = IOConnectionInfo.UnserializeFromString(iocString); if (App.Kp2a.TrySelectCurrentDb(ioc)) { if (OpenAutoExecEntries(App.Kp2a.CurrentDb)) { return; } LaunchingOther = true; AppTask.CanActivateSearchViewOnStart = true; AppTask.LaunchFirstGroupActivity(this); } break; case PasswordActivity.ResultSelectOtherFile: StartFileSelect(true, true); break; case (int)Result.Canceled: if (App.Kp2a.OpenDatabases.Any() == false) { //don't open fileselect/password activity again OnBackPressed(); } break; default: break; } return; } switch (resultCode) { case KeePass.ExitNormal: // Returned to this screen using the Back key if (App.Kp2a.OpenDatabases.Count() == 1) { OnBackPressed(); } break; case KeePass.ExitLock: // The database has already been locked, and the quick unlock screen will be shown if appropriate break; case KeePass.ExitCloseAfterTaskComplete: // Do not lock the database SetResult(KeePass.ExitCloseAfterTaskComplete); Finish(); break; case KeePass.ExitClose: SetResult(KeePass.ExitClose); Finish(); break; case KeePass.ExitReloadDb: if (App.Kp2a.CurrentDb != null) { //remember the composite key for reloading: var compositeKey = App.Kp2a.CurrentDb.KpDatabase.MasterKey; var ioc = App.Kp2a.CurrentDb.Ioc; //lock the database: App.Kp2a.CloseDatabase(App.Kp2a.CurrentDb); LaunchPasswordActivityForReload(ioc, compositeKey); } break; case KeePass.ExitLoadAnotherDb: StartFileSelect(true, true); break; } }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); Kp2aLog.Log("StackBaseActivity.OnActivityResult " + resultCode + "/" + requestCode); AppTask.TryGetFromActivityResult(data, ref AppTask); if (requestCode == ReqCodeOpenNewDb) { switch ((int)resultCode) { case (int)Result.Ok: string iocString = data?.GetStringExtra("ioc"); IOConnectionInfo ioc = IOConnectionInfo.UnserializeFromString(iocString); if (App.Kp2a.TrySelectCurrentDb(ioc)) { if (OpenAutoExecEntries(App.Kp2a.CurrentDb)) { return; } LaunchingOther = true; AppTask.CanActivateSearchViewOnStart = true; AppTask.LaunchFirstGroupActivity(this); } break; case PasswordActivity.ResultSelectOtherFile: StartFileSelect(true, true); break; case (int)Result.Canceled: if (App.Kp2a.OpenDatabases.Any() == false) { //don't open fileselect/password activity again OnBackPressed(); } break; default: break; } return; } switch (resultCode) { case KeePass.ExitNormal: // Returned to this screen using the Back key if (App.Kp2a.OpenDatabases.Count() == 1) { OnBackPressed(); } break; case KeePass.ExitLock: // The database has already been locked. No need to immediately return to quick unlock. Especially as this causes trouble for users with face unlock // (db immediately unlocked again) and confused some users as the biometric prompt seemed to disable the device back button or at least they didn't understand // why they should unlock... SetResult(KeePass.ExitClose); if (!IsFinishing) { Finish(); } break; case KeePass.ExitLockByTimeout: //don't finish, bring up QuickUnlock break; case KeePass.ExitCloseAfterTaskComplete: // Do not lock the database SetResult(KeePass.ExitCloseAfterTaskComplete); if (!IsFinishing) { Finish(); } break; case KeePass.ExitClose: SetResult(KeePass.ExitClose); if (!IsFinishing) { Finish(); } break; case KeePass.ExitReloadDb: if (App.Kp2a.CurrentDb != null) { //remember the composite key for reloading: var compositeKey = App.Kp2a.CurrentDb.KpDatabase.MasterKey; var ioc = App.Kp2a.CurrentDb.Ioc; //lock the database: App.Kp2a.CloseDatabase(App.Kp2a.CurrentDb); LaunchPasswordActivityForReload(ioc, compositeKey); } break; case KeePass.ExitLoadAnotherDb: StartFileSelect(true, true); break; } }