mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-04-04 21:37:37 +03:00
Add fingerprint dialog and update icons
This commit is contained in:
parent
8536586c13
commit
05a5da4c8d
19 changed files with 705 additions and 59 deletions
|
@ -66,4 +66,5 @@ dependencies {
|
|||
compile "com.madgag.spongycastle:core:$spongycastleVersion"
|
||||
compile "com.madgag.spongycastle:prov:$spongycastleVersion"
|
||||
compile "joda-time:joda-time:2.9.9"
|
||||
compile "org.sufficientlysecure:html-textview:3.5"
|
||||
}
|
||||
|
|
|
@ -44,11 +44,10 @@ import android.widget.Button;
|
|||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.kunzisoft.keepass.KeePass;
|
||||
import com.kunzisoft.keepass.R;
|
||||
import com.keepassdroid.app.App;
|
||||
import com.keepassdroid.compat.BackupManagerCompat;
|
||||
import com.keepassdroid.compat.ClipDataCompat;
|
||||
|
@ -58,6 +57,7 @@ import com.keepassdroid.database.edit.LoadDB;
|
|||
import com.keepassdroid.database.edit.OnFinish;
|
||||
import com.keepassdroid.dialog.PasswordEncodingDialogHelper;
|
||||
import com.keepassdroid.fileselect.BrowserDialog;
|
||||
import com.keepassdroid.fingerprint.FingerPrintAnimatedVector;
|
||||
import com.keepassdroid.fingerprint.FingerPrintHelper;
|
||||
import com.keepassdroid.intents.Intents;
|
||||
import com.keepassdroid.utils.EmptyUtils;
|
||||
|
@ -65,6 +65,9 @@ import com.keepassdroid.utils.Interaction;
|
|||
import com.keepassdroid.utils.MenuUtil;
|
||||
import com.keepassdroid.utils.UriUtil;
|
||||
import com.keepassdroid.utils.Util;
|
||||
import com.keepassdroid.view.FingerPrintDialog;
|
||||
import com.kunzisoft.keepass.KeePass;
|
||||
import com.kunzisoft.keepass.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -96,8 +99,10 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
|
|||
private int mode;
|
||||
private static final String PREF_KEY_VALUE_PREFIX = "valueFor_"; // key is a combination of db file name and this prefix
|
||||
private static final String PREF_KEY_IV_PREFIX = "ivFor_"; // key is a combination of db file name and this prefix
|
||||
private View fingerprintView;
|
||||
private TextView confirmationView;
|
||||
private View fingerprintContainerView;
|
||||
private View fingerprintImageView;
|
||||
private FingerPrintAnimatedVector fingerPrintAnimatedVector;
|
||||
private TextView fingerprintTextView;
|
||||
private EditText passwordView;
|
||||
private Button confirmButton;
|
||||
|
||||
|
@ -205,10 +210,16 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
|
|||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
|
||||
confirmButton = (Button) findViewById(R.id.pass_ok);
|
||||
fingerprintView = findViewById(R.id.fingerprint);
|
||||
confirmationView = (TextView) findViewById(R.id.fingerprint_label);
|
||||
fingerprintContainerView = findViewById(R.id.fingerprint_container);
|
||||
fingerprintImageView = findViewById(R.id.fingerprint_image);
|
||||
fingerprintTextView = (TextView) findViewById(R.id.fingerprint_label);
|
||||
passwordView = (EditText) findViewById(R.id.password);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
fingerPrintAnimatedVector = new FingerPrintAnimatedVector(this,
|
||||
(ImageView) fingerprintImageView);
|
||||
}
|
||||
|
||||
new InitTask().execute(i);
|
||||
}
|
||||
|
||||
|
@ -216,6 +227,11 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||
&& fingerPrintAnimatedVector != null) {
|
||||
fingerPrintAnimatedVector.startScan();
|
||||
}
|
||||
|
||||
// If the application was shutdown make sure to clear the password field, if it
|
||||
// was saved in the instance state
|
||||
if (App.isShutdown()) {
|
||||
|
@ -287,7 +303,7 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
|
|||
if ( !fingerprintMustBeConfigured ) {
|
||||
final boolean validInput = s.length() > 0;
|
||||
// encrypt or decrypt mode based on how much input or not
|
||||
confirmationView.setText(validInput ? R.string.store_with_fingerprint : R.string.scanning_fingerprint);
|
||||
fingerprintTextView.setText(validInput ? R.string.store_with_fingerprint : R.string.scanning_fingerprint);
|
||||
mode = validInput ? toggleMode(Cipher.ENCRYPT_MODE) : toggleMode(Cipher.DECRYPT_MODE);
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +320,7 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
|
|||
// errorCode = 5
|
||||
// errString = "Fingerprint operation canceled."
|
||||
//onFingerprintException();
|
||||
//confirmationView.setText(errString);
|
||||
//fingerprintTextView.setText(errString);
|
||||
// true false fingerprint readings are handled otherwise with the toast messages, see below in code
|
||||
}
|
||||
|
||||
|
@ -314,7 +330,7 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
|
|||
final CharSequence helpString) {
|
||||
|
||||
onFingerprintException(new Exception("onAuthenticationHelp"));
|
||||
confirmationView.setText(helpString);
|
||||
fingerprintTextView.setText(helpString);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -370,6 +386,12 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
|
|||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||
&& fingerPrintAnimatedVector != null) {
|
||||
fingerPrintAnimatedVector.stopScan();
|
||||
}
|
||||
|
||||
// stop listening when we go in background
|
||||
if (fingerPrintHelper != null) {
|
||||
fingerPrintHelper.stopListening();
|
||||
|
@ -377,42 +399,48 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
|
|||
}
|
||||
|
||||
private void setFingerPrintVisibility(int vis) {
|
||||
fingerprintView.setVisibility(vis);
|
||||
confirmationView.setVisibility(vis);
|
||||
fingerprintContainerView.setVisibility(vis);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
private void checkAvailability() {
|
||||
|
||||
// fingerprint not supported (by API level or hardware) so keep option hidden
|
||||
if (!fingerPrintHelper.isFingerprintSupported(FingerprintManagerCompat.from(this))) {
|
||||
setFingerPrintVisibility(View.GONE);
|
||||
}
|
||||
// fingerprint is available but not configured show icon but in disabled state with some information
|
||||
else if (!fingerPrintHelper.hasEnrolledFingerprints()) {
|
||||
|
||||
setFingerPrintVisibility(View.VISIBLE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
fingerprintView.setAlpha(0.3f);
|
||||
}
|
||||
// This happens when no fingerprints are registered. Listening won't start
|
||||
confirmationView.setText(R.string.configure_fingerprint);
|
||||
}
|
||||
// finally fingerprint available and configured so we can use it
|
||||
else {
|
||||
fingerprintMustBeConfigured = false;
|
||||
// show explanations
|
||||
fingerprintContainerView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FingerPrintDialog fingerPrintDialog = new FingerPrintDialog();
|
||||
fingerPrintDialog.show(getSupportFragmentManager(), "fingerprintDialog");
|
||||
}
|
||||
});
|
||||
setFingerPrintVisibility(View.VISIBLE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
fingerprintView.setAlpha(1f);
|
||||
|
||||
if (!fingerPrintHelper.hasEnrolledFingerprints()) {
|
||||
fingerprintImageView.setAlpha(0.3f);
|
||||
// This happens when no fingerprints are registered. Listening won't start
|
||||
fingerprintTextView.setText(R.string.configure_fingerprint);
|
||||
}
|
||||
// fingerprint available but no stored password found yet for this DB so show info don't listen
|
||||
if (prefsNoBackup.getString(getPreferenceKeyValue(), null) == null) {
|
||||
confirmationView.setText(R.string.no_password_stored);
|
||||
}
|
||||
// all is set here so we can confirm to user and start listening for fingerprints
|
||||
// finally fingerprint available and configured so we can use it
|
||||
else {
|
||||
confirmationView.setText(R.string.scanning_fingerprint);
|
||||
// listen for decryption by default
|
||||
toggleMode(Cipher.DECRYPT_MODE);
|
||||
fingerprintMustBeConfigured = false;
|
||||
fingerprintImageView.setAlpha(1f);
|
||||
|
||||
// fingerprint available but no stored password found yet for this DB so show info don't listen
|
||||
if (prefsNoBackup.getString(getPreferenceKeyValue(), null) == null) {
|
||||
fingerprintTextView.setText(R.string.no_password_stored);
|
||||
}
|
||||
// all is set here so we can confirm to user and start listening for fingerprints
|
||||
else {
|
||||
fingerprintTextView.setText(R.string.scanning_fingerprint);
|
||||
// listen for decryption by default
|
||||
toggleMode(Cipher.DECRYPT_MODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -428,7 +456,7 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
|
|||
.apply();
|
||||
// and remove visual input to reset UI
|
||||
confirmButton.performClick();
|
||||
confirmationView.setText(R.string.encrypted_value_stored);
|
||||
fingerprintTextView.setText(R.string.encrypted_value_stored);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2017 Brian Jeremy Jamet / Kunzisoft.
|
||||
*
|
||||
* This file is part of KeePass DX.
|
||||
*
|
||||
* KeePass DX is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* KeePass DX is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.keepassdroid.fingerprint;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Animatable2;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.kunzisoft.keepass.R;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
public class FingerPrintAnimatedVector {
|
||||
|
||||
private AnimatedVectorDrawable scanFingerprint;
|
||||
|
||||
public FingerPrintAnimatedVector(Context context, ImageView imageView) {
|
||||
scanFingerprint = (AnimatedVectorDrawable) context.getDrawable(R.drawable.scan_fingerprint);
|
||||
imageView.setImageDrawable(scanFingerprint);
|
||||
}
|
||||
|
||||
public void startScan() {
|
||||
scanFingerprint.registerAnimationCallback(new Animatable2.AnimationCallback() {
|
||||
public void onAnimationEnd(Drawable drawable) {
|
||||
scanFingerprint.start();
|
||||
}
|
||||
});
|
||||
scanFingerprint.start();
|
||||
}
|
||||
|
||||
public void stopScan() {
|
||||
scanFingerprint.stop();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
|
||||
*
|
||||
* This file is part of KeePass DX.
|
||||
*
|
||||
* KeePass DX is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* KeePass DX is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.keepassdroid.view;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.keepassdroid.fingerprint.FingerPrintAnimatedVector;
|
||||
import com.kunzisoft.keepass.R;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
public class FingerPrintDialog extends DialogFragment {
|
||||
|
||||
private FingerPrintAnimatedVector fingerPrintAnimatedVector;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
|
||||
View rootView = inflater.inflate(R.layout.fingerprint_dialog, null);
|
||||
|
||||
View fingerprintSettingWayTextView = rootView.findViewById(R.id.fingerprint_setting_way_text);
|
||||
fingerprintSettingWayTextView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(new Intent(android.provider.Settings.ACTION_SECURITY_SETTINGS));
|
||||
}
|
||||
});
|
||||
|
||||
fingerPrintAnimatedVector =
|
||||
new FingerPrintAnimatedVector(getContext(),
|
||||
(ImageView) rootView.findViewById(R.id.fingerprint_image));
|
||||
|
||||
builder.setView(rootView)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
fingerPrintAnimatedVector.startScan();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
fingerPrintAnimatedVector.stopScan();
|
||||
}
|
||||
}
|
39
app/src/main/res/animator-v23/scan.xml
Normal file
39
app/src/main/res/animator-v23/scan.xml
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:ordering="sequentially">
|
||||
|
||||
<objectAnimator
|
||||
android:propertyName="pathData"
|
||||
android:valueFrom="@string/clip_path_scan_top"
|
||||
android:valueTo="@string/clip_path_scan_bottom"
|
||||
android:valueType="pathType"
|
||||
android:duration="800"
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in" />
|
||||
|
||||
<objectAnimator
|
||||
android:propertyName="pathData"
|
||||
android:valueFrom="@string/clip_path_scan_bottom"
|
||||
android:valueTo="@string/clip_path_scan_top"
|
||||
android:valueType="pathType"
|
||||
android:startOffset="50"
|
||||
android:duration="500"
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in" />
|
||||
|
||||
</set>
|
65
app/src/main/res/drawable-v23/fingerprint.xml
Normal file
65
app/src/main/res/drawable-v23/fingerprint.xml
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="@dimen/fingerprint_width"
|
||||
android:height="@dimen/fingerprint_height"
|
||||
android:viewportWidth="@integer/fingerprint_viewport_width"
|
||||
android:viewportHeight="@integer/fingerprint_viewport_height">
|
||||
|
||||
<group
|
||||
android:name="fingerprint"
|
||||
android:pivotX="@integer/fingerprint_viewport_center"
|
||||
android:pivotY="@integer/fingerprint_viewport_center">
|
||||
|
||||
<path
|
||||
android:name="ridge_1"
|
||||
android:pathData="@string/path_ridge_1"
|
||||
android:strokeColor="@color/fingerprint_ridge"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_2"
|
||||
android:pathData="@string/path_ridge_2"
|
||||
android:strokeColor="@color/fingerprint_ridge"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_3"
|
||||
android:pathData="@string/path_ridge_3"
|
||||
android:strokeColor="@color/fingerprint_ridge"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_4"
|
||||
android:pathData="@string/path_ridge_4"
|
||||
android:strokeColor="@color/fingerprint_ridge"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_5"
|
||||
android:pathData="@string/path_ridge_5"
|
||||
android:strokeColor="@color/fingerprint_ridge"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
</group>
|
||||
|
||||
</vector>
|
109
app/src/main/res/drawable-v23/fingerprint_scan.xml
Normal file
109
app/src/main/res/drawable-v23/fingerprint_scan.xml
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="@dimen/fingerprint_width"
|
||||
android:height="@dimen/fingerprint_height"
|
||||
android:viewportWidth="@integer/fingerprint_viewport_width"
|
||||
android:viewportHeight="@integer/fingerprint_viewport_height">
|
||||
|
||||
<group
|
||||
android:name="fingerprint">
|
||||
|
||||
<path
|
||||
android:name="ridge_1"
|
||||
android:pathData="@string/path_ridge_1"
|
||||
android:strokeColor="@color/fingerprint_ridge"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_2"
|
||||
android:pathData="@string/path_ridge_2"
|
||||
android:strokeColor="@color/fingerprint_ridge"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_3"
|
||||
android:pathData="@string/path_ridge_3"
|
||||
android:strokeColor="@color/fingerprint_ridge"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_4"
|
||||
android:pathData="@string/path_ridge_4"
|
||||
android:strokeColor="@color/fingerprint_ridge"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_5"
|
||||
android:pathData="@string/path_ridge_5"
|
||||
android:strokeColor="@color/fingerprint_ridge"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
</group>
|
||||
|
||||
<!-- we overlay the above with a duplicate of the fingerprint which is colored differently
|
||||
and uses a clip to only reveal portions at a time. -->
|
||||
<group
|
||||
android:name="fingerprint_scan">
|
||||
|
||||
<clip-path
|
||||
android:name="scan_clip"
|
||||
android:pathData="@string/clip_path_scan_top" />
|
||||
|
||||
<path
|
||||
android:name="ridge_1"
|
||||
android:pathData="@string/path_ridge_1"
|
||||
android:strokeColor="@color/fingerprint_ridge_scan"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_2"
|
||||
android:pathData="@string/path_ridge_2"
|
||||
android:strokeColor="@color/fingerprint_ridge_scan"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_3"
|
||||
android:pathData="@string/path_ridge_3"
|
||||
android:strokeColor="@color/fingerprint_ridge_scan"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_4"
|
||||
android:pathData="@string/path_ridge_4"
|
||||
android:strokeColor="@color/fingerprint_ridge_scan"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
<path
|
||||
android:name="ridge_5"
|
||||
android:pathData="@string/path_ridge_5"
|
||||
android:strokeColor="@color/fingerprint_ridge_scan"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeWidth="@integer/fingerprint_stroke_width" />
|
||||
|
||||
</group>
|
||||
|
||||
</vector>
|
12
app/src/main/res/drawable-v23/lock_open.xml
Normal file
12
app/src/main/res/drawable-v23/lock_open.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@drawable/circle"
|
||||
/>
|
||||
<item
|
||||
android:drawable="@drawable/ic_lock_open_white_24dp"
|
||||
android:bottom="12dp"
|
||||
android:left="12dp"
|
||||
android:right="12dp"
|
||||
android:top="12dp"/>
|
||||
</layer-list>
|
26
app/src/main/res/drawable-v23/scan_fingerprint.xml
Normal file
26
app/src/main/res/drawable-v23/scan_fingerprint.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<animated-vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/fingerprint_scan">
|
||||
|
||||
<target
|
||||
android:name="scan_clip"
|
||||
android:animation="@animator/scan" />
|
||||
|
||||
</animated-vector>
|
6
app/src/main/res/drawable/circle.xml
Normal file
6
app/src/main/res/drawable/circle.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid
|
||||
android:color="@color/green"/>
|
||||
</shape>
|
9
app/src/main/res/drawable/ic_lock_open_white_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_lock_open_white_24dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h1.9c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM18,20L6,20L6,10h12v10z"/>
|
||||
</vector>
|
BIN
app/src/main/res/drawable/type_assword.png
Normal file
BIN
app/src/main/res/drawable/type_assword.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
136
app/src/main/res/layout/fingerprint_dialog.xml
Normal file
136
app/src/main/res/layout/fingerprint_dialog.xml
Normal file
|
@ -0,0 +1,136 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/default_margin">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Title"
|
||||
android:text="@string/fingerprint_quick_unlock_title"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.WarningTextStyle"
|
||||
android:text="@string/chapter_1"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/fingerprint_setting_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dp"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TinyText"
|
||||
android:text="@string/fingerprint_setting_text"/>
|
||||
<TextView
|
||||
android:id="@+id/fingerprint_setting_way_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TinyText"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/fingerprint_setting_way_text"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="12dp">
|
||||
<TextView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.WarningTextStyle"
|
||||
android:text="@string/chapter_2"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TinyText"
|
||||
android:padding="5dp"
|
||||
android:text="@string/fingerprint_type_password_text"/>
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="38dp"
|
||||
android:src="@drawable/type_assword"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="12dp">
|
||||
<TextView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.WarningTextStyle"
|
||||
android:text="@string/chapter_3" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TinyText"
|
||||
android:padding="5dp"
|
||||
android:text="@string/fingerprint_scan_to_store"/>
|
||||
</LinearLayout>
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/fingerprint_image"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:elevation="4dp"
|
||||
android:src="@drawable/fingerprint"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?attr/colorAccent"
|
||||
tools:targetApi="lollipop" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Title"
|
||||
android:text="@string/usage" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TinyText"
|
||||
android:padding="5dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/fingerprint_scan_to_open"/>
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:elevation="4dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/lock_open"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?attr/colorPrimary"
|
||||
tools:targetApi="lollipop" />
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
|
@ -79,40 +79,46 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/entry_and_or" />
|
||||
|
||||
<!-- added these 2 fingerprint related views -->
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/fingerprint"
|
||||
android:layout_width="wrap_content"
|
||||
<!-- Fingerprint -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/fingerprint_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/margin_small"
|
||||
android:layout_marginRight="@dimen/margin_small"
|
||||
android:layout_below="@id/password_label"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/ic_fp_40px"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
/>
|
||||
android:layout_below="@id/password_label">
|
||||
<!-- added these 2 fingerprint related views -->
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/fingerprint_image"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_margin="4dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:elevation="4dp"
|
||||
android:src="@drawable/fingerprint"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?attr/colorAccent"
|
||||
tools:targetApi="lollipop" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fingerprint_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/fingerprint_image"
|
||||
android:layout_toStartOf="@+id/fingerprint_image"
|
||||
android:gravity="center_vertical|end"
|
||||
android:text="@string/entry_and_or"
|
||||
android:textColor="?attr/colorAccent"
|
||||
tools:visibility="visible" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fingerprint_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/fingerprint"
|
||||
android:layout_below="@+id/password_label"
|
||||
android:layout_toLeftOf="@id/fingerprint"
|
||||
android:layout_toStartOf="@id/fingerprint"
|
||||
android:gravity="center_vertical|end"
|
||||
android:text="@string/entry_and_or"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!-- Password Input -->
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/password_input_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/fingerprint_label"
|
||||
android:layout_below="@id/fingerprint_container"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="?attr/colorAccent">
|
||||
|
||||
|
|
|
@ -208,6 +208,13 @@
|
|||
<string name="list_password_generator_options_summary">Définir les caractères par défaut du générateur de mot de passe</string>
|
||||
<string name="clipboard_notifications_title">Notifications du presse-papiers</string>
|
||||
<string name="clipboard_notifications_summary">Activer les notifications du presse-papiers pour copier le nom d\'utilisateur et le mot de passe</string>
|
||||
<string name="fingerprint_quick_unlock_title">Comment configurer l\'empreinte digitale pour un déverrouillage rapide?</string>
|
||||
<string name="fingerprint_setting_text">Définissez votre empreinte digitale personnelle pour votre appareil dans </string>
|
||||
<string name="fingerprint_setting_way_text">Paramètres -> Sécurité -> Empreinte digitale</string>
|
||||
<string name="fingerprint_type_password_text">Tapez votre mot de passe dans Keepass DX</string>
|
||||
<string name="fingerprint_scan_to_store">Scannez votre empreinte digitale pour stocker votre mot de passe maître en toute sécurité</string>
|
||||
<string name="fingerprint_scan_to_open">Il suffit de scanner votre empreinte digitale dans Keepass DX lorsque le champ mot de passe est vide pour ouvrir la base de données</string>
|
||||
<string name="usage">Usage</string>
|
||||
|
||||
<string-array name="clipboard_timeout_options">
|
||||
<item>30 secondes</item>
|
||||
|
|
51
app/src/main/res/values-v23/fingerprint.xml
Normal file
51
app/src/main/res/values-v23/fingerprint.xml
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<integer name="fingerprint_viewport_width">160</integer>
|
||||
<integer name="fingerprint_viewport_height">160</integer>
|
||||
<integer name="fingerprint_viewport_center">80</integer>
|
||||
<integer name="fingerprint_stroke_width">5</integer>
|
||||
<integer name="tick_cross_stroke_width">7</integer>
|
||||
<dimen name="fingerprint_width">80dp</dimen>
|
||||
<dimen name="fingerprint_height">80dp</dimen>
|
||||
|
||||
<!-- a pretty rough & ready re-draw of the fingerprint glyph from
|
||||
https://github.com/googlesamples/android-FingerprintDialog -->
|
||||
<string name="path_ridge_1">M56.2199243,45.3815903 C56.2199243,45.3815903 65.1913567,38.8543184 80.3604294,38.8543184 C95.5295022,38.8543184 103.720044,45.2851323 103.720044,45.2851323</string>
|
||||
<string name="path_ridge_2">M45.5181172,67.9181841 C49.9761548,62.7019025 59.122049,49.7790452 80.2279027,49.7790452 C101.333756,49.7790452 110.740506,62.0384399 114.937688,67.9181841</string>
|
||||
<string name="path_ridge_3">M51.7375623,107.718438 C51.7375623,107.718438 48.7129745,99.6302234 48.7129745,91.6334356 C48.7129745,81.3266864 55.9028711,60.2476586 80.4057228,60.2478671 C100.798248,60.2480407 112.457463,79.7942647 112.457463,88.386575 C112.457462,99.2963939 105.619846,103.039218 100.781849,102.18762 C95.9438519,101.336021 90.4490979,97.2187731 91.0639139,92.3178681 C91.67873,87.4169631 85.2177374,81.3265129 80.7504553,81.3266871 C73.0900115,81.3269859 69.8146331,85.3921834 69.8146329,92.2700585 C69.8146324,107.718437 83.7557525,121.02713 91.6787289,121.027128</string>
|
||||
<string name="path_ridge_4">M70.7357889,121.024995 C70.7357889,121.024995 57.4650216,106.018711 58.8888756,91.5596242 C60.5513085,74.6777941 73.9858126,70.313752 80.3788823,70.3807995 C86.771952,70.4478469 101.550994,76.8218704 101.550997,92.2895418</string>
|
||||
<string name="path_ridge_5">M80.1599645,91.1813411 C80.1599645,91.1813411 81.1144795,102.68333 86.7971146,107.529716 C93.2390527,113.023667 105.911091,112.342743 105.911091,112.342743</string>
|
||||
|
||||
<string name="path_tick">M52.2735573,79.0771904 C52.2735573,79.0771904 69.2403688,96.0440006 69.2403683,96.0440014 C69.2403679,96.0440021 109.820188,55.4641819 109.820188,55.4641819</string>
|
||||
|
||||
<string name="path_cross_1">M62,62 C62,62 80.5647617,80.5647617 80.564762,80.564762 C80.5647622,80.5647622 94.2921789,94.223714 98.5644262,98.5644262</string>
|
||||
<string name="path_cross_2">M98.5644262,62 C98.5644251,62 81.1979242,79.366503 81.1979229,79.3665033 C81.1979216,79.3665035 62,98.5644262 62,98.5644262</string>
|
||||
|
||||
<!-- a 'window' which is ¼ of the height of the viewport that we use as a clip during the 'scan'
|
||||
operation by animating it from the top to the bottom and back. -->
|
||||
<string name="clip_path_scan_top">M0 0 L160 0 L160 40 L0 40 Z</string>
|
||||
<string name="clip_path_scan_bottom">M0 120 L160 120 L160 160 L0 160 Z</string>
|
||||
|
||||
<color name="fingerprint_ridge">#deffffff</color>
|
||||
<color name="fingerprint_ridge_scan">#ffffffff</color>
|
||||
|
||||
<color name="circle_default">#ff607d8b</color>
|
||||
|
||||
</resources>
|
|
@ -126,4 +126,10 @@
|
|||
<item translatable="false">@string/special</item>
|
||||
<item translatable="false">@string/brackets</item>
|
||||
</string-array>
|
||||
|
||||
<string name="chapter_1">I</string>
|
||||
<string name="chapter_2">II</string>
|
||||
<string name="chapter_3">III</string>
|
||||
<string name="chapter_4">IV</string>
|
||||
<string name="chapter_5">V</string>
|
||||
</resources>
|
||||
|
|
|
@ -208,6 +208,13 @@
|
|||
<string name="list_password_generator_options_summary">Set the default password generator characters</string>
|
||||
<string name="clipboard_notifications_title">Clipboard Notifications</string>
|
||||
<string name="clipboard_notifications_summary">Enable clipboard notifications to copy username and password</string>
|
||||
<string name="fingerprint_quick_unlock_title">How to configure fingerprint for quick unlocking ?</string>
|
||||
<string name="fingerprint_setting_text">Set your personnal fingerprint for your device in </string>
|
||||
<string name="fingerprint_setting_way_text">Settings -> Security -> Fingerprint</string>
|
||||
<string name="fingerprint_type_password_text">Type your password in Keepass DX</string>
|
||||
<string name="fingerprint_scan_to_store">Scan your fingerprint to store your master password securely</string>
|
||||
<string name="fingerprint_scan_to_open">Just scan your fingerprint in Keepass DX when the password field is empty to open the database</string>
|
||||
<string name="usage">Usage</string>
|
||||
|
||||
<string-array name="clipboard_timeout_options">
|
||||
<item>30 seconds</item>
|
||||
|
|
BIN
art/TypePassword.png
Normal file
BIN
art/TypePassword.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Loading…
Add table
Add a link
Reference in a new issue