More improvements
This commit is contained in:
parent
6e9c16a889
commit
d235d1be15
|
@ -36,7 +36,7 @@ import javax.inject.Inject
|
|||
* In this screen:
|
||||
* - the user is asked to choose a password to sign up to a homeserver.
|
||||
*/
|
||||
class LoginFragmentSignupPassword2 @Inject constructor() : AbstractSSOLoginFragment2<FragmentLoginSignupPassword2Binding>() {
|
||||
class LoginFragmentSignupPassword2 @Inject constructor() : AbstractLoginFragment2<FragmentLoginSignupPassword2Binding>() {
|
||||
|
||||
private var passwordsShown = false
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ class LoginFragmentSignupUsername2 @Inject constructor() : AbstractSSOLoginFragm
|
|||
|
||||
setupSubmitButton()
|
||||
setupAutoFill()
|
||||
setupSocialLoginButtons()
|
||||
}
|
||||
|
||||
private fun setupAutoFill() {
|
||||
|
@ -63,6 +64,10 @@ class LoginFragmentSignupUsername2 @Inject constructor() : AbstractSSOLoginFragm
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupSocialLoginButtons() {
|
||||
views.loginSocialLoginButtons.mode = SocialLoginButtonsView.Mode.MODE_SIGN_UP
|
||||
}
|
||||
|
||||
private fun submit() {
|
||||
cleanupUi()
|
||||
|
||||
|
@ -111,7 +116,6 @@ class LoginFragmentSignupUsername2 @Inject constructor() : AbstractSSOLoginFragm
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun setupSubmitButton() {
|
||||
views.loginSubmit.setOnClickListener { submit() }
|
||||
views.loginField.textChanges()
|
||||
|
|
|
@ -66,6 +66,7 @@ class LoginFragmentToAny2 @Inject constructor() : AbstractSSOLoginFragment2<Frag
|
|||
setupForgottenPasswordButton()
|
||||
setupPasswordReveal()
|
||||
setupAutoFill()
|
||||
setupSocialLoginButtons()
|
||||
|
||||
views.passwordField.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
|
@ -85,6 +86,9 @@ class LoginFragmentToAny2 @Inject constructor() : AbstractSSOLoginFragment2<Frag
|
|||
views.loginField.setAutofillHints(HintConstants.AUTOFILL_HINT_USERNAME)
|
||||
views.passwordField.setAutofillHints(HintConstants.AUTOFILL_HINT_PASSWORD)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupSocialLoginButtons() {
|
||||
views.loginSocialLoginButtons.mode = SocialLoginButtonsView.Mode.MODE_SIGN_IN
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.autofill.HintConstants
|
||||
import com.jakewharton.rxbinding3.widget.textChanges
|
||||
|
@ -29,6 +30,7 @@ import im.vector.app.core.extensions.hideKeyboard
|
|||
import im.vector.app.core.extensions.isEmail
|
||||
import im.vector.app.core.extensions.showPassword
|
||||
import im.vector.app.core.extensions.toReducedUrl
|
||||
import im.vector.app.core.utils.autoResetTextInputLayoutErrors
|
||||
import im.vector.app.databinding.FragmentLoginResetPassword2Binding
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.rxkotlin.subscribeBy
|
||||
|
@ -55,6 +57,16 @@ class LoginResetPasswordFragment2 @Inject constructor() : AbstractLoginFragment2
|
|||
setupSubmitButton()
|
||||
setupPasswordReveal()
|
||||
setupAutoFill()
|
||||
|
||||
autoResetTextInputLayoutErrors(listOf(views.resetPasswordEmailTil, views.passwordFieldTil, views.passwordFieldTilRepeat))
|
||||
|
||||
views.passwordFieldRepeat.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
submit()
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
return@setOnEditorActionListener false
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupAutoFill() {
|
||||
|
@ -81,8 +93,6 @@ class LoginResetPasswordFragment2 @Inject constructor() : AbstractLoginFragment2
|
|||
}
|
||||
)
|
||||
.subscribeBy {
|
||||
views.resetPasswordEmailTil.error = null
|
||||
views.passwordFieldTil.error = null
|
||||
views.resetPasswordSubmit.isEnabled = it
|
||||
}
|
||||
.disposeOnDestroyView()
|
||||
|
@ -92,10 +102,20 @@ class LoginResetPasswordFragment2 @Inject constructor() : AbstractLoginFragment2
|
|||
cleanupUi()
|
||||
|
||||
var error = 0
|
||||
|
||||
val email = views.resetPasswordEmail.text.toString()
|
||||
val password = views.passwordField.text.toString()
|
||||
val passwordRepeat = views.passwordFieldRepeat.text.toString()
|
||||
|
||||
if (password != passwordRepeat) {
|
||||
if (email.isEmpty()) {
|
||||
views.resetPasswordEmailTil.error = getString(R.string.auth_reset_password_missing_email)
|
||||
error++
|
||||
}
|
||||
|
||||
if (password.isEmpty()) {
|
||||
views.passwordFieldTil.error = getString(R.string.login_please_choose_a_new_password)
|
||||
error++
|
||||
} else if (password != passwordRepeat) {
|
||||
views.passwordFieldTilRepeat.error = getString(R.string.auth_password_dont_match)
|
||||
error++
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
package im.vector.app.features.login2
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import im.vector.app.R
|
||||
import im.vector.app.databinding.FragmentLoginServerSelection2Binding
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -44,27 +44,34 @@ class LoginServerSelectionFragment2 @Inject constructor() : AbstractLoginFragmen
|
|||
views.loginServerChoiceOther.setOnClickListener { selectOther() }
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun updateUi(state: LoginViewState2) {
|
||||
when (state.signMode) {
|
||||
SignMode2.Unknown -> Unit
|
||||
SignMode2.SignUp -> {
|
||||
views.loginServerTitle.text = "Please choose a server"
|
||||
SignMode2.Unknown -> Unit
|
||||
SignMode2.SignUp -> {
|
||||
views.loginServerTitle.setText(R.string.login_please_choose_a_server)
|
||||
}
|
||||
SignMode2.SignIn -> {
|
||||
views.loginServerTitle.text = "Please choose your server"
|
||||
SignMode2.SignIn -> {
|
||||
views.loginServerTitle.setText(R.string.login_please_select_your_server)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun selectMatrixOrg() {
|
||||
views.loginServerChoiceMatrixOrg.isChecked = true
|
||||
loginViewModel.handle(LoginAction2.ChooseDefaultHomeServer)
|
||||
}
|
||||
|
||||
private fun selectOther() {
|
||||
views.loginServerChoiceOther.isChecked = true
|
||||
loginViewModel.handle(LoginAction2.EnterServerUrl)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
views.loginServerChoiceMatrixOrg.isChecked = false
|
||||
views.loginServerChoiceOther.isChecked = false
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
loginViewModel.handle(LoginAction2.ResetHomeServerUrl)
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import im.vector.app.core.extensions.cleanup
|
|||
import im.vector.app.core.extensions.configureWith
|
||||
import im.vector.app.core.extensions.toReducedUrl
|
||||
import im.vector.app.core.utils.openUrlInChromeCustomTab
|
||||
import im.vector.app.databinding.FragmentLoginTermsBinding
|
||||
import im.vector.app.databinding.FragmentLoginTerms2Binding
|
||||
import im.vector.app.features.login.terms.LocalizedFlowDataLoginTermsChecked
|
||||
import im.vector.app.features.login.terms.LoginTermsFragmentArgument
|
||||
import im.vector.app.features.login.terms.LoginTermsViewState
|
||||
|
@ -41,13 +41,13 @@ import javax.inject.Inject
|
|||
*/
|
||||
class LoginTermsFragment2 @Inject constructor(
|
||||
private val policyController: PolicyController
|
||||
) : AbstractLoginFragment2<FragmentLoginTermsBinding>(),
|
||||
) : AbstractLoginFragment2<FragmentLoginTerms2Binding>(),
|
||||
PolicyController.PolicyControllerListener {
|
||||
|
||||
private val params: LoginTermsFragmentArgument by args()
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginTermsBinding {
|
||||
return FragmentLoginTermsBinding.inflate(inflater, container, false)
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginTerms2Binding {
|
||||
return FragmentLoginTerms2Binding.inflate(inflater, container, false)
|
||||
}
|
||||
|
||||
private var loginTermsViewState: LoginTermsViewState = LoginTermsViewState(emptyList())
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/layout_vertical_margin"
|
||||
android:text="@string/login_please_choose_a_server"
|
||||
android:textAppearance="@style/TextAppearance.Vector.Login.Title"
|
||||
tools:ignore="UnknownId"
|
||||
tools:text="Please choose a server" />
|
||||
tools:ignore="UnknownId" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginServerText"
|
||||
|
@ -81,7 +81,7 @@
|
|||
android:textAppearance="@style/TextAppearance.Vector.Login.Text.Small"
|
||||
android:textStyle="italic" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<im.vector.app.core.platform.CheckableConstraintLayout
|
||||
android:id="@+id/loginServerChoiceOther"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -120,7 +120,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/loginServerChoiceOtherTitle" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</im.vector.app.core.platform.CheckableConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?riotx_background">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
style="@style/LoginFormScrollView"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<ImageView
|
||||
style="@style/LoginLogo"
|
||||
android:layout_marginTop="36dp"
|
||||
android:importantForAccessibility="no"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginTermsTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="36dp"
|
||||
android:layout_marginTop="52dp"
|
||||
android:layout_marginEnd="36dp"
|
||||
android:text="@string/login_terms_title"
|
||||
android:textAppearance="@style/TextAppearance.Vector.Login.Title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/loginLogo"
|
||||
tools:ignore="UnknownId" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginTermsNotice"
|
||||
style="@style/TextAppearance.Vector.Login.Text.Small"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:paddingStart="36dp"
|
||||
android:paddingEnd="36dp"
|
||||
android:text="@string/auth_accept_policies"
|
||||
app:layout_constraintTop_toBottomOf="@+id/loginTermsTitle" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/loginTermsPolicyList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/loginTermsSubmit"
|
||||
app:layout_constraintTop_toBottomOf="@+id/loginTermsNotice"
|
||||
tools:listitem="@layout/item_policy" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/loginTermsSubmit"
|
||||
style="@style/Style.Vector.Login.Button"
|
||||
android:layout_marginEnd="36dp"
|
||||
android:text="@string/accept"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
@ -10,7 +10,10 @@
|
|||
<string name="login_please_enter_your_matrix_identifier_help">Matrix identifiers start with @, for instance @alice:server.org</string>
|
||||
<string name="login_enter_identifier_help">If you do not know your Matrix identifier, or if your account has been created using Single Sign On (for instance using a Google account), or if you want to connect using your simple name, or an email associated to your account, you have to select your server first.</string>
|
||||
<string name="login_choose_a_server">Choose a server</string>
|
||||
<string name="login_please_choose_a_server">Please choose a server</string>
|
||||
<string name="login_please_select_your_server">Please select your server</string>
|
||||
<string name="login_please_choose_a_password">Please choose a password</string>
|
||||
<string name="login_please_choose_a_new_password">Please choose a new password</string>
|
||||
<string name="login_your_matrix_identifier">Your Matrix identifier</string>
|
||||
<string name="login_press_back_to_change">Press back to change</string>
|
||||
<string name="login_choose_a_password">Choose a password</string>
|
||||
|
|
Loading…
Reference in New Issue