EntryActivity.cs: Ensure notifications don't pop up if locked

QuickUnlock.cs: ensure keyboard shows up also OnResume
App.cs: use GetDb() to ensure db is not null
This commit is contained in:
Philipp Crocoll 2013-08-03 12:33:19 +02:00
parent 85e6a0e9c2
commit 4f7744999f
3 changed files with 14 additions and 10 deletions

View File

@ -94,7 +94,7 @@ namespace keepass2android
Database db = App.Kp2a.GetDb(); Database db = App.Kp2a.GetDb();
// Likely the app has been killed exit the activity // Likely the app has been killed exit the activity
if (! db.Loaded) if (!db.Loaded || (App.Kp2a.QuickLocked))
{ {
Finish(); Finish();
return; return;

View File

@ -65,15 +65,11 @@ namespace keepass2android
txtLabel.Text = GetString(Resource.String.QuickUnlock_label, new Java.Lang.Object[]{quickUnlockLength}); txtLabel.Text = GetString(Resource.String.QuickUnlock_label, new Java.Lang.Object[]{quickUnlockLength});
EditText pwd= (EditText)FindViewById(Resource.Id.QuickUnlock_password);
pwd.SetEms(quickUnlockLength);
pwd.PostDelayed(() => {
InputMethodManager keyboard = (InputMethodManager)GetSystemService(Context.InputMethodService);
keyboard.ShowSoftInput(pwd, 0);
}, 50);
SetResult(KeePass.ExitChangeDb); SetResult(KeePass.ExitChangeDb);
EditText pwd = (EditText)FindViewById(Resource.Id.QuickUnlock_password);
pwd.SetEms(quickUnlockLength);
Button btnUnlock = (Button)FindViewById(Resource.Id.QuickUnlock_button); Button btnUnlock = (Button)FindViewById(Resource.Id.QuickUnlock_button);
btnUnlock.Click += (object sender, EventArgs e) => btnUnlock.Click += (object sender, EventArgs e) =>
{ {
@ -110,6 +106,14 @@ namespace keepass2android
Finish(); Finish();
return; return;
} }
EditText pwd = (EditText)FindViewById(Resource.Id.QuickUnlock_password);
pwd.PostDelayed(() =>
{
InputMethodManager keyboard = (InputMethodManager)GetSystemService(Context.InputMethodService);
keyboard.ShowSoftInput(pwd, 0);
}, 50);
} }
} }
} }

View File

@ -64,7 +64,7 @@ namespace keepass2android
{ {
public void LockDatabase(bool allowQuickUnlock = true) public void LockDatabase(bool allowQuickUnlock = true)
{ {
if (_db.Loaded) if (GetDb().Loaded)
{ {
if (QuickUnlockEnabled && allowQuickUnlock && if (QuickUnlockEnabled && allowQuickUnlock &&
_db.KpDatabase.MasterKey.ContainsType(typeof(KcpPassword)) && _db.KpDatabase.MasterKey.ContainsType(typeof(KcpPassword)) &&