mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-17 19:58:57 +03:00
Login screens: fix code quality issues
This commit is contained in:
parent
e0a36b794f
commit
3f83c161e4
4 changed files with 28 additions and 16 deletions
|
@ -16,10 +16,10 @@
|
|||
|
||||
package im.vector.riotx.features.login
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.airbnb.mvrx.activityViewModel
|
||||
import im.vector.matrix.android.api.failure.Failure
|
||||
import im.vector.matrix.android.api.failure.MatrixError
|
||||
|
|
|
@ -105,26 +105,34 @@ class LoginActivity : VectorBaseActivity(), ToolbarConfigurable {
|
|||
})
|
||||
is LoginNavigation.OnServerSelectionDone -> onServerSelectionDone()
|
||||
is LoginNavigation.OnSignModeSelected -> onSignModeSelected()
|
||||
is LoginNavigation.OnLoginFlowRetrieved -> addFragmentToBackstack(R.id.loginFragmentContainer, LoginSignUpSignInSelectionFragment::class.java)
|
||||
is LoginNavigation.OnLoginFlowRetrieved ->
|
||||
addFragmentToBackstack(R.id.loginFragmentContainer,
|
||||
LoginSignUpSignInSelectionFragment::class.java)
|
||||
is LoginNavigation.OnWebLoginError -> onWebLoginError(loginNavigation)
|
||||
is LoginNavigation.OnForgetPasswordClicked -> addFragmentToBackstack(R.id.loginFragmentContainer, LoginResetPasswordFragment::class.java)
|
||||
is LoginNavigation.OnForgetPasswordClicked ->
|
||||
addFragmentToBackstack(R.id.loginFragmentContainer,
|
||||
LoginResetPasswordFragment::class.java)
|
||||
is LoginNavigation.OnResetPasswordSendThreePidDone -> {
|
||||
supportFragmentManager.popBackStack(FRAGMENT_LOGIN_TAG, POP_BACK_STACK_EXCLUSIVE)
|
||||
addFragmentToBackstack(R.id.loginFragmentContainer, LoginResetPasswordMailConfirmationFragment::class.java)
|
||||
addFragmentToBackstack(R.id.loginFragmentContainer,
|
||||
LoginResetPasswordMailConfirmationFragment::class.java)
|
||||
}
|
||||
is LoginNavigation.OnResetPasswordMailConfirmationSuccess -> {
|
||||
supportFragmentManager.popBackStack(FRAGMENT_LOGIN_TAG, POP_BACK_STACK_EXCLUSIVE)
|
||||
addFragmentToBackstack(R.id.loginFragmentContainer, LoginResetPasswordSuccessFragment::class.java)
|
||||
addFragmentToBackstack(R.id.loginFragmentContainer,
|
||||
LoginResetPasswordSuccessFragment::class.java)
|
||||
}
|
||||
is LoginNavigation.OnResetPasswordMailConfirmationSuccessDone -> {
|
||||
// Go back to the login fragment
|
||||
supportFragmentManager.popBackStack(FRAGMENT_LOGIN_TAG, POP_BACK_STACK_EXCLUSIVE)
|
||||
}
|
||||
is LoginNavigation.OnSendEmailSuccess -> addFragmentToBackstack(R.id.loginFragmentContainer,
|
||||
is LoginNavigation.OnSendEmailSuccess ->
|
||||
addFragmentToBackstack(R.id.loginFragmentContainer,
|
||||
LoginWaitForEmailFragment::class.java,
|
||||
LoginWaitForEmailFragmentArgument(loginNavigation.email),
|
||||
tag = FRAGMENT_REGISTRATION_STAGE_TAG)
|
||||
is LoginNavigation.OnSendMsisdnSuccess -> addFragmentToBackstack(R.id.loginFragmentContainer,
|
||||
is LoginNavigation.OnSendMsisdnSuccess ->
|
||||
addFragmentToBackstack(R.id.loginFragmentContainer,
|
||||
LoginGenericTextInputFormFragment::class.java,
|
||||
LoginGenericTextInputFormFragmentArgument(TextInputFormFragmentMode.ConfirmMsisdn, true, loginNavigation.msisdn),
|
||||
tag = FRAGMENT_REGISTRATION_STAGE_TAG)
|
||||
|
|
|
@ -73,11 +73,13 @@ class LoginGenericTextInputFormFragment @Inject constructor(private val errorFor
|
|||
|
||||
private fun setupAutoFill() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
when (params.mode) {
|
||||
TextInputFormFragmentMode.SetEmail -> loginGenericTextInputFormTextInput.setAutofillHints(HintConstants.AUTOFILL_HINT_EMAIL_ADDRESS)
|
||||
TextInputFormFragmentMode.SetMsisdn -> loginGenericTextInputFormTextInput.setAutofillHints(HintConstants.AUTOFILL_HINT_PHONE_NUMBER)
|
||||
TextInputFormFragmentMode.ConfirmMsisdn -> loginGenericTextInputFormTextInput.setAutofillHints(HintConstants.AUTOFILL_HINT_SMS_OTP)
|
||||
}
|
||||
loginGenericTextInputFormTextInput.setAutofillHints(
|
||||
when (params.mode) {
|
||||
TextInputFormFragmentMode.SetEmail -> HintConstants.AUTOFILL_HINT_EMAIL_ADDRESS
|
||||
TextInputFormFragmentMode.SetMsisdn -> HintConstants.AUTOFILL_HINT_PHONE_NUMBER
|
||||
TextInputFormFragmentMode.ConfirmMsisdn -> HintConstants.AUTOFILL_HINT_SMS_OTP
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +97,8 @@ class LoginGenericTextInputFormFragment @Inject constructor(private val errorFor
|
|||
loginGenericTextInputFormTitle.text = getString(R.string.login_set_email_title)
|
||||
loginGenericTextInputFormNotice.text = getString(R.string.login_set_email_notice)
|
||||
loginGenericTextInputFormNotice2.setTextOrHide(null)
|
||||
loginGenericTextInputFormTil.hint = getString(if (params.mandatory) R.string.login_set_email_mandatory_hint else R.string.login_set_email_optional_hint)
|
||||
loginGenericTextInputFormTil.hint =
|
||||
getString(if (params.mandatory) R.string.login_set_email_mandatory_hint else R.string.login_set_email_optional_hint)
|
||||
loginGenericTextInputFormTextInput.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|
||||
loginGenericTextInputFormOtherButton.isVisible = false
|
||||
loginGenericTextInputFormSubmit.text = getString(R.string.login_set_email_submit)
|
||||
|
@ -104,7 +107,8 @@ class LoginGenericTextInputFormFragment @Inject constructor(private val errorFor
|
|||
loginGenericTextInputFormTitle.text = getString(R.string.login_set_msisdn_title)
|
||||
loginGenericTextInputFormNotice.text = getString(R.string.login_set_msisdn_notice)
|
||||
loginGenericTextInputFormNotice2.setTextOrHide(getString(R.string.login_set_msisdn_notice2))
|
||||
loginGenericTextInputFormTil.hint = getString(if (params.mandatory) R.string.login_set_msisdn_mandatory_hint else R.string.login_set_msisdn_optional_hint)
|
||||
loginGenericTextInputFormTil.hint =
|
||||
getString(if (params.mandatory) R.string.login_set_msisdn_mandatory_hint else R.string.login_set_msisdn_optional_hint)
|
||||
loginGenericTextInputFormTextInput.inputType = InputType.TYPE_CLASS_PHONE
|
||||
loginGenericTextInputFormOtherButton.isVisible = false
|
||||
loginGenericTextInputFormSubmit.text = getString(R.string.login_set_msisdn_submit)
|
||||
|
@ -113,7 +117,8 @@ class LoginGenericTextInputFormFragment @Inject constructor(private val errorFor
|
|||
loginGenericTextInputFormTitle.text = getString(R.string.login_msisdn_confirm_title)
|
||||
loginGenericTextInputFormNotice.text = getString(R.string.login_msisdn_confirm_notice, params.extra)
|
||||
loginGenericTextInputFormNotice2.setTextOrHide(null)
|
||||
loginGenericTextInputFormTil.hint = getString(R.string.login_msisdn_confirm_hint)
|
||||
loginGenericTextInputFormTil.hint =
|
||||
getString(R.string.login_msisdn_confirm_hint)
|
||||
loginGenericTextInputFormTextInput.inputType = InputType.TYPE_CLASS_NUMBER
|
||||
loginGenericTextInputFormOtherButton.isVisible = true
|
||||
loginGenericTextInputFormOtherButton.text = getString(R.string.login_msisdn_confirm_send_again)
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
<string name="login_server_url_form_modular_hint">Modular Address</string>
|
||||
<string name="login_server_url_form_other_hint">Address</string>
|
||||
<string name="login_server_url_form_modular_text">Premium hosting for organisations</string>
|
||||
<string name="login_server_url_form_other_text"></string>
|
||||
<string name="login_server_url_form_modular_notice">Enter the address of the Modular Riot or Server you want to use</string>
|
||||
<string name="login_server_url_form_other_notice">Enter the address of a server or a Riot you want to connect to</string>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue