mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-25 10:42:17 -05:00
added option to disable "clear password on leave" (eg. for switching between KP2A and Google Authenticator)
directly load db when enter key is pressed
This commit is contained in:
parent
99a56f8e52
commit
95f5524425
@ -35,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MasterKeePlugin", "MasterKe
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlayServicesTest", "PlayServicesTest\PlayServicesTest.csproj", "{B8E78075-3936-42E9-9AB4-C82B341935A6}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlayServicesTest", "PlayServicesTest\PlayServicesTest.csproj", "{B8E78075-3936-42E9-9AB4-C82B341935A6}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App1", "App1\App1.csproj", "{A29ECF2C-3313-4F93-8B78-DC3F1319E835}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -378,6 +380,30 @@ Global
|
|||||||
{B8E78075-3936-42E9-9AB4-C82B341935A6}.ReleaseNoNet|Win32.Build.0 = Release|Any CPU
|
{B8E78075-3936-42E9-9AB4-C82B341935A6}.ReleaseNoNet|Win32.Build.0 = Release|Any CPU
|
||||||
{B8E78075-3936-42E9-9AB4-C82B341935A6}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
{B8E78075-3936-42E9-9AB4-C82B341935A6}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
||||||
{B8E78075-3936-42E9-9AB4-C82B341935A6}.ReleaseNoNet|x64.Build.0 = Release|Any CPU
|
{B8E78075-3936-42E9-9AB4-C82B341935A6}.ReleaseNoNet|x64.Build.0 = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Any CPU.Deploy.0 = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Mixed Platforms.Deploy.0 = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|Win32.ActiveCfg = Release|Any CPU
|
||||||
|
{A29ECF2C-3313-4F93-8B78-DC3F1319E835}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -28,6 +28,7 @@ using Android.Graphics.Drawables;
|
|||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Android.Runtime;
|
using Android.Runtime;
|
||||||
using Android.Views;
|
using Android.Views;
|
||||||
|
using Android.Views.InputMethods;
|
||||||
using Android.Widget;
|
using Android.Widget;
|
||||||
using Java.Net;
|
using Java.Net;
|
||||||
using Android.Preferences;
|
using Android.Preferences;
|
||||||
@ -638,6 +639,11 @@ namespace keepass2android
|
|||||||
_password = FindViewById<EditText>(Resource.Id.password).Text;
|
_password = FindViewById<EditText>(Resource.Id.password).Text;
|
||||||
UpdateOkButtonState();
|
UpdateOkButtonState();
|
||||||
};
|
};
|
||||||
|
FindViewById<EditText>(Resource.Id.password).EditorAction += (sender, args) =>
|
||||||
|
{
|
||||||
|
if ((args.ActionId == ImeAction.Done) || ((args.ActionId == ImeAction.ImeNull) && (args.Event.Action == KeyEventActions.Down)))
|
||||||
|
OnOk();
|
||||||
|
};
|
||||||
|
|
||||||
FindViewById<EditText>(Resource.Id.pass_otpsecret).TextChanged += (sender, args) => UpdateOkButtonState();
|
FindViewById<EditText>(Resource.Id.pass_otpsecret).TextChanged += (sender, args) => UpdateOkButtonState();
|
||||||
|
|
||||||
@ -766,11 +772,16 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
Button confirmButton = (Button) FindViewById(Resource.Id.pass_ok);
|
Button confirmButton = (Button) FindViewById(Resource.Id.pass_ok);
|
||||||
confirmButton.Click += (sender, e) =>
|
confirmButton.Click += (sender, e) =>
|
||||||
|
{
|
||||||
|
OnOk();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnOk()
|
||||||
{
|
{
|
||||||
App.Kp2a.GetFileStorage(_ioConnection)
|
App.Kp2a.GetFileStorage(_ioConnection)
|
||||||
.PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult, null), _ioConnection,
|
.PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult, null), _ioConnection,
|
||||||
RequestCodePrepareDbFile, false);
|
RequestCodePrepareDbFile, false);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeTogglePasswordButton()
|
private void InitializeTogglePasswordButton()
|
||||||
@ -1276,9 +1287,15 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_keepPasswordInOnResume)
|
if (!_keepPasswordInOnResume)
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
PreferenceManager.GetDefaultSharedPreferences(this)
|
||||||
|
.GetBoolean(GetString(Resource.String.ClearPasswordOnLeave_key), true))
|
||||||
{
|
{
|
||||||
ClearEnteredPassword();
|
ClearEnteredPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
_keepPasswordInOnResume = false;
|
_keepPasswordInOnResume = false;
|
||||||
|
|
||||||
MakePasswordMaskedOrVisible();
|
MakePasswordMaskedOrVisible();
|
||||||
|
@ -100,6 +100,29 @@ namespace keepass2android
|
|||||||
|
|
||||||
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) =>
|
||||||
|
{
|
||||||
|
OnUnlock(quickUnlockLength, pwd);
|
||||||
|
};
|
||||||
|
|
||||||
|
Button btnLock = (Button) FindViewById(Resource.Id.QuickUnlock_buttonLock);
|
||||||
|
btnLock.Click += (object sender, EventArgs e) =>
|
||||||
|
{
|
||||||
|
App.Kp2a.LockDatabase(false);
|
||||||
|
Finish();
|
||||||
|
};
|
||||||
|
pwd.EditorAction += (sender, args) =>
|
||||||
|
{
|
||||||
|
if ((args.ActionId == ImeAction.Done) || ((args.ActionId == ImeAction.ImeNull) && (args.Event.Action == KeyEventActions.Down)))
|
||||||
|
OnUnlock(quickUnlockLength, pwd);
|
||||||
|
};
|
||||||
|
|
||||||
|
_intentReceiver = new QuickUnlockBroadcastReceiver(this);
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.AddAction(Intents.DatabaseLocked);
|
||||||
|
RegisterReceiver(_intentReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnlock(int quickUnlockLength, EditText pwd)
|
||||||
{
|
{
|
||||||
KcpPassword kcpPassword = (KcpPassword) App.Kp2a.GetDb().KpDatabase.MasterKey.GetUserKey(typeof (KcpPassword));
|
KcpPassword kcpPassword = (KcpPassword) App.Kp2a.GetDb().KpDatabase.MasterKey.GetUserKey(typeof (KcpPassword));
|
||||||
String password = kcpPassword.Password.ReadString();
|
String password = kcpPassword.Password.ReadString();
|
||||||
@ -115,19 +138,6 @@ namespace keepass2android
|
|||||||
Toast.MakeText(this, GetString(Resource.String.QuickUnlock_fail), ToastLength.Long).Show();
|
Toast.MakeText(this, GetString(Resource.String.QuickUnlock_fail), ToastLength.Long).Show();
|
||||||
}
|
}
|
||||||
Finish();
|
Finish();
|
||||||
};
|
|
||||||
|
|
||||||
Button btnLock = (Button) FindViewById(Resource.Id.QuickUnlock_buttonLock);
|
|
||||||
btnLock.Click += (object sender, EventArgs e) =>
|
|
||||||
{
|
|
||||||
App.Kp2a.LockDatabase(false);
|
|
||||||
Finish();
|
|
||||||
};
|
|
||||||
|
|
||||||
_intentReceiver = new QuickUnlockBroadcastReceiver(this);
|
|
||||||
IntentFilter filter = new IntentFilter();
|
|
||||||
filter.AddAction(Intents.DatabaseLocked);
|
|
||||||
RegisterReceiver(_intentReceiver, filter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLockDatabase()
|
private void OnLockDatabase()
|
||||||
|
@ -172,4 +172,6 @@
|
|||||||
<string name="PreloadDatabaseEnabled_key">PreloadDatabaseEnabled</string>
|
<string name="PreloadDatabaseEnabled_key">PreloadDatabaseEnabled</string>
|
||||||
<bool name="PreloadDatabaseEnabled_default">true</bool>
|
<bool name="PreloadDatabaseEnabled_default">true</bool>
|
||||||
|
|
||||||
|
<string name="ClearPasswordOnLeave_key">ClearPasswordOnLeave</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -283,6 +283,9 @@
|
|||||||
<string name="LockWhenScreenOff_title">Lock when screen off</string>
|
<string name="LockWhenScreenOff_title">Lock when screen off</string>
|
||||||
<string name="LockWhenScreenOff_summary">Lock the database when screen is switched off.</string>
|
<string name="LockWhenScreenOff_summary">Lock the database when screen is switched off.</string>
|
||||||
|
|
||||||
|
<string name="ClearPasswordOnLeave_title">Clear entered master password</string>
|
||||||
|
<string name="ClearPasswordOnLeave_summary">Clear the entered master password when leaving the screen without unlocking the database.</string>
|
||||||
|
|
||||||
<string name="LockWhenNavigateBack_title">Lock when leaving app</string>
|
<string name="LockWhenNavigateBack_title">Lock when leaving app</string>
|
||||||
<string name="LockWhenNavigateBack_summary">Lock the database when leaving the app by pressing the back button.</string>
|
<string name="LockWhenNavigateBack_summary">Lock the database when leaving the app by pressing the back button.</string>
|
||||||
|
|
||||||
|
@ -128,6 +128,15 @@
|
|||||||
android:summary="@string/show_kill_app_summary"
|
android:summary="@string/show_kill_app_summary"
|
||||||
android:defaultValue="false"/>
|
android:defaultValue="false"/>
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:enabled="true"
|
||||||
|
android:persistent="true"
|
||||||
|
android:summary="@string/ClearPasswordOnLeave_summary"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:title="@string/ClearPasswordOnLeave_title"
|
||||||
|
android:key="@string/ClearPasswordOnLeave_key" />
|
||||||
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="@string/display_prefs_key"
|
android:key="@string/display_prefs_key"
|
||||||
|
Loading…
Reference in New Issue
Block a user