Commit 045d7549 authored by samer's avatar samer

Fixed Layout for LoginFragment

parent 8bab94e9
...@@ -74,6 +74,12 @@ class LoginFragment : Fragment(), LoginView { ...@@ -74,6 +74,12 @@ class LoginFragment : Fragment(), LoginView {
setupSignUpListener() setupSignUpListener()
} }
override fun onViewStateRestored(savedInstanceState: Bundle?) {
super.onViewStateRestored(savedInstanceState)
isSocialMediaNeeded()
}
private fun showThreeSocialMethods() { private fun showThreeSocialMethods() {
var count = 0 var count = 0
for (i in 0..social_accounts_container.childCount) { for (i in 0..social_accounts_container.childCount) {
...@@ -213,15 +219,21 @@ class LoginFragment : Fragment(), LoginView { ...@@ -213,15 +219,21 @@ class LoginFragment : Fragment(), LoginView {
button_log_in.isEnabled = value button_log_in.isEnabled = value
text_username_or_email.isEnabled = value text_username_or_email.isEnabled = value
text_password.isEnabled = value text_password.isEnabled = value
if (!isEditTextEmpty()) {
showSignUpView(value)
showOauthView(value)
}
} }
// Returns true if *all* EditTexts are empty. // Returns true if *all* EditTexts are empty.
private fun isEditTextEmpty(): Boolean = text_username_or_email.textContent.isBlank() && text_password.textContent.isEmpty() private fun isEditTextEmpty(): Boolean = text_username_or_email.textContent.isBlank() && text_password.textContent.isEmpty()
private fun isSocialMediaNeeded() {
if (!isEditTextEmpty()) {
showSignUpView(false)
showOauthView(false)
} else {
showSignUpView(true)
showOauthView(true)
}
}
private fun showRemainingSocialAccountsView() { private fun showRemainingSocialAccountsView() {
social_accounts_container.postDelayed({ social_accounts_container.postDelayed({
for (i in 0..social_accounts_container.childCount) { for (i in 0..social_accounts_container.childCount) {
......
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