From e8749385ec707bf02628337d90767648cae7dcd3 Mon Sep 17 00:00:00 2001 From: dankito Date: Tue, 13 Oct 2020 17:04:54 +0200 Subject: [PATCH] Implemented hiding select authentication method if password is the only option to choose --- .../ui/android/dialogs/settings/ProtectAppSettingsDialog.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/ProtectAppSettingsDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/ProtectAppSettingsDialog.kt index ef487502..3ade3659 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/ProtectAppSettingsDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/ProtectAppSettingsDialog.kt @@ -58,8 +58,11 @@ open class ProtectAppSettingsDialog : SettingsDialogBase() { setupToolbar(this, context.getString(R.string.settings), false) } + val authenticationType = authenticationService.authenticationType val isBiometricAuthenticationSupported = authenticationService.isBiometricAuthenticationSupported + val showAuthenticationMethods = isBiometricAuthenticationSupported || authenticationType != AuthenticationType.None // hide select authentication method if password is the only option to choose + segmentedGroup.visibility = if (showAuthenticationMethods) View.VISIBLE else View.GONE segmentedGroup.doOnNextLayout { val segmentedControlButtonWidth = segmentedGroup.measuredWidth / 3 btnShowBiometricAuthenticationSection.layoutParams.width = segmentedControlButtonWidth @@ -100,7 +103,7 @@ open class ProtectAppSettingsDialog : SettingsDialogBase() { btnSetAuthenticationMethod.setOnClickListener { setAuthenticationMethod() } - if (isBiometricAuthenticationSupported && authenticationService.authenticationType == AuthenticationType.Biometric) { + if (isBiometricAuthenticationSupported && authenticationType == AuthenticationType.Biometric) { btnShowBiometricAuthenticationSection.isChecked = true } else {