Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.support.v4.app.Fragment
import android.arch.lifecycle.Observer
import android.content.Intent
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -62,6 +64,20 @@ class SignUpFragment : Fragment() {
redirectToMain()
})

rootView.passwordSignUp.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(p0: Editable?) {
if (passwordSignUp.text.toString().length >= 6 || passwordSignUp.text.toString().isEmpty()) {
textInputLayoutPassword.error = null
textInputLayoutPassword.isErrorEnabled = false
} else {
textInputLayoutPassword.error = "Password too short!"
}
}

override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {/*Implement here*/}
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {/*Implement here*/}
})

return rootView
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ class SignUpFragmentViewModel(private val authService: AuthService,
error.value = "Passwords do not match!"
return true
}

if (password.length < 6) {
error.value = "Password should be atleast 6 characters!"
return true
}

return false
}

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_signup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|bottom"
android:layout_marginBottom="@dimen/layout_margin_large"
android:layout_marginBottom="@dimen/details_margin_small"
android:textColor="@color/black"
android:textSize="@dimen/text_size_very_large"
android:text="@string/eventyay_logo"/>
Expand Down Expand Up @@ -55,6 +55,7 @@

<!-- Password Label -->
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayoutPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_medium"
Expand Down