From 3c0534cbc1a71b6d0e9730af7e689f508f3fa770 Mon Sep 17 00:00:00 2001 From: Brian Estrada Date: Wed, 18 Apr 2018 09:59:07 +0200 Subject: [PATCH] Added Base Fingerprint Dialog for Custom Fingerprint Dialogs --- .../nodes/locksmith/example/MainActivity.kt | 21 +- .../res/layout/dialog_custom_fingerprint.xml | 115 ++++++ app/src/main/res/values/strings.xml | 2 +- .../dk/nodes/locksmith/core/Locksmith.java | 7 +- .../core/fingerprint/FingerprintDialog.java | 387 +++--------------- .../fingerprint/FingerprintDialogBase.java | 208 ++++++++++ .../fingerprint/FingerprintDialogBuilder.java | 55 +++ .../core/models/FingerprintDialogEvent.java | 32 ++ .../OnFingerprintDialogEventListener.java | 7 + 9 files changed, 495 insertions(+), 339 deletions(-) create mode 100644 app/src/main/res/layout/dialog_custom_fingerprint.xml create mode 100644 locksmith/src/main/java/dk/nodes/locksmith/core/fingerprint/FingerprintDialogBase.java create mode 100644 locksmith/src/main/java/dk/nodes/locksmith/core/fingerprint/FingerprintDialogBuilder.java create mode 100644 locksmith/src/main/java/dk/nodes/locksmith/core/models/FingerprintDialogEvent.java create mode 100644 locksmith/src/main/java/dk/nodes/locksmith/core/models/OnFingerprintDialogEventListener.java diff --git a/app/src/main/java/dk/nodes/locksmith/example/MainActivity.kt b/app/src/main/java/dk/nodes/locksmith/example/MainActivity.kt index 9cb0fc8..07b6abe 100644 --- a/app/src/main/java/dk/nodes/locksmith/example/MainActivity.kt +++ b/app/src/main/java/dk/nodes/locksmith/example/MainActivity.kt @@ -9,10 +9,11 @@ import android.util.Log import dk.nodes.locksmith.core.Locksmith import dk.nodes.locksmith.core.exceptions.LocksmithEncryptionException import dk.nodes.locksmith.core.exceptions.LocksmithEncryptionException.Type.* -import dk.nodes.locksmith.core.fingerprint.FingerprintDialog +import dk.nodes.locksmith.core.models.FingerprintDialogEvent +import dk.nodes.locksmith.core.models.OnFingerprintDialogEventListener import kotlinx.android.synthetic.main.activity_main.* -class MainActivity : AppCompatActivity(), FingerprintDialog.OnFingerprintDialogEventListener { +class MainActivity : AppCompatActivity(), OnFingerprintDialogEventListener { private val TAG = MainActivity::class.simpleName private val originalData = "Mary had a little lamb\n" + @@ -131,27 +132,27 @@ class MainActivity : AppCompatActivity(), FingerprintDialog.OnFingerprintDialogE mainTvDecryptedData.text = currentData } - override fun onFingerprintEvent(event: FingerprintDialog.FingerprintDialogEvent) { + override fun onFingerprintEvent(event: FingerprintDialogEvent) { when (event) { - FingerprintDialog.FingerprintDialogEvent.CANCEL -> { + FingerprintDialogEvent.CANCEL -> { Log.w(TAG, "CANCEL") } - FingerprintDialog.FingerprintDialogEvent.SUCCESS -> { + FingerprintDialogEvent.SUCCESS -> { Log.w(TAG, "SUCCESS") } - FingerprintDialog.FingerprintDialogEvent.ERROR -> { + FingerprintDialogEvent.ERROR -> { Log.w(TAG, "ERROR") } - FingerprintDialog.FingerprintDialogEvent.ERROR_SECURE -> { + FingerprintDialogEvent.ERROR_SECURE -> { Log.w(TAG, "ERROR_SECURE") } - FingerprintDialog.FingerprintDialogEvent.ERROR_HARDWARE -> { + FingerprintDialogEvent.ERROR_HARDWARE -> { Log.w(TAG, "ERROR_HARDWARE") } - FingerprintDialog.FingerprintDialogEvent.ERROR_ENROLLMENT -> { + FingerprintDialogEvent.ERROR_ENROLLMENT -> { Log.w(TAG, "ERROR_ENROLLMENT") } - FingerprintDialog.FingerprintDialogEvent.ERROR_CIPHER -> { + FingerprintDialogEvent.ERROR_CIPHER -> { Log.w(TAG, "ERROR_ENROLLMENT") } } diff --git a/app/src/main/res/layout/dialog_custom_fingerprint.xml b/app/src/main/res/layout/dialog_custom_fingerprint.xml new file mode 100644 index 0000000..13db8c9 --- /dev/null +++ b/app/src/main/res/layout/dialog_custom_fingerprint.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + +