Skip to content

Conversation

@Hafiz-Waleed-Hussain
Copy link

Hi,
I added a search functionality in the response tab. Now anyone can see highlighted search criteria on response tab.

Copy link

@olivierperez olivierperez left a comment

Choose a reason for hiding this comment

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

Some changes could be done, but this feature can really add to the lib.

public boolean onQueryTextChange(String newText) {
String text = body.getText().toString();
if (newText.trim().length() > 0 && text.contains(newText.trim()))
body.setText(SearchHighlightUtil.format(body.getText().toString(), newText));

Choose a reason for hiding this comment

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

You should originalBody here, no ?
body.setText(SearchHighlightUtil.format(originalBody, newText));

TextView headers;
TextView body;


Choose a reason for hiding this comment

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

Why do you add this line?


private int type;
private HttpTransaction transaction;
private String originalBody;

Choose a reason for hiding this comment

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

You can maybe delete this field, and use transaction.getFormattedRequestBody() instead. No need to add a field if another field already holds the value.

* Created by waleed on 17/02/2018.
*/

public class SearchHighlightUtil {

Choose a reason for hiding this comment

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

This is not a valid Javadoc. Take advantage of this fix for adding description to this new class.

@Hafiz-Waleed-Hussain
Copy link
Author

Thank you for the detailed code review. I will do fixes and update the request.

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.

2 participants