-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replacing the way error is shown from editText to editTextLayout #876
base: develop
Are you sure you want to change the base?
Conversation
@@ -66,7 +66,7 @@ | |||
android:id="@+id/activity_signin_username_input_layout" | |||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
android:layout_width="0dp" | |||
android:layout_height="40dp" | |||
android:layout_height="wrap_content" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the layout_height is changed to wrap_content
because the layout needs to be big enough, to show the error.
more information: https://stackoverflow.com/a/44831214
see the below comments on this answer :)
|
||
// Store values at the time of the login attempt | ||
String username = usernameEditText.getText().toString().trim(); | ||
String password = passwordEditText.getText().toString(); | ||
|
||
// check for valid password | ||
if (password == null || password.isEmpty() || password.equals("")) { | ||
this.passwordEditText.setError(getString(R.string.error_field_required), errorPassword); | ||
if (password == null || password.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
password.equals("")
was removed cause password.isEmpty()
was already checking the same here.
the same reason for below removal of username.equals("")
android:layout_marginTop="40dp" | ||
app:hintEnabled="false" | ||
app:layout_constraintEnd_toEndOf="@id/activity_signin_guideline_right" | ||
app:layout_constraintStart_toStartOf="@id/activity_signin_guideline_left" | ||
app:layout_constraintTop_toBottomOf="@+id/textView6" | ||
app:layout_constraintWidth_max="500dp"> | ||
app:layout_constraintWidth_max="500dp" | ||
app:endIconMode="custom"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this to them which doesn't have any end icon so after making their height wrap_content
, they all still have a similar height. As the height changes to wrap_content
after an error is shown, via this they all have same height even before error shows.
fixes #875
files to be changed: