Login screens: Fix a few bugs

This commit is contained in:
Benoit Marty 2019-11-15 14:39:09 +01:00
parent 2871e4f5b1
commit ca4e75a1a0
5 changed files with 40 additions and 9 deletions

View File

@ -35,9 +35,7 @@ import im.vector.riotx.features.home.createdirect.CreateDirectRoomKnownUsersFrag
import im.vector.riotx.features.home.group.GroupListFragment
import im.vector.riotx.features.home.room.detail.RoomDetailFragment
import im.vector.riotx.features.home.room.list.RoomListFragment
import im.vector.riotx.features.login.LoginFragment
import im.vector.riotx.features.login.LoginServerUrlFormFragment
import im.vector.riotx.features.login.LoginWebFragment
import im.vector.riotx.features.login.*
import im.vector.riotx.features.reactions.EmojiSearchResultFragment
import im.vector.riotx.features.roomdirectory.PublicRoomsFragment
import im.vector.riotx.features.roomdirectory.createroom.CreateRoomFragment
@ -116,12 +114,36 @@ interface FragmentModule {
@FragmentKey(LoginFragment::class)
fun bindLoginFragment(fragment: LoginFragment): Fragment
// TODO Add all other Login Fragments
@Binds
@IntoMap
@FragmentKey(LoginServerUrlFormFragment::class)
fun bindLoginServerUrlFormFragment(fragment: LoginServerUrlFormFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginResetPasswordFragment::class)
fun bindLoginResetPasswordFragment(fragment: LoginResetPasswordFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginResetPasswordSuccessFragment::class)
fun bindLoginResetPasswordSuccessFragment(fragment: LoginResetPasswordSuccessFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginServerSelectionFragment::class)
fun bindLoginServerSelectionFragment(fragment: LoginServerSelectionFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginSignUpSignInSelectionFragment::class)
fun bindLoginSignUpSignInSelectionFragment(fragment: LoginSignUpSignInSelectionFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginSplashFragment::class)
fun bindLoginSplashFragment(fragment: LoginSplashFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginWebFragment::class)

View File

@ -71,7 +71,7 @@ class LoginResetPasswordFragment @Inject constructor(
.subscribeBy {
resetPasswordEmail.error = null
passwordFieldTil.error = null
loginSubmit.isEnabled = it
resetPasswordSubmit.isEnabled = it
}
.disposeOnDestroy()

View File

@ -48,13 +48,14 @@ class LoginSignUpSignInSelectionFragment @Inject constructor() : AbstractLoginFr
ServerType.Modular -> {
loginSignupSigninServerIcon.setImageResource(R.drawable.ic_logo_modular)
loginSignupSigninServerIcon.isVisible = true
// TODO
loginSignupSigninTitle.text = getString(R.string.login_connect_to, "TODO MODULAR NAME")
loginSignupSigninText.text = "TODO MODULAR URL"
loginSignupSigninText.text = loginViewModel.getHomeServerUrlSimple()
}
ServerType.Other -> {
loginSignupSigninServerIcon.isVisible = false
loginSignupSigninTitle.text = getString(R.string.login_server_other_title)
loginSignupSigninText.text = "TODO SERVER URL"
loginSignupSigninText.text = getString(R.string.login_connect_to, loginViewModel.getHomeServerUrlSimple())
}
}
}

View File

@ -309,7 +309,12 @@ class LoginViewModel @AssistedInject constructor(@Assisted initialState: LoginVi
return homeServerConnectionConfig?.homeServerUri?.toString() ?: ""
}
/**
* Ex: "https://matrix.org/" -> "matrix.org"
*/
fun getHomeServerUrlSimple(): String {
return getHomeServerUrl().substringAfter("://")
return getHomeServerUrl()
.substringAfter("://")
.trim { it == '/' }
}
}

View File

@ -25,11 +25,14 @@
style="@style/LoginTopIcon"
android:layout_gravity="center_horizontal" />
<Space
android:layout_width="wrap_content"
android:layout_height="84dp" />
<ImageView
android:id="@+id/loginServerIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="84dp"
tools:src="@drawable/ic_logo_matrix_org" />
<TextView