Login screens: re-click on an item submit it

This commit is contained in:
Benoit Marty 2019-11-14 21:54:03 +01:00
parent d50b690523
commit adf299081d

View file

@ -52,7 +52,7 @@ class LoginServerSelectionFragment @Inject constructor() : AbstractLoginFragment
text = getString(R.string.login_server_modular_learn_more) text = getString(R.string.login_server_modular_learn_more)
textDecorationLine = "underline" textDecorationLine = "underline"
onClick = { onClick = {
// TODO // TODO this does not work
openUrlInExternalBrowser(requireActivity(), "https://example.org") openUrlInExternalBrowser(requireActivity(), "https://example.org")
} }
} }
@ -61,17 +61,32 @@ class LoginServerSelectionFragment @Inject constructor() : AbstractLoginFragment
@OnClick(R.id.loginServerChoiceMatrixOrg) @OnClick(R.id.loginServerChoiceMatrixOrg)
fun selectMatrixOrg() { fun selectMatrixOrg() {
viewModel.handle(LoginAction.UpdateServerType(ServerType.MatrixOrg)) if (loginServerChoiceMatrixOrg.isChecked) {
// Consider this is a submit
submit()
} else {
viewModel.handle(LoginAction.UpdateServerType(ServerType.MatrixOrg))
}
} }
@OnClick(R.id.loginServerChoiceModular) @OnClick(R.id.loginServerChoiceModular)
fun selectModular() { fun selectModular() {
viewModel.handle(LoginAction.UpdateServerType(ServerType.Modular)) if (loginServerChoiceModular.isChecked) {
// Consider this is a submit
submit()
} else {
viewModel.handle(LoginAction.UpdateServerType(ServerType.Modular))
}
} }
@OnClick(R.id.loginServerChoiceOther) @OnClick(R.id.loginServerChoiceOther)
fun selectOther() { fun selectOther() {
viewModel.handle(LoginAction.UpdateServerType(ServerType.Other)) if (loginServerChoiceOther.isChecked) {
// Consider this is a submit
submit()
} else {
viewModel.handle(LoginAction.UpdateServerType(ServerType.Other))
}
} }
@OnClick(R.id.loginServerSubmit) @OnClick(R.id.loginServerSubmit)