diff options
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountInput.kt | 5 | ||||
| -rw-r--r-- | android/src/main/res/layout/account_input.xml | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountInput.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountInput.kt index 35e910c063..2c8dd24a9f 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountInput.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountInput.kt @@ -3,6 +3,7 @@ package net.mullvad.mullvadvpn.ui.widget import android.content.Context import android.text.Editable import android.text.TextWatcher +import android.text.method.DigitsKeyListener import android.text.style.MetricAffectingSpan import android.util.AttributeSet import android.view.LayoutInflater @@ -48,6 +49,10 @@ class AccountInput : LinearLayout { onFocusChangeListener = OnFocusChangeListener { view, inputHasFocus -> hasFocus = inputHasFocus && view.isEnabled } + + // Manually initializing the `DigitsKeyListener` allows spaces to be used and still keeps + // the input type as a number so that the correct software keyboard type is shown + keyListener = DigitsKeyListener.getInstance("01234567890 ") } private val button = container.findViewById<ImageButton>(R.id.login_button).apply { diff --git a/android/src/main/res/layout/account_input.xml b/android/src/main/res/layout/account_input.xml index 1c23583c42..96aa3c7c46 100644 --- a/android/src/main/res/layout/account_input.xml +++ b/android/src/main/res/layout/account_input.xml @@ -1,12 +1,10 @@ <merge xmlns:android="http://schemas.android.com/apk/res/android"> <EditText android:id="@+id/login_input" - android:digits="0123456789" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:paddingHorizontal="12dp" android:background="@drawable/account_input_background" - android:inputType="number" android:singleLine="true" android:imeOptions="flagNoPersonalizedLearning" android:textCursorDrawable="@drawable/text_input_cursor" |
