diff options
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLogin.kt | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLogin.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLogin.kt index 7bc2c33076..131d9c0c65 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLogin.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLogin.kt @@ -44,12 +44,18 @@ class AccountLogin : RelativeLayout { private val expandedHeight: Int get() = collapsedHeight + historyHeight - private var historyHeight by observable(0) { _, _, _ -> - historyAnimation.setIntValues(collapsedHeight, expandedHeight) + private var historyHeight by observable(0) { _, oldHistoryHeight, newHistoryHeight -> + if (newHistoryHeight != oldHistoryHeight) { + historyAnimation.setIntValues(collapsedHeight, expandedHeight) + reposition() + } } - private var collapsedHeight by observable(0) { _, _, newCollapsedHeight -> - historyAnimation.setIntValues(newCollapsedHeight, expandedHeight) + private var collapsedHeight by observable(0) { _, oldCollapsedHeight, newCollapsedHeight -> + if (newCollapsedHeight != oldCollapsedHeight) { + historyAnimation.setIntValues(newCollapsedHeight, expandedHeight) + reposition() + } } private var inputHasFocus by observable(false) { _, _, hasFocus -> @@ -172,6 +178,16 @@ class AccountLogin : RelativeLayout { container.layoutParams = layoutParams } + private fun reposition() { + historyAnimation.end() + + if (shouldShowAccountHistory) { + updateHeight(expandedHeight) + } else { + updateHeight(collapsedHeight) + } + } + private fun hideKeyboard() { val inputManagerId = Activity.INPUT_METHOD_SERVICE val inputManager = context.getSystemService(inputManagerId) as InputMethodManager |
