Skip to content

Commit

Permalink
fix: add trim functionality to EditTexts (#1378)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchtgpt authored Jun 9, 2023
1 parent 5f05b5a commit 661e539
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ public void onLoginInputTextChanged() {
}

private void handleLoginInputChanged() {
String usernameContent = etUsername.getText().toString();
String passwordContent = etPassword.getText().toString();
String usernameContent = etUsername.getText().toString().trim();
String passwordContent = etPassword.getText().toString().trim();
mPresenter.handleLoginButtonStatus(usernameContent, passwordContent);
}

@OnClick(R.id.btn_login)
public void onLoginClicked() {
Utils.hideSoftKeyboard(this);
showProgressDialog(Constants.LOGGING_IN);
mLoginPresenter.loginUser(etUsername.getText().toString(),
etPassword.getText().toString());
mLoginPresenter.loginUser(etUsername.getText().toString().trim(),
etPassword.getText().toString().trim());
}

@OnClick(R.id.ll_signup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void okayClicked() {
showProgressDialog(Constants.PLEASE_WAIT);

mDebitCardPresenter.verifyDebitCard(mEtDebitCardNumber.getText()
.toString(), mPeMonth.getText().toString(), mPeYear.getText().toString());
.toString().trim(), mPeMonth.getText().toString(), mPeYear.getText().toString());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
public void onTextChanged(CharSequence s, int start, int before, int count) {
// Log.d("qxz", "onTextChanged: " + s.toString());
// mOtherBankAdapter.getFilter().filter(mEtSearchBank.getText().toString());
filter(mEtSearchBank.getText().toString());
filter(mEtSearchBank.getText().toString().trim());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

@OnTextChanged(R.id.et_search)
public void searchTextChanged() {
if (etSearch.getText().toString().length() > 3) {
if (etSearch.getText().toString().trim().length() > 3) {
showSwipeProgress();
mSearchPresenter.performSearch(etSearch.getText().toString());
mSearchPresenter.performSearch(etSearch.getText().toString().trim());
} else {
searchAdapter.clearData();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void setPresenter(EditProfileContract.EditProfilePresenter presenter) {
public void onSaveChangesClicked() {
for (EditText input : userDetailsInputs) {
if (isDataSaveNecessary(input)) {
mPresenter.updateInputById(input.getId(), input.getText().toString());
mPresenter.updateInputById(input.getId(), input.getText().toString().trim());
}
}
hideFab();
Expand Down Expand Up @@ -191,8 +191,8 @@ public void onUserDetailsChanged() {
}

private boolean isDataSaveNecessary(EditText input) {
String content = input.getText().toString();
String currentContent = input.getHint().toString();
String content = input.getText().toString().trim();
String currentContent = input.getHint().toString().trim();
return !(TextUtils.isEmpty(content) || content.equals(currentContent));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ public void onClickDOB() {
public void onClickSubmit() {
showProgressDialog(Constants.PLEASE_WAIT);

String fname = etFname.getText().toString();
String lname = etLname.getText().toString();
String address1 = etAddress1.getText().toString();
String address2 = etAddress2.getText().toString();
String fname = etFname.getText().toString().trim();
String lname = etLname.getText().toString().trim();
String address1 = etAddress1.getText().toString().trim();
String address2 = etAddress2.getText().toString().trim();
String phoneno = ccpPhonecode.getFullNumber();
String dob = etDOB.getText().toString();
String dob = etDOB.getText().toString().trim();

mKYCLevel1Presenter.submitData(fname, lname, address1, address2, phoneno, dob);
Utils.hideSoftKeyboard(getActivity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void onBrowseClicked() {
@OnClick(R.id.btn_submit)
public void onSubmitClicked() {
showProgressDialog(Constants.PLEASE_WAIT);
mKYCLevel2Presenter.uploadKYCDocs(etIdname.getText().toString());
mKYCLevel2Presenter.uploadKYCDocs(etIdname.getText().toString().trim());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public void showMerchants() {

@OnTextChanged(R.id.et_search_merchant)
void filerMerchants() {
filterList(etMerchantSearch.getText().toString());
filterList(etMerchantSearch.getText().toString().trim());
}

public void filterList(String text) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
etVpa.setText(qrDataArray[0]);
etAmount.setText(qrDataArray[1]);
}
String externalId = etVpa.getText().toString();
String externalId = etVpa.getText().toString().trim();
if (etAmount.getText().toString().isEmpty()) {
showSnackbar(Constants.PLEASE_ENTER_AMOUNT);
return;
}
double amount = Double.parseDouble(etAmount.getText().toString());
double amount = Double.parseDouble(etAmount.getText().toString().toString());
if (!mTransferPresenter.checkSelfTransfer(externalId)) {
mTransferPresenter.checkBalanceAvailability(externalId, amount);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void showSetAmountDialog(final String qrData) {
editTextDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String amount = edittext.getText().toString();
String amount = edittext.getText().toString().trim();
if (amount.equals("")) {
showToast(getString(R.string.enter_amount));
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected void onCreate(Bundle savedInstanceState) {
+ Constants.TO
+ tvTransToName.getText()
+ Constants.COLON
+ tvReceiptLink.getText().toString();
+ tvReceiptLink.getText().toString().trim();
}
}

Expand Down Expand Up @@ -205,7 +205,7 @@ void copyReceiptLink() {
ClipboardManager cm = (ClipboardManager) getSystemService(
Context.CLIPBOARD_SERVICE);
ClipData clipData = ClipData.newPlainText(Constants.UNIQUE_RECEIPT_LINK,
tvReceiptLink.getText().toString());
tvReceiptLink.getText().toString().trim());
cm.setPrimaryClip(clipData);
showSnackbar(Constants.UNIQUE_RECEIPT_LINK_COPIED_TO_CLIPBOARD);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void onGetOTp() {
@Override
public void run() {
mMobileVerificationPresenter.requestOTPfromServer(mCcpCode.getFullNumber(),
mEtMobileNumber.getText().toString());
mEtMobileNumber.getText().toString().trim());
}
}, 1500);

Expand Down Expand Up @@ -123,7 +123,7 @@ public void onNextClicked() {
handler.postDelayed(new Runnable() {
@Override
public void run() {
mMobileVerificationPresenter.verifyOTP(mEtOtp.getText().toString());
mMobileVerificationPresenter.verifyOTP(mEtOtp.getText().toString().trim());
}
}, 1500);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@ && isEmpty(mEtBusinessShopName)) {
return;
}

String firstName = mEtFirstName.getText().toString();
String lastName = mEtLastName.getText().toString();
String email = mEtEmail.getText().toString();
String businessName = mEtBusinessShopName.getText().toString();
String addressline1 = mEtAddressLine1.getText().toString();
String addressline2 = mEtAddressLine2.getText().toString();
String pincode = mEtPinCode.getText().toString();
String city = mEtCity.getText().toString();
String username = mEtUserName.getText().toString();
String firstName = mEtFirstName.getText().toString().trim();
String lastName = mEtLastName.getText().toString().trim();
String email = mEtEmail.getText().toString().trim();
String businessName = mEtBusinessShopName.getText().toString().trim();
String addressline1 = mEtAddressLine1.getText().toString().trim();
String addressline2 = mEtAddressLine2.getText().toString().trim();
String pincode = mEtPinCode.getText().toString().trim();
String city = mEtCity.getText().toString().trim();
String username = mEtUserName.getText().toString().trim();
String password = mEtPassword.getText().toString();
String confirmPassword = mEtConfirmPassword.getText().toString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ public void onAddClicked() {
if (!areFieldsValid()) {
return;
}
Card card = new Card(etCardNumber.getText().toString(), etCVV.getText().toString(),
Card card = new Card(etCardNumber.getText().toString().trim(), etCVV.getText().toString(),
spnMM.getSelectedItem() + "/" + spnYY.getSelectedItem(),
etFname.getText().toString(), etLname.getText().toString());
etFname.getText().toString().trim(), etLname.getText().toString().trim());

if (forEdit) {
card.setId(editCard.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public void showSavedCards(List<Card> cards) {

@OnTextChanged(R.id.et_search_cards)
void filterCards() {
String text = etCardSearch.getText().toString();
String text = etCardSearch.getText().toString().trim();
List<Card> filteredList = new ArrayList<>();

if (cardsList != null) {
Expand Down

0 comments on commit 661e539

Please sign in to comment.