Implemented logging in / setting authentication method when pressing enter
This commit is contained in:
parent
0a6fa8e01a
commit
26baf222d6
|
@ -9,6 +9,7 @@ import net.dankito.banking.ui.android.R
|
||||||
import net.dankito.banking.ui.android.authentication.AuthenticationService
|
import net.dankito.banking.ui.android.authentication.AuthenticationService
|
||||||
import net.dankito.banking.ui.android.authentication.AuthenticationType
|
import net.dankito.banking.ui.android.authentication.AuthenticationType
|
||||||
import net.dankito.banking.ui.android.di.BankingComponent
|
import net.dankito.banking.ui.android.di.BankingComponent
|
||||||
|
import net.dankito.banking.ui.android.extensions.addEnterPressedListener
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +37,11 @@ open class LoginActivity : BaseActivity() {
|
||||||
if (authenticationService.authenticationType == AuthenticationType.Password) {
|
if (authenticationService.authenticationType == AuthenticationType.Password) {
|
||||||
lytBiometricAuthentication.visibility = View.GONE
|
lytBiometricAuthentication.visibility = View.GONE
|
||||||
|
|
||||||
|
edtxtLoginPassword.actualEditText.addEnterPressedListener {
|
||||||
|
checkEnteredPasswordAndLogIn()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
btnLogin.setOnClickListener { checkEnteredPasswordAndLogIn() }
|
btnLogin.setOnClickListener { checkEnteredPasswordAndLogIn() }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.dankito.banking.ui.android.R
|
||||||
import net.dankito.banking.ui.android.authentication.AuthenticationService
|
import net.dankito.banking.ui.android.authentication.AuthenticationService
|
||||||
import net.dankito.banking.ui.android.authentication.AuthenticationType
|
import net.dankito.banking.ui.android.authentication.AuthenticationType
|
||||||
import net.dankito.banking.ui.android.di.BankingComponent
|
import net.dankito.banking.ui.android.di.BankingComponent
|
||||||
|
import net.dankito.banking.ui.android.extensions.addEnterPressedListener
|
||||||
import net.dankito.banking.ui.android.util.StandardTextWatcher
|
import net.dankito.banking.ui.android.util.StandardTextWatcher
|
||||||
import net.dankito.utils.android.extensions.hideKeyboardDelayed
|
import net.dankito.utils.android.extensions.hideKeyboardDelayed
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
@ -89,7 +90,9 @@ open class ProtectAppSettingsDialog : SettingsDialogBase() {
|
||||||
btnBiometricAuthentication.authenticationSuccessful = { btnSetAuthenticationMethod.isEnabled = true }
|
btnBiometricAuthentication.authenticationSuccessful = { btnSetAuthenticationMethod.isEnabled = true }
|
||||||
|
|
||||||
edtxtPassword.actualEditText.addTextChangedListener(StandardTextWatcher { checkIfEnteredPasswordsMatch() } )
|
edtxtPassword.actualEditText.addTextChangedListener(StandardTextWatcher { checkIfEnteredPasswordsMatch() } )
|
||||||
|
edtxtPassword.actualEditText.addEnterPressedListener { checkIfEnteredPasswordsMatchAndSetAuthenticationMethod() }
|
||||||
edtxtPasswordConfirmation.actualEditText.addTextChangedListener(StandardTextWatcher { checkIfEnteredPasswordsMatch() } )
|
edtxtPasswordConfirmation.actualEditText.addTextChangedListener(StandardTextWatcher { checkIfEnteredPasswordsMatch() } )
|
||||||
|
edtxtPasswordConfirmation.actualEditText.addEnterPressedListener { checkIfEnteredPasswordsMatchAndSetAuthenticationMethod() }
|
||||||
|
|
||||||
btnSetAuthenticationMethod.setOnClickListener { setAuthenticationMethod() }
|
btnSetAuthenticationMethod.setOnClickListener { setAuthenticationMethod() }
|
||||||
|
|
||||||
|
@ -125,14 +128,26 @@ open class ProtectAppSettingsDialog : SettingsDialogBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected open fun checkIfEnteredPasswordsMatch() {
|
protected open fun checkIfEnteredPasswordsMatchAndSetAuthenticationMethod(): Boolean {
|
||||||
|
if (checkIfEnteredPasswordsMatch()) {
|
||||||
|
setAuthenticationMethod()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
protected open fun checkIfEnteredPasswordsMatch(): Boolean {
|
||||||
val enteredPassword = edtxtPassword.text
|
val enteredPassword = edtxtPassword.text
|
||||||
|
|
||||||
if (enteredPassword.isNotBlank() && enteredPassword == edtxtPasswordConfirmation.text) {
|
if (enteredPassword.isNotBlank() && enteredPassword == edtxtPasswordConfirmation.text) {
|
||||||
btnSetAuthenticationMethod.isEnabled = true
|
btnSetAuthenticationMethod.isEnabled = true
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
btnSetAuthenticationMethod.isEnabled = false
|
btnSetAuthenticationMethod.isEnabled = false
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue