codereview #2 of 12 (Moroldo) from 0 (Fasan)#114
codereview #2 of 12 (Moroldo) from 0 (Fasan)#114lucamoroz wants to merge 4 commits intoPrandiniUniPD:codereviewfrom lucamoroz:2codereview2
Conversation
| /** | ||
| * Size of the dropdown suggestions list | ||
| */ | ||
| private static final int MAX_DROPDOWN_SUGGESTIONS = 40; |
There was a problem hiding this comment.
In my opinion 40 as Size of the dropdown list is too high. I recommend reducing it to 10/20.
| } | ||
|
|
||
| @Override | ||
| protected void onNewIntent(Intent intent) { |
There was a problem hiding this comment.
I recommend adding a brief comment on what this function does.
There was a problem hiding this comment.
I'll add a comment soon, thank you for the report
|
|
||
| //update textview text and set cursor to the end | ||
| mAutoCompleteTextView.setText(query); | ||
| mAutoCompleteTextView.setSelection(query.length()); |
There was a problem hiding this comment.
I do not understand what the setSelection function does
There was a problem hiding this comment.
It sets the cursor at the end of the word, so the user can eventually append some text after choosing any suggestion
| //update TextView and set cursor at the end of the text | ||
| mAutoCompleteTextView.setText(ingredientClicked); | ||
| mAutoCompleteTextView.setSelection(mAutoCompleteTextView.getText().length()); | ||
| mSearchButton.performClick(); |
There was a problem hiding this comment.
I suggest you add a comment to explain what the function .performClick () does.
Like this "Call this view's OnClickListener, if it is defined. Performs all normal actions associated with clicking".
There was a problem hiding this comment.
Ok thank you for reporting that
| } | ||
|
|
||
| @Override | ||
| protected FilterResults performFiltering(CharSequence constraint) { |
There was a problem hiding this comment.
why do you use a CharSequence variable instead of a String variable since then you have to convert the CharSequence variable to String?
There was a problem hiding this comment.
Because I'm overriding this class functions:
https://developer.android.com/reference/android/widget/Filter
| * starts with the constraint query or contains a substring that starts with the constraint | ||
| * query. | ||
| */ | ||
| private class AutoCompleteTVSetup implements Runnable { |
There was a problem hiding this comment.
Great idea to use a thread
Dear Mr. Fasan,
I hope this message finds you well.
The file involved in this review is SearchResultActivity, an activity that allow the user to manually search for any ingredient and display the ingredient data.
Please feel free to ask for anything about the code.