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

Check the enable social accounts size before showing the FAB.

parent 700a17e5
......@@ -484,7 +484,9 @@ class LoginFragment : Fragment(), LoginView {
private fun showOauthView() {
if (isOauthViewEnable) {
social_accounts_container.isVisible = true
button_fab.isVisible = true
if (enabledSocialAccounts() > 3) {
button_fab.isVisible = true
}
}
}
......@@ -495,6 +497,23 @@ class LoginFragment : Fragment(), LoginView {
}
}
private fun enabledSocialAccounts(): Int {
return enabledOauthAccountsImageButtons() + enabledServicesAccountsButtons()
}
private fun enabledOauthAccountsImageButtons(): Int {
return (0..social_accounts_container.childCount)
.mapNotNull { social_accounts_container.getChildAt(it) as? ImageButton }
.filter { it.isClickable }
.size
}
private fun enabledServicesAccountsButtons(): Int {
return (0..social_accounts_container.childCount)
.mapNotNull { social_accounts_container.getChildAt(it) as? Button }
.size
}
/**
* Gets a stylized custom OAuth button.
*/
......
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