From 3d99f48bec968757b038afd5990508e83bc4ee68 Mon Sep 17 00:00:00 2001 From: cdhiraj40 Date: Wed, 15 Dec 2021 16:51:09 +0530 Subject: [PATCH 1/4] replaced showing error from editText to editTextLayout in signInActivity --- .../res/layout/activity_signin.xml | 4 +-- .../app/views/login/SigninActivity.java | 27 +++++++++++-------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/org.envirocar.app/res/layout/activity_signin.xml b/org.envirocar.app/res/layout/activity_signin.xml index 5c2410bb4..f90320eba 100644 --- a/org.envirocar.app/res/layout/activity_signin.xml +++ b/org.envirocar.app/res/layout/activity_signin.xml @@ -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" android:layout_marginTop="40dp" app:hintEnabled="false" app:layout_constraintEnd_toEndOf="@id/activity_signin_guideline_right" @@ -91,7 +91,7 @@ android:id="@+id/activity_signin_password_input_layout" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="0dp" - android:layout_height="40dp" + android:layout_height="wrap_content" android:layout_marginTop="40dp" app:hintEnabled="false" app:layout_constraintEnd_toEndOf="@id/activity_signin_guideline_right" diff --git a/org.envirocar.app/src/org/envirocar/app/views/login/SigninActivity.java b/org.envirocar.app/src/org/envirocar/app/views/login/SigninActivity.java index e66518db7..2a15f60ad 100644 --- a/org.envirocar.app/src/org/envirocar/app/views/login/SigninActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/views/login/SigninActivity.java @@ -34,6 +34,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; +import com.google.android.material.textfield.TextInputLayout; import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; @@ -85,6 +86,10 @@ public static void startActivity(Context context) { protected EditText usernameEditText; @BindView(R.id.activity_login_password_input) protected EditText passwordEditText; + @BindView(R.id.activity_signin_username_input_layout) + protected TextInputLayout usernameEditTextLayout; + @BindView(R.id.activity_signin_password_input_layout) + protected TextInputLayout passwordEditTextLayout; @BindView(R.id.activity_login_logo) protected ImageView logoImageView; @@ -155,22 +160,22 @@ protected void onLoginClicked() { View focusView = null; // Reset errors - this.usernameEditText.setError(null); - this.passwordEditText.setError(null); + this.usernameEditTextLayout.setError(null); + this.passwordEditTextLayout.setError(null); // 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()) { + this.passwordEditTextLayout.setError(getString(R.string.error_field_required)); focusView = this.passwordEditText; } // check for valid username - if (username == null || username.isEmpty() || username.equals("")) { - this.usernameEditText.setError(getString(R.string.error_field_required), errorUsername); + if (username == null || username.isEmpty()) { + this.usernameEditTextLayout.setError(getString(R.string.error_field_required)); focusView = this.usernameEditText; } @@ -226,8 +231,8 @@ public void onError(Throwable e) { if (e instanceof LoginException) { switch (((LoginException) e).getType()) { case USERNAME_OR_PASSWORD_INCORRECT: - usernameEditText.setError(getString(R.string.error_invalid_credentials), errorUsername); - passwordEditText.setError(getString(R.string.error_invalid_credentials), errorPassword); + usernameEditTextLayout.setError(getString(R.string.error_invalid_credentials)); + passwordEditTextLayout.setError(getString(R.string.error_invalid_credentials)); break; case MAIL_NOT_CONFIREMED: // show alert dialog @@ -240,10 +245,10 @@ public void onError(Throwable e) { .show(); break; case UNABLE_TO_COMMUNICATE_WITH_SERVER: - passwordEditText.setError(getString(R.string.error_host_not_found), errorPassword); + passwordEditTextLayout.setError(getString(R.string.error_host_not_found)); break; default: - passwordEditText.setError(getString(R.string.logbook_invalid_input), errorPassword); + passwordEditTextLayout.setError(getString(R.string.logbook_invalid_input)); break; } } else if (!checkNetworkConnection()) { @@ -261,4 +266,4 @@ private boolean checkNetworkConnection() { return true; return false; } -} +} \ No newline at end of file From 1082f88f6ff8fa46def1775f8f0d77c3e286c6f7 Mon Sep 17 00:00:00 2001 From: cdhiraj40 Date: Fri, 17 Dec 2021 16:29:51 +0530 Subject: [PATCH 2/4] replaced showing error from editText to editTextLayout in signUpActivity --- .../res/layout/activity_signin.xml | 4 +- .../res/layout/activity_signup.xml | 67 ++++++++++++------- .../app/views/login/SignupActivity.java | 61 ++++++++++------- 3 files changed, 84 insertions(+), 48 deletions(-) diff --git a/org.envirocar.app/res/layout/activity_signin.xml b/org.envirocar.app/res/layout/activity_signin.xml index f90320eba..e8f25009d 100644 --- a/org.envirocar.app/res/layout/activity_signin.xml +++ b/org.envirocar.app/res/layout/activity_signin.xml @@ -72,7 +72,8 @@ 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"> diff --git a/org.envirocar.app/res/layout/activity_signup.xml b/org.envirocar.app/res/layout/activity_signup.xml index ab3d98c7f..7ec6c5ebd 100644 --- a/org.envirocar.app/res/layout/activity_signup.xml +++ b/org.envirocar.app/res/layout/activity_signup.xml @@ -63,13 +63,14 @@ android:id="@+id/activity_signup_username_input_layout" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="0dp" - android:layout_height="40dp" + android:layout_height="wrap_content" android:layout_marginTop="40dp" app:hintEnabled="false" app:layout_constraintEnd_toEndOf="@id/activity_signup_guideline_right" app:layout_constraintStart_toStartOf="@id/activity_signup_guideline_left" app:layout_constraintTop_toBottomOf="@+id/textView6" - app:layout_constraintWidth_max="500dp"> + app:layout_constraintWidth_max="500dp" + app:endIconMode="custom"> @@ -88,20 +89,21 @@ android:id="@+id/activity_signup_email_input_layout" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="0dp" - android:layout_height="40dp" + android:layout_height="wrap_content" android:layout_marginTop="24dp" app:hintEnabled="false" app:layout_constraintEnd_toEndOf="@id/activity_signup_guideline_right" app:layout_constraintStart_toStartOf="@id/activity_signup_guideline_left" app:layout_constraintTop_toBottomOf="@+id/activity_signup_username_input_layout" - app:layout_constraintWidth_max="500dp"> + app:layout_constraintWidth_max="500dp" + app:endIconMode="custom"> @@ -111,7 +113,7 @@ android:id="@+id/activity_signup_password_1_layout" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="0dp" - android:layout_height="40dp" + android:layout_height="wrap_content" android:layout_marginTop="24dp" app:hintEnabled="false" app:layout_constraintEnd_toEndOf="@id/activity_signup_guideline_right" @@ -120,7 +122,8 @@ app:layout_constraintWidth_max="500dp" app:endIconMode="password_toggle" app:endIconDrawable="@drawable/custom_password_eye" - app:endIconTint="@color/white_cario"> + app:endIconTint="@color/white_cario" + app:errorIconDrawable="@null"> - - + app:layout_constraintTop_toBottomOf="@+id/activity_signup_tou_checkbox" + app:layout_constraintWidth_max="500dp" > + + + + app:layout_constraintTop_toBottomOf="@+id/activity_signup_tou_text_layout" /> - + app:layout_constraintTop_toBottomOf="@+id/activity_signup_ps_checkbox" + app:layout_constraintWidth_max="500dp"> + + + + app:layout_constraintTop_toBottomOf="@+id/activity_signup_ps_text_layout"> { if (e.getConflictType() == ResourceConflictException.ConflictType.USERNAME) { - usernameEditText.setError(getString( - R.string.error_username_already_in_use),errorUsername); + usernameEditTextLayout.setError(getString( + R.string.error_username_already_in_use)); usernameEditText.requestFocus(); } else if (e.getConflictType() == ResourceConflictException.ConflictType.MAIL) { - emailEditText.setError(getString(R.string.error_email_already_in_use),errorUsername); + emailEditTextLayout.setError(getString(R.string.error_email_already_in_use)); emailEditText.requestFocus(); } }); @@ -294,7 +309,7 @@ private void register(String username, String email, String password) { // Show an error. mainThreadWorker.schedule(() -> { - usernameEditText.setError(getString(R.string.error_host_not_found),errorUsername); + usernameEditTextLayout.setError(getString(R.string.error_host_not_found)); usernameEditText.requestFocus(); }); @@ -361,17 +376,17 @@ private void showPrivacyStatementDialog() { */ private boolean checkUsernameValidity(String username) { // reset error text - usernameEditText.setError(null); + usernameEditTextLayout.setError(null); boolean isValidUsername = true; if (username == null || username.isEmpty() || username.equals("")) { - usernameEditText.setError(getString(R.string.error_field_required),errorUsername); + usernameEditTextLayout.setError(getString(R.string.error_field_required)); isValidUsername = false; } else if (username.length() < 6) { - usernameEditText.setError(getString(R.string.error_invalid_username),errorUsername); + usernameEditTextLayout.setError(getString(R.string.error_invalid_username)); isValidUsername = false; } else if (!Pattern.matches(USERNAME_REGEX,username)) { - usernameEditText.setError(getString(R.string.error_username_contain_special),errorUsername); + usernameEditTextLayout.setError(getString(R.string.error_username_contain_special)); isValidUsername = false; } return isValidUsername; @@ -383,10 +398,10 @@ private boolean checkUsernameValidity(String username) { private boolean checkEmailValidity(String email) { boolean isValidEmail = true; if (TextUtils.isEmpty(email)) { - emailEditText.setError(getString(R.string.error_field_required),errorUsername); + emailEditTextLayout.setError(getString(R.string.error_field_required)); isValidEmail = false; } else if (!Pattern.matches(EMAIL_REGEX, email)) { - emailEditText.setError(getString(R.string.error_invalid_email),errorUsername); + emailEditTextLayout.setError(getString(R.string.error_invalid_email)); isValidEmail = false; } return isValidEmail; @@ -398,20 +413,20 @@ private boolean checkEmailValidity(String email) { private boolean checkPasswordValidity(String password) { boolean isValidPassword = true; if (password == null || password.isEmpty() || password.equals("")) { - password1EditText.setError(getString(R.string.error_field_required), errorPassword); + password1EditTextLayout.setError(getString(R.string.error_field_required)); isValidPassword = false; } else if (password.length() < 6) { - password1EditText.setError(getString(R.string.error_invalid_password), errorPassword); + password1EditTextLayout.setError(getString(R.string.error_invalid_password)); isValidPassword = false; } else if (!Pattern.matches(PASSWORD_REGEX, password)) { - password1EditText.setError(getString(R.string.error_field_weak_password), errorPassword); + password1EditTextLayout.setError(getString(R.string.error_field_weak_password)); isValidPassword = false; } else { final String password2 = password2EditText.getText().toString().trim(); if (!password2.equals("") && !password2.isEmpty() && password2 != null) { checkPasswordMatch(password, password2); }else { - password2EditText.setError(getString(R.string.error_field_required), errorPassword); + password2EditTextLayout.setError(getString(R.string.error_field_required)); } } return isValidPassword; @@ -423,7 +438,7 @@ private boolean checkPasswordValidity(String password) { private boolean checkConfirmPasswordValidity(String password2) { boolean isValidMatch = true; if (password2 == null || password2.isEmpty() || password2.equals("")) { - password2EditText.setError(getString(R.string.error_field_required), errorPassword); + password2EditTextLayout.setError(getString(R.string.error_field_required)); isValidMatch = false; } else { final String password1 = password1EditText.getText().toString().trim(); @@ -440,11 +455,11 @@ private boolean checkConfirmPasswordValidity(String password2) { private boolean checkPasswordMatch(String password, String password2) { boolean isValidMatch = password.equals(password2); if (!isValidMatch) { - password1EditText.setError(getString(R.string.error_passwords_not_matching), errorPassword); - password2EditText.setError(getString(R.string.error_passwords_not_matching), errorPassword); + password1EditTextLayout.setError(getString(R.string.error_passwords_not_matching)); + password2EditTextLayout.setError(getString(R.string.error_passwords_not_matching)); } else { - password1EditText.setError(null); - password2EditText.setError(null); + password1EditTextLayout.setError(null); + password2EditTextLayout.setError(null); } return isValidMatch; } @@ -484,10 +499,10 @@ private void observeFormInputs() { RxCompoundButton.checkedChanges(touCheckbox) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(b -> touCheckbox.setError(null), LOG::error); + .subscribe(b -> touTextLayout.setError(null), LOG::error); RxCompoundButton.checkedChanges(psCheckbox) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(b -> psCheckbox.setError(null), LOG::error); + .subscribe(b -> psTextLayout.setError(null), LOG::error); } } From ba2627e6ddbda6c4c1cc2568a428ae60214c54e5 Mon Sep 17 00:00:00 2001 From: cdhiraj40 Date: Fri, 17 Dec 2021 16:59:33 +0530 Subject: [PATCH 3/4] replaced showing error from editText to editTextLayout in carSelectionFragment --- .../CarSelectionAttributesFragment.java | 31 ++++++++++++------- .../CarSelectionHsnTsnFragment.java | 21 ++++++++----- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionAttributesFragment.java b/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionAttributesFragment.java index 96eda2a27..a46e6a15b 100644 --- a/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionAttributesFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionAttributesFragment.java @@ -34,6 +34,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.google.android.material.textfield.TextInputLayout; import com.jakewharton.rxbinding3.widget.RxTextView; import org.envirocar.app.BaseApplicationComponent; @@ -70,10 +71,16 @@ public class CarSelectionAttributesFragment extends BaseInjectorFragment { @BindView(R.id.fragment_attributes_manufacturer_input) protected AutoCompleteTextView manufactureEditText; + @BindView(R.id.fragment_attributes_manufacturer_input_layout) + protected TextInputLayout manufactureEditTextLayout; @BindView(R.id.fragment_attributes_model_input) protected AutoCompleteTextView modelEditText; + @BindView(R.id.fragment_attributes_model_input_layout) + protected TextInputLayout modelEditTextLayout; @BindView(R.id.fragment_attributes_year_input) protected AutoCompleteTextView yearEditText; + @BindView(R.id.fragment_attributes_year_input_layout) + protected TextInputLayout yearEditTextLayout; @Inject EnviroCarVehicleDB enviroCarVehicleDB; @@ -122,20 +129,20 @@ protected void injectDependencies(BaseApplicationComponent baseApplicationCompon @OnTextChanged(value = R.id.fragment_attributes_manufacturer_input, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) protected void onManufacturerChanged() { - manufactureEditText.setError(null); + manufactureEditTextLayout.setError(null); modelEditText.setText(""); yearEditText.setText(""); } @OnTextChanged(value = R.id.fragment_attributes_model_input, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) protected void onModelChanged() { - modelEditText.setError(null); + modelEditTextLayout.setError(null); yearEditText.setText(""); } @OnTextChanged(value = R.id.fragment_attributes_year_input, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) protected void onYearChanged() { - yearEditText.setError(null); + yearEditTextLayout.setError(null); } @OnClick(R.id.fragment_car_search_button) @@ -145,17 +152,17 @@ void searchButtonClick() { String year = yearEditText.getText().toString().trim(); View focusView = null; if (manufacturer.isEmpty()) { - manufactureEditText.setError(getString(R.string.car_selection_error_empty_input), error); + manufactureEditTextLayout.setError(getString(R.string.car_selection_error_empty_input)); focusView = manufactureEditText; } if (model.isEmpty()) { - modelEditText.setError(getString(R.string.car_selection_error_select_from_list), error); + modelEditTextLayout.setError(getString(R.string.car_selection_error_select_from_list)); focusView = modelEditText; } if (year.isEmpty()) { - yearEditText.setError(getString(R.string.car_selection_error_select_from_list), error); + yearEditTextLayout.setError(getString(R.string.car_selection_error_select_from_list)); focusView = yearEditText; } @@ -299,10 +306,10 @@ private void reactiveTexFieldCheck() { } } if (flag == 0) { - manufactureEditText.setError(getString(R.string.car_selection_error_select_from_list), error); + manufactureEditTextLayout.setError(getString(R.string.car_selection_error_select_from_list)); manufactureEditText.requestFocus(); } else { - manufactureEditText.setError(null); + manufactureEditTextLayout.setError(null); } })); @@ -323,10 +330,10 @@ private void reactiveTexFieldCheck() { } if (flag == 0) { - modelEditText.setError(getString(R.string.car_selection_error_select_from_list), error); + modelEditTextLayout.setError(getString(R.string.car_selection_error_select_from_list)); modelEditText.requestFocus(); } else { - modelEditText.setError(null); + modelEditTextLayout.setError(null); } } catch (Exception e) { } @@ -349,10 +356,10 @@ private void reactiveTexFieldCheck() { } if (flag == 0) { - yearEditText.setError(getString(R.string.car_selection_error_select_from_list), error); + yearEditTextLayout.setError(getString(R.string.car_selection_error_select_from_list)); yearEditText.requestFocus(); } else { - yearEditText.setError(null); + yearEditTextLayout.setError(null); } } catch (Exception e) { } diff --git a/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionHsnTsnFragment.java b/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionHsnTsnFragment.java index 488a4bca0..53172186f 100644 --- a/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionHsnTsnFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionHsnTsnFragment.java @@ -34,6 +34,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.google.android.material.textfield.TextInputLayout; import com.jakewharton.rxbinding3.widget.RxTextView; import org.envirocar.app.BaseApplicationComponent; @@ -70,8 +71,12 @@ public class CarSelectionHsnTsnFragment extends BaseInjectorFragment { @BindView(R.id.fragment_hsntsn_hsn_input) protected AutoCompleteTextView hsnEditText; + @BindView(R.id.fragment_hsntsn_hsn_input_layout) + protected TextInputLayout hsnEditTextLayout; @BindView(R.id.fragment_hsntsn_tsn_input) protected AutoCompleteTextView tsnEditText; + @BindView(R.id.fragment_hsntsn_tsn_input_layout) + protected TextInputLayout tsnEditTextLayout; protected BottomSheetFragment bottomSheetFragment; private static final Logger LOG = Logger.getLogger(CarSelectionAttributesFragment.class); @@ -130,11 +135,11 @@ protected void onSearchClicked() { String tsn = tsnEditText.getText().toString().trim(); View focusView = null; if (hsn.isEmpty()) { - hsnEditText.setError(getString(R.string.car_selection_error_empty_input), error); + hsnEditTextLayout.setError(getString(R.string.car_selection_error_empty_input)); focusView = hsnEditText; } if (tsn.isEmpty()) { - tsnEditText.setError(getString(R.string.car_selection_error_empty_input), error); + tsnEditTextLayout.setError(getString(R.string.car_selection_error_empty_input)); focusView = tsnEditText; } @@ -145,7 +150,7 @@ protected void onSearchClicked() { } // also stop searching if already error becuase of values not in list - if (hsnEditText.getError() != null || tsnEditText.getError() != null) + if (hsnEditTextLayout.getError() != null || tsnEditText.getError() != null) return; String hsn = hsnWithManufactureName.substring(0, 4); @@ -204,7 +209,7 @@ private void focusChangeListener() { } else { // if focus on hsneditText reset error in tsnEditText - tsnEditText.setError(null); + tsnEditTextLayout.setError(null); } }); } @@ -260,10 +265,10 @@ private void reactiveTexFieldCheck() { } } if (flag == 0) { - hsnEditText.setError(getString(R.string.car_selection_error_select_from_list), error); + hsnEditTextLayout.setError(getString(R.string.car_selection_error_select_from_list)); hsnEditText.requestFocus(); } else { - hsnEditText.setError(null); + hsnEditTextLayout.setError(null); } })); @@ -284,10 +289,10 @@ private void reactiveTexFieldCheck() { } if (flag == 0) { - tsnEditText.setError(getString(R.string.car_selection_error_select_from_list), error); + tsnEditTextLayout.setError(getString(R.string.car_selection_error_select_from_list)); tsnEditText.requestFocus(); } else { - tsnEditText.setError(null); + tsnEditTextLayout.setError(null); } } catch (Exception e) { } From 1bd5963a3fa0677d539e9151d6b6ce5c3112c9a7 Mon Sep 17 00:00:00 2001 From: cdhiraj40 Date: Fri, 17 Dec 2021 17:01:56 +0530 Subject: [PATCH 4/4] removed drawable error icons --- .../carselection/CarSelectionAttributesFragment.java | 3 --- .../carselection/CarSelectionHsnTsnFragment.java | 3 --- .../org/envirocar/app/views/login/SigninActivity.java | 11 ----------- .../org/envirocar/app/views/login/SignupActivity.java | 10 +--------- 4 files changed, 1 insertion(+), 26 deletions(-) diff --git a/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionAttributesFragment.java b/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionAttributesFragment.java index a46e6a15b..a78ba85bb 100644 --- a/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionAttributesFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionAttributesFragment.java @@ -92,7 +92,6 @@ public class CarSelectionAttributesFragment extends BaseInjectorFragment { private CompositeDisposable disposable = new CompositeDisposable(); private static final int ERROR_DEBOUNCE_TIME = 750; private List manufacturersList; - private static Drawable error; CarSelectionAttributesFragment(List manufacturersList) { this.manufacturersList = manufacturersList; @@ -108,8 +107,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c fetchManufactureres(); initFocusChangedListener(); reactiveTexFieldCheck(); - error = getResources().getDrawable(R.drawable.ic_error_red_24dp); - error.setBounds(-50, 0, 0, error.getIntrinsicHeight()); manufactureEditText.setOnItemClickListener((parent, view1, position, id) -> requestNextTextFieldFocus(manufactureEditText)); modelEditText.setOnItemClickListener((parent, view12, position, id) -> requestNextTextFieldFocus(modelEditText)); yearEditText.setOnItemClickListener((parent, view13, position, id) -> requestNextTextFieldFocus(yearEditText)); diff --git a/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionHsnTsnFragment.java b/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionHsnTsnFragment.java index 53172186f..abab99faf 100644 --- a/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionHsnTsnFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/views/carselection/CarSelectionHsnTsnFragment.java @@ -90,7 +90,6 @@ public class CarSelectionHsnTsnFragment extends BaseInjectorFragment { private CompositeDisposable disposable = new CompositeDisposable(); private static final int ERROR_DEBOUNCE_TIME = 750; List manufacturersList; - private Drawable error; CarSelectionHsnTsnFragment(List manufacturersList) { this.manufacturersList = manufacturersList; @@ -105,8 +104,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c fetchAllVehicles(); reactiveTexFieldCheck(); focusChangeListener(); - error = getResources().getDrawable(R.drawable.ic_error_red_24dp); - error.setBounds(-50, 0, 0, error.getIntrinsicHeight()); hsnEditText.setOnItemClickListener((parent, view1, position, id) -> requestNextTextFieldFocus(hsnEditText)); tsnEditText.setOnItemClickListener((parent, view1, position, id) -> requestNextTextFieldFocus(tsnEditText)); return view; diff --git a/org.envirocar.app/src/org/envirocar/app/views/login/SigninActivity.java b/org.envirocar.app/src/org/envirocar/app/views/login/SigninActivity.java index 2a15f60ad..ad90653ff 100644 --- a/org.envirocar.app/src/org/envirocar/app/views/login/SigninActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/views/login/SigninActivity.java @@ -20,7 +20,6 @@ import android.content.Context; import android.content.Intent; -import android.graphics.drawable.Drawable; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; @@ -92,10 +91,7 @@ public static void startActivity(Context context) { protected TextInputLayout passwordEditTextLayout; @BindView(R.id.activity_login_logo) protected ImageView logoImageView; - private Disposable loginSubscription; - private static Drawable errorPassword; - private static Drawable errorUsername; @Override protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { @@ -110,13 +106,6 @@ protected void onCreate(Bundle savedInstanceState) { // inject the views ButterKnife.bind(this); - - errorPassword = getResources().getDrawable(R.drawable.ic_error_red_24dp); - errorPassword.setBounds(-70,0,0, errorPassword.getIntrinsicHeight()); - - errorUsername = getResources().getDrawable(R.drawable.ic_error_red_24dp); - errorUsername.setBounds(0, 0, errorUsername.getIntrinsicWidth(), errorUsername.getIntrinsicHeight()); - } @Override diff --git a/org.envirocar.app/src/org/envirocar/app/views/login/SignupActivity.java b/org.envirocar.app/src/org/envirocar/app/views/login/SignupActivity.java index 9d7d717f8..2556cb967 100644 --- a/org.envirocar.app/src/org/envirocar/app/views/login/SignupActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/views/login/SignupActivity.java @@ -20,7 +20,6 @@ import android.content.Context; import android.content.Intent; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.text.Selection; import android.text.Spannable; @@ -85,8 +84,7 @@ public class SignupActivity extends BaseInjectorActivity { private static final String PASSWORD_REGEX = "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{6,}$"; private static final String USERNAME_REGEX = "^[A-Za-z0-9_-]{6,}$"; private static final int CHECK_FORM_DELAY = 750; - private static Drawable errorPassword; - private static Drawable errorUsername; + public static void startActivity(Context context) { Intent intent = new Intent(context, SignupActivity.class); @@ -152,12 +150,6 @@ protected void onCreate(Bundle savedInstanceState) { // inject the views ButterKnife.bind(this); - errorPassword = getResources().getDrawable(R.drawable.ic_error_red_24dp); - errorPassword.setBounds(-70,0,0, errorPassword.getIntrinsicHeight()); - - errorUsername = getResources().getDrawable(R.drawable.ic_error_red_24dp); - errorUsername.setBounds(0, 0, errorUsername.getIntrinsicWidth(), errorUsername.getIntrinsicHeight()); - // make terms of use and privacy statement clickable this.makeClickableTextLinks(); observeFormInputs();