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

when EditText show validation error tooltip in pager #15

Closed
boomsya opened this issue Dec 15, 2015 · 5 comments
Closed

when EditText show validation error tooltip in pager #15

boomsya opened this issue Dec 15, 2015 · 5 comments

Comments

@boomsya
Copy link

boomsya commented Dec 15, 2015

hi!

i have 2 pages. and i can scroll page to left and after that i have see second page

when i scroll - validation tooltip sticky to the left side of screen

i have attached img
pic_2
pic_3
pic_4

@thyrlian
Copy link
Owner

Hi @boomsya , thanks for using AwesomeValidation and your valuable feedback.

Please correct me if I get it wrong:
I assume that you are using ViewPager, and I think you want to dismiss the sticky tooltip when scrolling to the other page. Then could you try to call mAwesomeValidation.clear(); when ViewPager.onScrollChanged?

Because to me, each developer's implementation differs, I can't guess beforehand what listener I should register the clear method to.

@boomsya
Copy link
Author

boomsya commented Dec 15, 2015

sorry for not good English :)
yes, you right

can tooltip slide(move) with TextEdit synchronous over screen?

but your answer really help me too

@thyrlian
Copy link
Owner

No problem :)

Now I completely understand the problem: the tooltip doesn't move along with the screen.

Hmmm, I'm afraid that we could do nothing about it. Since the tooltip is from Android's code: EditText.setError(CharSequence error). You can check this line here.

So I guess you'd better clear the validation onScrollChanged. But please be careful, only clear when you're sure the 2nd page is ready, not when user by accident move several pixels left or right.

Thanks and good luck :)

@boomsya
Copy link
Author

boomsya commented Dec 15, 2015

thanks for helping to me

can i ask just one question?
i have EditText fields and when user clear (for example) seond field - i have event:
yourage_input.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
mAwesomeValidation.validate(); <<<<-----------------
}
public void beforeTextChanged(CharSequence s, int start, int count, int after){}
public void onTextChanged(CharSequence s, int start, int before, int count){}
});

but user can delete text in first field, and go to second and delete text in second
and after that his enter valid number in first field and mAwesomeValidation.validate() return to me FALSE because second field empty (i added validator RegexTemplate.NOT_EMPTY)

can i check validation for concrete field? (when user fill first field valid - i should need set seekbar value from field)
i have fouded function "checkFields" but they check all ArrayList


at now i will do that:
private AwesomeValidation field1validator;
private AwesomeValidation field2validator;
private AwesomeValidation field3validator;

for split validating to peaces

@thyrlian
Copy link
Owner

Sorry that I just got time to read your comments.

To answer your question:

  • I didn't think about validating fields one by one, that's why the _checkFields_ method you found iterates all.
  • The reason I did it this way is because I believe that validating all fields at once is the most common use case. But you're right, sometimes we just want to trigger validation of one single field on its input change.
  • For the time being (based on current implementation), I think you did it right: instantiating one AwesomeValidation object per field, and validate them isolatedly.

Have fun playing with it :)

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

No branches or pull requests

2 participants