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

Convert java to kotlin #142

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

SangeethaTestPress
Copy link
Contributor

Changes done

  • converted the java files to kotlin files

Reason for the changes

Fixes # . Remove this line if there aren't any corresponding issues created

Stats

  • Number of Test Cases -

Guidelines

  • Have you self reviewed this PR in context to the previous PR feedbacks?

Comment on lines +163 to +183
if (!populated(editTextPassword)) {
passwordErrorText.visibility = View.VISIBLE
passwordErrorText.text = getString(R.string.empty_input_error)
isValid = false
}
if (!populated(editTextConfirmPassword)) {
confirmPasswordErrorText.visibility = View.VISIBLE
confirmPasswordErrorText.text = getString(R.string.empty_input_error)
isValid = false
}
if (!populated(editTextEmail)) {
emailErrorText.visibility = View.VISIBLE
emailErrorText.text = getString(R.string.empty_input_error)
isValid = false
}
if (!populated(editTextUserName)) {
usernameErrorText.visibility = View.VISIBLE
usernameErrorText.text = getString(R.string.empty_input_error)
isValid = false
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code can be reduced by extraction

Comment on lines +246 to +248
private fun populated(editText: EditText): Boolean {
return editText.text.toString().trim().isNotEmpty()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be used as extension

Comment on lines +326 to +334
private fun showProgressDialog() {
progressDialog = MaterialDialog.Builder(this)
.title(R.string.loading)
.content(R.string.please_wait)
.widgetColorRes(R.color.primary)
.progress(true, 0)
.cancelable(false)
.show()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to UIUtils

Comment on lines +390 to +392
intent?.extras?.let {
intent.putExtras(it)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unneccessary

Comment on lines +395 to +420
private fun showSuccessLayout() {
registerLayout.visibility = View.GONE
success_description.setText(R.string.activation_email_sent_message)
success_complete.visibility = View.VISIBLE
}

private fun setUserNameError(registrationErrorDetails: RegistrationErrorDetails) {
usernameErrorText.visibility = View.VISIBLE
usernameErrorText.text = registrationErrorDetails.username[0]
editTextUserName.requestFocus()
}

private fun setEmailError(registrationErrorDetails: RegistrationErrorDetails) {
emailErrorText.visibility = View.VISIBLE
emailErrorText.text = registrationErrorDetails.email[0]
editTextEmail.requestFocus()
}

private fun setPasswordError(registrationErrorDetails: RegistrationErrorDetails) {
passwordErrorText.visibility = View.VISIBLE
passwordErrorText.text = registrationErrorDetails.password[0]
editTextPassword.requestFocus()
}

private fun setPhoneNumberError(registrationErrorDetails: RegistrationErrorDetails) {
phoneErrorText.visibility = View.VISIBLE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code duplications can be removed by extraction method

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

2 participants