summaryrefslogtreecommitdiffhomepage
path: root/android/src/main
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-09-04 18:32:19 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-09-21 15:28:41 +0000
commite3d905436c2946cdf22ec0d7c446d3d8504eb308 (patch)
treeacaeec346ce6f11eb55f3f17f6979fc832a959da /android/src/main
parentedd3b9d985a1c4beecd6577379d7ee5ca29bc7d4 (diff)
downloadmullvadvpn-e3d905436c2946cdf22ec0d7c446d3d8504eb308.tar.xz
mullvadvpn-e3d905436c2946cdf22ec0d7c446d3d8504eb308.zip
Reposition account login as soon as possible
Diffstat (limited to 'android/src/main')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLogin.kt24
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