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,9 +484,11 @@ class LoginFragment : Fragment(), LoginView { ...@@ -484,9 +484,11 @@ class LoginFragment : Fragment(), LoginView {
private fun showOauthView() { private fun showOauthView() {
if (isOauthViewEnable) { if (isOauthViewEnable) {
social_accounts_container.isVisible = true social_accounts_container.isVisible = true
if (enabledSocialAccounts() > 3) {
button_fab.isVisible = true button_fab.isVisible = true
} }
} }
}
private fun hideOauthView() { private fun hideOauthView() {
if (isOauthViewEnable) { if (isOauthViewEnable) {
...@@ -495,6 +497,23 @@ class LoginFragment : Fragment(), LoginView { ...@@ -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. * 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