From 63b74a9fdad25d6963b78039cdba704cb180ee25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Mon, 11 Oct 2021 20:23:57 +0200 Subject: [PATCH] [Mobidziennik] Add prefix and suffix for server name login field. --- .../edziennik/ui/modules/login/LoginFormFragment.kt | 4 ++++ .../szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt | 6 ++++++ app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 12 insertions(+) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt index 3360e93b..39189a2a 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginFormFragment.kt @@ -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 diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt index 8a5e60d1..ed72f175 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt @@ -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, @StringRes val hintText: Int? = null, + @StringRes + val prefix: Int? = null, + @StringRes + val suffix: Int? = null, val isRequired: Boolean = true, val validationRegex: String, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bec3ea36..e66f466f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1489,4 +1489,6 @@ Usunięto wersję roboczą Usuń wersję roboczą Czy chcesz odrzucić zapisaną wersję wiadomości? Spowoduje to również anulowanie wprowadzonych zmian i usunięcie wiadomości. + https:// + .mobidziennik.pl/