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

Preserve cursor position #3

Closed
wants to merge 1 commit into from
Closed

Conversation

bracadabra
Copy link

Prevent reset of cursor position after password visibility changes

@behelit
Copy link

behelit commented Jun 21, 2016

I may have copied your changes incorrectly but this seems to put the cursor to the end after toggling?
It's better than the previous implementation where it goes all over the place, but it doesn't seem to be preserving the cursor location?

@bracadabra
Copy link
Author

@behelit The problem linked with touch area of compound drawable. Cursor move to the end bacause you click on EditText, not drawable. You can enlarge touch bounds like this:

touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();

if (event.getAction() == MotionEvent.ACTION_DOWN
                && event.getX() >= (getRight() - getCompoundDrawables()[2].getBounds().width()
                - touchSlop))

@lisawray
Copy link
Owner

Thanks for the pull request! I'm closing it because I used a similar approach but preserved both selection start and end.

#17

@lisawray lisawray closed this Aug 14, 2016
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

3 participants