Commit bc765e24 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Fix expand and collapse state for the accounts view.

parent b0f39da1
......@@ -172,13 +172,16 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
override fun setupExpandAccountsView() {
ui {
expand_more_accounts_container.isVisible = true
var isAccountsCollapsed = true
button_expand_collapse_accounts.setOnClickListener { view ->
if (view.rotation == 0F) {
if (isAccountsCollapsed) {
button_expand_collapse_accounts.rotateBy(180F, 400)
expandAccountsView()
isAccountsCollapsed = false
} else {
button_expand_collapse_accounts.rotateBy(180F, 400)
collapseAccountsView()
isAccountsCollapsed = true
}
}
}
......@@ -312,16 +315,15 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
private fun expandAccountsView() {
(0..accounts_container.childCount)
.mapNotNull { accounts_container.getChildAt(it) as? Button }
.filter { it.isClickable }
.filter { it.isClickable && !it.isVisible }
.forEach { it.isVisible = true }
}
private fun collapseAccountsView() {
(0..accounts_container.childCount)
.mapNotNull { accounts_container.getChildAt(it) as? Button }
.filter { it.isVisible }
.filter { it.isClickable && it.isVisible }
.drop(3)
.forEach { it.isVisible = false }
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment