diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-09-01 19:13:03 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-09-02 13:15:27 +0000 |
| commit | f43f7786c6b0578ef6b6ceac385c239689ff0783 (patch) | |
| tree | 1494f75fbaa0934b03ef39091aa6891bf9743a3b /android | |
| parent | 1954b768740bdbf2ffe4cc828761dd9cf83f88a6 (diff) | |
| download | mullvadvpn-f43f7786c6b0578ef6b6ceac385c239689ff0783.tar.xz mullvadvpn-f43f7786c6b0578ef6b6ceac385c239689ff0783.zip | |
Open account history when focus is received
Diffstat (limited to 'android')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/AccountInputController.kt | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/AccountInputController.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/AccountInputController.kt index 47beece9ef..c434126f7f 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/AccountInputController.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/AccountInputController.kt @@ -3,9 +3,7 @@ package net.mullvad.mullvadvpn.ui import android.content.Context import android.text.Editable import android.text.TextWatcher -import android.view.MotionEvent import android.view.View -import android.view.View.OnTouchListener import android.widget.ArrayAdapter import android.widget.ListView import android.widget.TextView @@ -42,7 +40,11 @@ class AccountInputController(val parentView: View, context: Context) { val input: TextView = parentView.findViewById(R.id.login_input) val accountHistoryList: ListView = parentView.findViewById(R.id.account_history_list) - val newInput = parentView.findViewById<AccountInput>(R.id.account_input) + val newInput = parentView.findViewById<AccountInput>(R.id.account_input).apply { + onFocusChanged.subscribe(this) { hasFocus -> + inputHasFocus = hasFocus + } + } var accountHistory: ArrayList<String>? = null set(value) { @@ -67,20 +69,15 @@ class AccountInputController(val parentView: View, context: Context) { init { input.apply { addTextChangedListener(InputWatcher()) - setOnTouchListener( - OnTouchListener { - _, event -> - if (MotionEvent.ACTION_UP == event.getAction()) { - shouldShowAccountHistory = true - } - false - } - ) } container.setOnClickListener { shouldShowAccountHistory = true } } + fun onDestroy() { + newInput.onFocusChanged.unsubscribe(this) + } + private fun loggingInState() { accountHistoryList.visibility = View.INVISIBLE } @@ -142,7 +139,6 @@ class AccountInputController(val parentView: View, context: Context) { override fun onTextChanged(text: CharSequence, start: Int, before: Int, count: Int) {} override fun afterTextChanged(text: Editable) { - inputHasFocus = true leaveErrorState() } } |
