diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-03-28 18:06:23 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-03-28 22:38:04 -0600 |
commit | 532c33a13baf0beeaf7f2ded6c4481b2b66d79db (patch) | |
tree | c92e36f109f76ae9bb2e536727fd0a20a6ba38a3 /ui | |
parent | 6a7396bc1d41fdd2a4881038be9804d4a1854277 (diff) |
MonkeyedTextInputEditText: make more robust
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/widget/MonkeyedTextInputEditText.kt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/src/main/java/com/wireguard/android/widget/MonkeyedTextInputEditText.kt b/ui/src/main/java/com/wireguard/android/widget/MonkeyedTextInputEditText.kt index 8316d65e..97746c09 100644 --- a/ui/src/main/java/com/wireguard/android/widget/MonkeyedTextInputEditText.kt +++ b/ui/src/main/java/com/wireguard/android/widget/MonkeyedTextInputEditText.kt @@ -19,12 +19,12 @@ class MonkeyedTextInputEditText @JvmOverloads constructor(context: Context, attr val text = super.getText() if (!text.isNullOrEmpty()) return text - /* We want this expression in TextInputLayout.java to be true: + /* We want this expression in TextInputLayout.java to be true if there's a hint set: * 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(" ") + if (!hint.isNullOrEmpty() && Thread.currentThread().stackTrace[3].className == TextInputLayout::class.qualifiedName) + return SpannableStringBuilder(hint) return text } } |