Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ac05f4f authored by sunkup's avatar sunkup Committed by Ricki Hirner
Browse files

Add warning to avoid apostrophes in account names

Add warning to avoid apostrophes in account names. Resolves bitfireAT/davx5#5
parent ed08cc8d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -138,8 +138,10 @@ class AccountDetailsFragment : Fragment() {

        val name = MutableLiveData<String>()
        val nameError = MutableLiveData<String>()
        val showApostropheWarning = MutableLiveData<Boolean>(false)

        fun clearNameError(s: Editable) {
        fun validateAccountName(s: Editable) {
            showApostropheWarning.value = s.toString().contains('\'')
            nameError.value = null
        }

+14 −2
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>
        <import type="android.view.View"/>
        <variable
            name="details"
            type="at.bitfire.davdroid.ui.setup.AccountDetailsFragment.AccountDetailsModel"/>
@@ -45,15 +46,26 @@
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        unfilteredText="@={details.name}"
                        android:afterTextChanged="@{details::clearNameError}"
                        android:afterTextChanged="@{details::validateAccountName}"
                        android:inputType="textEmailAddress" />
                </com.google.android.material.textfield.TextInputLayout>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/TextAppearance.AppCompat.Body2"
                    app:drawableStartCompat="@drawable/ic_info"
                    android:drawablePadding="8dp"
                    android:layout_marginBottom="4dp"
                    android:text="@string/login_account_avoid_apostrophe"
                    android:visibility="@{details.showApostropheWarning ? View.VISIBLE : View.GONE}"/>

                <TextView
                    android:id="@+id/account_email_hint"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    style="@style/TextAppearance.AppCompat.Body2"
                    android:text="@string/login_account_name_info" />

                <LinearLayout
+1 −0
Original line number Diff line number Diff line
@@ -244,6 +244,7 @@
    <string name="login_login">Login</string>
    <string name="login_create_account">Create account</string>
    <string name="login_account_name">Account name</string>
    <string name="login_account_avoid_apostrophe">Use of apostrophes (\'), have been reported to cause problems on some devices.</string>
    <string name="login_account_name_info">Use your email address as account name because Android will use the account name as ORGANIZER field for events you create. You can\'t have two accounts with the same name.</string>
    <string name="login_account_contact_group_method">Contact group method:</string>
    <string name="login_account_name_required">Account name required</string>