Add back link to learn more on EMS

This commit is contained in:
Benoit Marty 2021-04-19 15:51:56 +02:00
parent 63a59dbc0c
commit 258a378f39
4 changed files with 28 additions and 2 deletions

View file

@ -62,7 +62,7 @@ fun TextView.setTextWithColoredPart(@StringRes fullTextRes: Int,
@StringRes coloredTextRes: Int,
@AttrRes colorAttribute: Int = R.attr.colorAccent,
underline: Boolean = false,
onClick: (() -> Unit)?) {
onClick: (() -> Unit)? = null) {
val coloredPart = resources.getString(coloredTextRes)
// Insert colored part into the full text
val fullText = resources.getString(fullTextRes, coloredPart)

View file

@ -21,7 +21,10 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import im.vector.app.R
import im.vector.app.core.extensions.setTextWithColoredPart
import im.vector.app.core.utils.openUrlInChromeCustomTab
import im.vector.app.databinding.FragmentLoginServerSelection2Binding
import im.vector.app.features.login.EMS_LINK
import javax.inject.Inject
/**
@ -42,6 +45,15 @@ class LoginServerSelectionFragment2 @Inject constructor() : AbstractLoginFragmen
private fun initViews() {
views.loginServerChoiceMatrixOrg.setOnClickListener { selectMatrixOrg() }
views.loginServerChoiceOther.setOnClickListener { selectOther() }
views.loginServerChoiceEmsLearnMore.setTextWithColoredPart(
fullTextRes = R.string.login_server_modular_learn_more_about_ems,
coloredTextRes = R.string.login_server_modular_learn_more,
underline = true
)
views.loginServerChoiceEmsLearnMore.setOnClickListener {
openUrlInChromeCustomTab(requireActivity(), null, EMS_LINK)
}
}
private fun updateUi(state: LoginViewState2) {

View file

@ -86,7 +86,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginBottom="32dp"
android:background="@drawable/bg_login_server_selector"
android:contentDescription="@string/login_a11y_choose_other"
android:minHeight="80dp"
@ -122,6 +121,19 @@
</im.vector.app.core.platform.CheckableConstraintLayout>
<TextView
android:id="@+id/loginServerChoiceEmsLearnMore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:text="@string/login_server_modular_learn_more_about_ems"
android:textAppearance="@style/TextAppearance.Vector.Login.Text.Small"
app:layout_constraintBottom_toBottomOf="@+id/loginServerChoiceEmsText"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/loginServerChoiceEmsText" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -44,5 +44,7 @@
<string name="login_set_msisdn_title_2">Associate a phone number</string>
<string name="login_set_msisdn_notice_2">Associate a phone number to optionally allow people you know to discover you.</string>
<string name="login_set_msisdn_mandatory_notice_2">The server %s requires you to associate a phone number to create an account.</string>
<!-- %S will be replaced by the value of login_server_modular_learn_more ("Learn more" in English)-->
<string name="login_server_modular_learn_more_about_ems">%s about Element Matrix Service.</string>
</resources>