allow to hide softkeyboard during fingerprint scan

also support x86_64
add donate reminder
This commit is contained in:
Philipp Crocoll 2016-08-23 04:20:54 +02:00
parent 4583259f45
commit 64f1c63f42
12 changed files with 116 additions and 32 deletions

View File

@ -10,7 +10,8 @@
<RootNamespace>AndroidFileChooserBinding</RootNamespace>
<AssemblyName>AndroidFileChooserBinding</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

View File

@ -10,7 +10,8 @@
<RootNamespace>KP2AKdbLibraryBinding</RootNamespace>
<AssemblyName>KP2AKdbLibraryBinding</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

View File

@ -26,6 +26,7 @@ namespace keepass2android
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeHoloLightDialog));
builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title));
List<string> changeLog = new List<string>{
ctx.GetString(Resource.String.ChangeLog_1_0_0e),
ctx.GetString(Resource.String.ChangeLog_1_0_0),
ctx.GetString(Resource.String.ChangeLog_0_9_9c),
ctx.GetString(Resource.String.ChangeLog_0_9_9),

View File

@ -62,11 +62,19 @@ namespace keepass2android
yield return new Reminder
{
From = new DateTime(2016, 09, 17),
To = new DateTime(2016, 10, 04),
To = new DateTime(2016, 09, 26),
Key = "DonationOktoberfest2016"
,ResourceToShow = Resource.Layout.donate
};
yield return new Reminder
{
From = new DateTime(2016, 09, 26),
To = new DateTime(2016, 10, 04),
Key = "DonationOktoberfest2016-2"
,
ResourceToShow = Resource.Layout.donate
};
yield return new Reminder
{
From = new DateTime(2017, 09, 16),
To = new DateTime(2017, 09, 25),

View File

@ -118,8 +118,17 @@ namespace keepass2android
FindViewById(Resource.Id.radio_buttons).Visibility = ViewStates.Gone;
FindViewById(Resource.Id.fingerprint_auth_container).Visibility = ViewStates.Gone;
FindViewById<CheckBox>(Resource.Id.show_keyboard_while_fingerprint).Checked =
Util.GetShowKeyboardDuringFingerprintUnlock(this);
if ((int) Build.VERSION.SdkInt >= 23)
FindViewById<CheckBox>(Resource.Id.show_keyboard_while_fingerprint).CheckedChange += (sender, args) =>
{
PreferenceManager.GetDefaultSharedPreferences(this)
.Edit()
.PutBoolean(GetString(Resource.String.ShowKeyboardWhileFingerprint_key), args.IsChecked)
.Commit();
};
if ((int)Build.VERSION.SdkInt >= 23)
RequestPermissions(new[] {Manifest.Permission.UseFingerprint}, FingerprintPermissionRequestCode);
else
{
@ -127,6 +136,17 @@ namespace keepass2android
}
UpdateKeyboardCheckboxVisibility();
}
private void UpdateKeyboardCheckboxVisibility()
{
FindViewById(Resource.Id.show_keyboard_while_fingerprint).Visibility = (_unlockMode == FingerprintUnlockMode.Disabled) ||
(_samsungFingerprint != null)
? ViewStates.Gone
: ViewStates.Visible;
}
private bool TrySetupSamsung()
@ -205,6 +225,7 @@ namespace keepass2android
//seems like not all Samsung Devices (e.g. Note 4) don't support the Android 6 fingerprint API
if (!TrySetupSamsung())
SetError(Resource.String.fingerprint_hardware_error);
UpdateKeyboardCheckboxVisibility();
return;
}
if (!fpModule.FingerprintManager.HasEnrolledFingerprints)
@ -213,6 +234,7 @@ namespace keepass2android
return;
}
ShowRadioButtons();
UpdateKeyboardCheckboxVisibility();
}
}
@ -229,9 +251,12 @@ namespace keepass2android
if (oldMode == newMode)
return;
if (_samsungFingerprint != null)
{
_unlockMode = newMode;
UpdateKeyboardCheckboxVisibility();
ISharedPreferencesEditor edit = PreferenceManager.GetDefaultSharedPreferences(this).Edit();
edit.PutString(App.Kp2a.GetDb().CurrentFingerprintModePrefKey, _unlockMode.ToString());
edit.Commit();
@ -241,14 +266,17 @@ namespace keepass2android
if (newMode == FingerprintUnlockMode.Disabled)
{
_unlockMode = newMode;
UpdateKeyboardCheckboxVisibility();
StoreUnlockMode();
return;
}
_desiredUnlockMode = newMode;
FindViewById(Resource.Id.radio_buttons).Visibility = ViewStates.Gone;
FindViewById(Resource.Id.fingerprint_auth_container).Visibility = ViewStates.Visible;
FindViewById(Resource.Id.show_keyboard_while_fingerprint).Visibility = ViewStates.Gone;
FindViewById(Resource.Id.fingerprint_auth_container).Visibility = ViewStates.Visible;
_enc = new FingerprintEncryption(new FingerprintModule(this), CurrentPreferenceKey);
try
{
@ -289,6 +317,8 @@ namespace keepass2android
FindViewById(Resource.Id.fingerprint_auth_container).Visibility = ViewStates.Gone;
StoreUnlockMode();
UpdateKeyboardCheckboxVisibility();
}, SUCCESS_DELAY_MILLIS);

View File

@ -1733,12 +1733,7 @@ namespace keepass2android
}
EditText pwd = FindViewById<EditText>(Resource.Id.password_edit);
pwd.PostDelayed(() =>
{
InputMethodManager keyboard = (InputMethodManager)GetSystemService(Context.InputMethodService);
keyboard.ShowSoftInput(pwd, 0);
}, 50);
View killButton = FindViewById(Resource.Id.kill_app);
if (PreferenceManager.GetDefaultSharedPreferences(this)
@ -1811,19 +1806,33 @@ namespace keepass2android
}
}
bool showKeyboard = (Util.GetShowKeyboardDuringFingerprintUnlock(this));
if (_fingerprintPermissionGranted)
{
InitFingerprintUnlock();
if (!InitFingerprintUnlock())
showKeyboard = true;
}
else
{
FindViewById<ImageButton>(Resource.Id.fingerprintbtn).Visibility = ViewStates.Gone;
showKeyboard = true;
}
EditText pwd = (EditText)FindViewById(Resource.Id.password_edit);
pwd.PostDelayed(() =>
{
InputMethodManager keyboard = (InputMethodManager)GetSystemService(Context.InputMethodService);
if (showKeyboard)
keyboard.ShowSoftInput(pwd, 0);
else
keyboard.HideSoftInputFromWindow(pwd.WindowToken, HideSoftInputFlags.ImplicitOnly);
}, 50);
}
private void InitFingerprintUnlock()
private bool InitFingerprintUnlock()
{
var btn = FindViewById<ImageButton>(Resource.Id.fingerprintbtn);
try
@ -1834,7 +1843,7 @@ namespace keepass2android
if (um != FingerprintUnlockMode.FullUnlock)
{
return;
return false;
}
FingerprintModule fpModule = new FingerprintModule(this);
@ -1847,6 +1856,7 @@ namespace keepass2android
{
btn.SetImageResource(Resource.Drawable.ic_fp_40px);
_fingerprintDec.StartListening(new FingerprintAuthCallbackAdapter(this, this));
return true;
}
else
{
@ -1856,6 +1866,7 @@ namespace keepass2android
_fingerprintDec = null;
ClearFingerprintUnlockData();
return false;
}
}
catch (Exception e)
@ -1864,6 +1875,7 @@ namespace keepass2android
btn.Tag = "Error initializing Fingerprint Unlock: " + e;
_fingerprintDec = null;
return false;
}

View File

@ -213,7 +213,7 @@ namespace keepass2android
}
private void InitFingerprintUnlock()
private bool InitFingerprintUnlock()
{
Kp2aLog.Log("InitFingerprintUnlock");
var btn = FindViewById<ImageButton>(Resource.Id.fingerprintbtn);
@ -225,7 +225,7 @@ namespace keepass2android
if (um == FingerprintUnlockMode.Disabled)
{
return;
return false;
}
if (_fingerprintPermissionGranted)
@ -254,7 +254,7 @@ namespace keepass2android
{
Kp2aLog.Log("trying Samsung Fingerprint API...failed.");
FindViewById<ImageButton>(Resource.Id.fingerprintbtn).Visibility = ViewStates.Gone;
return;
return false;
}
}
btn.Tag = GetString(Resource.String.fingerprint_unlock_hint);
@ -264,6 +264,7 @@ namespace keepass2android
Kp2aLog.Log("successfully initialized fingerprint.");
btn.SetImageResource(Resource.Drawable.ic_fp_40px);
_fingerprintIdentifier.StartListening(this, this);
return true;
}
else
{
@ -284,7 +285,7 @@ namespace keepass2android
_fingerprintIdentifier = null;
}
return false;
}
@ -335,19 +336,29 @@ namespace keepass2android
CheckIfUnloaded();
EditText pwd = (EditText) FindViewById(Resource.Id.QuickUnlock_password);
bool showKeyboard = ((!InitFingerprintUnlock()) || (Util.GetShowKeyboardDuringFingerprintUnlock(this)));
EditText pwd = (EditText)FindViewById(Resource.Id.QuickUnlock_password);
pwd.PostDelayed(() =>
{
InputMethodManager keyboard = (InputMethodManager) GetSystemService(Context.InputMethodService);
{
InputMethodManager keyboard = (InputMethodManager)GetSystemService(Context.InputMethodService);
if (showKeyboard)
keyboard.ShowSoftInput(pwd, 0);
}, 50);
else
keyboard.HideSoftInputFromWindow(pwd.WindowToken, HideSoftInputFlags.ImplicitOnly);
}, 50);
InitFingerprintUnlock();
}
protected override void OnPause()
{
base.OnPause();

View File

@ -67,6 +67,12 @@
app:title_text="@string/enable_fingerprint_unlock"
android:background="?android:attr/selectableItemBackground" />
</LinearLayout>
<CheckBox
android:id="@+id/show_keyboard_while_fingerprint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:text="@string/ShowKeyboardDuringFingerprintAuth" />
</LinearLayout>
<RelativeLayout
android:id="@+id/fingerprint_auth_container"

View File

@ -78,7 +78,8 @@
<bool name="ShowUsernameInList_default">true</bool>
<bool name="ShowGroupnameInSearchResult_default">true</bool>
<string name="ViewDatabaseSecure_key">ViewDatabaseSecure</string>
<bool name="RememberRecentFiles_default">true</bool>
<string name="ShowKeyboardWhileFingerprint_key">ShowKeyboardWhileFingerprint_key</string>
<bool name="RememberRecentFiles_default">true</bool>
<string name="TrayTotp_SettingsField_key">TrayTotp_SettingsField_key</string>
<string name="TrayTotp_SeedField_key">TrayTotp_SeedField_key</string>
<string name="TrayTotp_prefs_key">TrayTotp_prefs_key</string>

View File

@ -655,14 +655,21 @@
<string name="ActivateAutoFillService_btnKeyboard">Use built-in keyboard</string>
<string name="ActivateAutoFillService_btnAutoFill">Use AutoFill service</string>
<string name="ActivateAutoFillService_toast">Please enable the Keepass2Android service.</string>
<string name="ShowKeyboardDuringFingerprintAuth">Show soft keyboard for password input when fingerprint scan is active.</string>
<string name="ChangeLog_0_9_8c">
Version 0.9.8c\n
* Fix for SSL vulnerability in Microsoft Live SDK (used when accessing files via OneDrive)\n
* Bug fix: Previous release contained two input methods (one crashing)\n
</string>
<string name="ChangeLog_1_0_0">
<string name="ChangeLog_1_0_0e">
Version 1.0.0e\n
* fix for Fingerprint Unlock on older Samsung devices with Android 6\n
* add native support for x86 devices\n
* allow to hide softkeyboard during fingerprint scan\n
* build system update
</string>
<string name="ChangeLog_1_0_0">
Version 1.0.0\n
* Fingerprint Unlock (requires Android 6.0+ or a Samsung device)\n
* Added Auto-Fill service (requires Android 5.0+)\n

View File

@ -490,6 +490,13 @@ namespace keepass2android
}
}
public static bool GetShowKeyboardDuringFingerprintUnlock(Context ctx)
{
return (PreferenceManager.GetDefaultSharedPreferences(ctx).GetBoolean(
ctx.GetString(Resource.String.ShowKeyboardWhileFingerprint_key), true));
}
public static void MoveBottomBarButtons(int btn1Id, int btn2Id, int bottomBarId, Activity context)
{

View File

@ -48,7 +48,7 @@
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<ConsolePause>False</ConsolePause>
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis>
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86,x86_64</AndroidSupportedAbis>
<CustomCommands>
<CustomCommands>
<Command type="BeforeBuild" command="UseManifestNet.bat" />
@ -58,18 +58,16 @@
<DefineConstants>RELEASE</DefineConstants>
<AndroidLinkSkip>System.Core%3b</AndroidLinkSkip>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
<AndroidStoreUncompressedFileExtensions>
</AndroidStoreUncompressedFileExtensions>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<BundleAssemblies>False</BundleAssemblies>
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
<MandroidI18n />
<Debugger>Xamarin</Debugger>
<AotAssemblies>False</AotAssemblies>
<EnableLLVM>False</EnableLLVM>
<AndroidEnableMultiDex>False</AndroidEnableMultiDex>
<EnableProguard>False</EnableProguard>
<DevInstrumentationEnabled>False</DevInstrumentationEnabled>
<DebugSymbols>False</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseNoNet|AnyCPU' ">
<DebugType>none</DebugType>
@ -91,6 +89,7 @@
</AndroidStoreUncompressedFileExtensions>
</PropertyGroup>
<ItemGroup>
<Reference Include="Java.Interop" />
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />