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

Resolved Issue #76 #81

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

Conversation

tavishjain
Copy link
Contributor

Fill out the following while publishing a new pull request.

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    User is now not able to enter mobile number of any length at the Mobile Registration Activity

  • What is the current behavior? (You can also link to an open issue here)
    User is not prompted of wrong number of digits

  • What is the new behavior (if this is a feature change)?
    User is now prompted of wrong number of digits

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

  • Other information:

tavishjain and others added 5 commits April 20, 2018 19:10
Improvised the permissions UI as suggested by the mods and changed the function names according to the convention
Added an error whenever the mobile number entered was greater than 10 digits or less than 10 digits. Also the 'I am in ' button is disabled if the number of digits are not 10.
@Bloody-Badboy
Copy link
Collaborator

@tavishjain Some countries have phone number length > 10

@tavishjain
Copy link
Contributor Author

@Bloody-Badboy that can be classified according to the countries code. Since I dont know how to use the country code widget, I added only for india that is 10 digits

@ritesh-singh
Copy link
Collaborator

@tavishjain Let's not restrict it to 10 digit, phone numbers are 7 to 13 digits are valid phone numbers.

So phone number is invalid if it length than 6 and and greater than 13. Put it in Utils.
Also, user Patterns.Phone regex.

@tavishjain
Copy link
Contributor Author

@ritesh-singh changed the conditions for the phone number. The user can now enter a mobile number varying from 7 to 13 digits.

Also created a Util class and placed the code in it

Copy link
Collaborator

@ritesh-singh ritesh-singh left a comment

Choose a reason for hiding this comment

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

Please, do the required changes.

@@ -12,4 +12,6 @@ org.gradle.jvmargs=-Xmx1536m
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

GOOGLE_MAPS_API_KEY = AIzaSyDeF1mGMsB_qdrh0rjiXrWgmzGgiFfiQR8
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove it from here, put it in gradle.properties file in your system.


userLoginInfo = new UserLoginInfo();

etPhoneNumber = findViewById(R.id.et_phone_number);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make use of databinding, we can avoid findViewByID() here.

* Created by tavishjain on 29-04-2018.
*/

public class PhoneNumberValidation {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why create a new class for PhoneNumberValidation. There is already a util class, just move the logic there. And user the same.

Also make use of Pattern.Phone regex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ritesh-singh I dont know about Pattern.Phone regex

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ritesh-singh
Copy link
Collaborator

@tavishjain Also, take update from upstream first.

@tavishjain
Copy link
Contributor Author

tavishjain commented Apr 29, 2018

@ritesh-singh my branch is up to date

@ritesh-singh Did the changes

etPhoneNumber = ((ActivityUserLoginBinding) mBinding).etPhoneNumber;
iAmInButton = ((ActivityUserLoginBinding) mBinding).bvIn;

AppUtil.validatePhoneNumber(etPhoneNumber , iAmInButton);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why pass view in validatePhoneNumber? Why not just pass the count and text and have listener here itself.

validatePhoneNumber(int count,String text) -> let this function return true or false based on your validation logic.

@@ -14,4 +18,30 @@ public static void replaceFragmentInActivity(FragmentManager fragmentManager, Fr
int containerId) {
fragmentManager.beginTransaction().replace(containerId, fragment).commit();
}

public static void validatePhoneNumber(EditText phoneNumberView , View iAmInButtonView){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, don't have listener here, let this function just accept, count and text and make this function return true or false.

Also, move the logic in Util class.

@tavishjain
Copy link
Contributor Author

@ritesh-singh I hope no more changes to be done now

@tavishjain
Copy link
Contributor Author

Please review this PR

@tavishjain
Copy link
Contributor Author

?

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.

3 participants