diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-09-04 18:26:01 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-09-21 15:28:41 +0000 |
| commit | edd3b9d985a1c4beecd6577379d7ee5ca29bc7d4 (patch) | |
| tree | 6800bcdc7402a480387f880c2235180ac17f5eab /android | |
| parent | 5ab55799863964c5a65b7c9faf6da6b55a96bb9c (diff) | |
| download | mullvadvpn-edd3b9d985a1c4beecd6577379d7ee5ca29bc7d4.tar.xz mullvadvpn-edd3b9d985a1c4beecd6577379d7ee5ca29bc7d4.zip | |
Create `updateHeight` helper method
Diffstat (limited to 'android')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLogin.kt | 16 |
1 files changed, 10 insertions, 6 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 5aa4ebbd88..7bc2c33076 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 @@ -35,12 +35,7 @@ class AccountLogin : RelativeLayout { private val historyAnimation = ValueAnimator.ofInt(0, 0).apply { addUpdateListener { animation -> - val layoutParams = container.layoutParams as MarginLayoutParams - - layoutParams.height = animation.animatedValue as Int - layoutParams.bottomMargin = expandedHeight - value - - container.layoutParams = layoutParams + updateHeight(animation.animatedValue as Int) } duration = 350 @@ -168,6 +163,15 @@ class AccountLogin : RelativeLayout { } } + private fun updateHeight(height: Int) { + val layoutParams = container.layoutParams as MarginLayoutParams + + layoutParams.height = height + layoutParams.bottomMargin = expandedHeight - height + + container.layoutParams = layoutParams + } + private fun hideKeyboard() { val inputManagerId = Activity.INPUT_METHOD_SERVICE val inputManager = context.getSystemService(inputManagerId) as InputMethodManager |
