protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (requestCode == ReqCodeOpenNewDb) { switch ((int)resultCode) { case (int)Result.Ok: string iocString = data?.GetStringExtra("ioc"); IOConnectionInfo ioc = IOConnectionInfo.UnserializeFromString(iocString); var db = App.Kp2a.TryGetDatabase(ioc); if (db != null) { AddAutoOpenEntryForDatabase(db); } break; case PasswordActivity.ResultSelectOtherFile: StartFileSelect(true); break; default: break; } return; } }
protected override void OnCreate(Bundle bundle) { _design.ApplyTheme(); base.OnCreate(bundle); Kp2aLog.Log("SelectStorageLocationActivity.OnCreate"); if (IsStorageSelectionForSave) { throw new Exception("save is not yet implemented. In StartSelectFile, no handler for onCreate is passed."); } bool allowThirdPartyGet = Intent.GetBooleanExtra(FileStorageSelectionActivity.AllowThirdPartyAppGet, false); bool allowThirdPartySend = Intent.GetBooleanExtra(FileStorageSelectionActivity.AllowThirdPartyAppSend, false); bool isRecreated = false; if (bundle == null) { State = new Bundle(); } else { State = (Bundle)bundle.Clone(); var selectedIocString = bundle.GetString(BundleKeySelectedIoc, null); if (selectedIocString != null) { _selectedIoc = IOConnectionInfo.UnserializeFromString(selectedIocString); } isRecreated = true; } //todo: handle orientation change while dialog is shown if (!isRecreated) { StartFileStorageSelection(RequestCodeFileStorageSelectionForPrimarySelect, allowThirdPartyGet, allowThirdPartySend); } }
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; } }