diff --git a/ui/src/main/java/com/wireguard/android/widget/MonkeyedTextInputEditText.kt b/ui/src/main/java/com/wireguard/android/widget/MonkeyedTextInputEditText.kt
new file mode 100644
index 00000000..8316d65e
--- /dev/null
+++ b/ui/src/main/java/com/wireguard/android/widget/MonkeyedTextInputEditText.kt
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2020 WireGuard LLC. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package com.wireguard.android.widget
+
+import android.content.Context
+import android.text.Editable
+import android.text.SpannableStringBuilder
+import android.util.AttributeSet
+import com.google.android.material.R
+import com.google.android.material.textfield.TextInputEditText
+import com.google.android.material.textfield.TextInputLayout
+
+class MonkeyedTextInputEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.editTextStyle) : TextInputEditText(context, attrs, defStyleAttr) {
+ @Override
+ override fun getText(): Editable? {
+ val text = super.getText()
+ if (!text.isNullOrEmpty())
+ return text
+ /* We want this expression in TextInputLayout.java to be true:
+ * final boolean hasText = editText != null && !TextUtils.isEmpty(editText.getText());
+ * But for everyone else it should return the real value, so we check the caller.
+ */
+ if (Thread.currentThread().stackTrace[3].className == TextInputLayout::class.qualifiedName)
+ return SpannableStringBuilder(" ")
+ return text
+ }
+}
diff --git a/ui/src/main/res/layout/tunnel_editor_fragment.xml b/ui/src/main/res/layout/tunnel_editor_fragment.xml
index bef3fb25..27d898ef 100644
--- a/ui/src/main/res/layout/tunnel_editor_fragment.xml
+++ b/ui/src/main/res/layout/tunnel_editor_fragment.xml
@@ -126,6 +126,7 @@
-
@@ -170,6 +171,7 @@
-
@@ -195,7 +197,7 @@
android:layout_height="wrap_content"
android:layout_margin="4dp"
app:layout_constraintHorizontal_chainStyle="spread"
- app:layout_constraintHorizontal_weight="0.8"
+ app:layout_constraintHorizontal_weight="0.7"
app:layout_constraintEnd_toStartOf="@id/mtu_label_layout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/addresses_label_layout">
@@ -215,17 +217,18 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
- app:layout_constraintHorizontal_weight="0.2"
+ android:hint="@string/mtu"
+ app:layout_constraintHorizontal_weight="0.3"
app:layout_constraintStart_toEndOf="@id/dns_servers_label_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/dns_servers_label_layout">
-
diff --git a/ui/src/main/res/layout/tunnel_editor_peer.xml b/ui/src/main/res/layout/tunnel_editor_peer.xml
index e37aa564..896d2381 100644
--- a/ui/src/main/res/layout/tunnel_editor_peer.xml
+++ b/ui/src/main/res/layout/tunnel_editor_peer.xml
@@ -83,15 +83,16 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
+ android:hint="@string/pre_shared_key"
app:layout_constraintTop_toBottomOf="@+id/public_key_label_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
-
@@ -102,15 +103,16 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
+ android:hint="@string/persistent_keepalive"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/pre_shared_key_label_layout"
app:layout_constraintEnd_toEndOf="parent">
-
diff --git a/ui/src/main/res/values/styles.xml b/ui/src/main/res/values/styles.xml
index fc2f9f0e..c906068a 100644
--- a/ui/src/main/res/values/styles.xml
+++ b/ui/src/main/res/values/styles.xml
@@ -55,7 +55,7 @@
-