[Mobidziennik] Add prefix and suffix for server name login field.

This commit is contained in:
Kuba Szczodrzyński 2021-10-11 20:23:57 +02:00
parent 1a543814f4
commit 63b74a9fda
No known key found for this signature in database
GPG Key ID: 70CB8A85BA1633CB
3 changed files with 12 additions and 0 deletions

View File

@ -95,6 +95,10 @@ class LoginFormFragment : Fragment(), CoroutineScope {
b.textEdit.addTextChangedListener {
b.textLayout.error = null
}
if (credential.prefix != null)
b.textLayout.prefixText = app.getString(credential.prefix)
if (credential.suffix != null)
b.textLayout.suffixText = app.getString(credential.suffix)
b.textEdit.id = credential.name

View File

@ -259,6 +259,8 @@ object LoginInfo {
errorCodes = mapOf(
ERROR_LOGIN_MOBIDZIENNIK_WEB_INVALID_ADDRESS to R.string.login_error_incorrect_address
),
prefix = R.string.login_mobidziennik_server_prefix,
suffix = R.string.login_mobidziennik_server_suffix,
isRequired = true,
validationRegex = "^[a-z0-9_\\-]+\$",
caseMode = FormField.CaseMode.LOWER_CASE
@ -397,6 +399,10 @@ object LoginInfo {
override val errorCodes: Map<Int, Int>,
@StringRes
val hintText: Int? = null,
@StringRes
val prefix: Int? = null,
@StringRes
val suffix: Int? = null,
val isRequired: Boolean = true,
val validationRegex: String,

View File

@ -1489,4 +1489,6 @@
<string name="messages_compose_draft_discarded">Usunięto wersję roboczą</string>
<string name="messages_compose_discard_draft_title">Usuń wersję roboczą</string>
<string name="messages_compose_discard_draft_text">Czy chcesz odrzucić zapisaną wersję wiadomości? Spowoduje to również anulowanie wprowadzonych zmian i usunięcie wiadomości.</string>
<string name="login_mobidziennik_server_prefix">https://</string>
<string name="login_mobidziennik_server_suffix">.mobidziennik.pl/</string>
</resources>