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

Timob 6006: Implement setSelection for TextArea and TextField #2675

Merged
merged 5 commits into from Aug 8, 2012

Conversation

hieupham007
Copy link
Contributor

@krowley
Copy link
Contributor

krowley commented Aug 7, 2012

Reviewed code and tested functionality. Approved.

public void setSelection(int start, int end)
{
int textLength = tv.length();
if (start < 0 || start > textLength || end < 0 || end > textLength) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be a better check. Start < 0 could default to start=0. End > textLength could default to end=textLength
Probably also good to check start<end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

'start' doesn't have to be less than 'end'. setSelection(14,0) produces the same result as setSelection(0,14). If user specify invalid values for start or end, then the behavior is undefined. I think in this case it's better to print out a warning and do nothing instead of capping values and let end-developers think their values are correct.

@vishalduggal
Copy link
Contributor

Code Reviewed. Please address comments.

@hieupham007
Copy link
Contributor Author

PR ready for re-review.

@krowley
Copy link
Contributor

krowley commented Aug 8, 2012

Reviewed with changes.
Tested on Android 2.3 Samsung Galaxy S2 (AT&T).

Approved.

@vishalduggal
Copy link
Contributor

Code Reviewed. ACCEPTED

@vishalduggal
Copy link
Contributor

Functional Passed. Tested on Android Device 2.3.6. Was able to select text and set cursor as per description in docs. ACCEPTED

vishalduggal added a commit that referenced this pull request Aug 8, 2012
Timob 6006: Implement setSelection for TextArea and TextField
@vishalduggal vishalduggal merged commit 56e4929 into tidev:master Aug 8, 2012
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