Skip to content
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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

cdhiraj40
Copy link
Contributor

@cdhiraj40 cdhiraj40 commented Dec 15, 2021

fixes #875

files to be changed:

  • activity_signin.xml
  • activity_signup.xml
  • fragment_car_selection_attributes.xml
  • fragment_car_selection_hsn_tsn.xml
new changes
sign_in sign_up
hsn-tsn attributes

@@ -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"
Copy link
Contributor Author

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()) {
Copy link
Contributor Author

@cdhiraj40 cdhiraj40 Dec 15, 2021

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">
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant