This is the SuggestionAdapter. An adapter aimed to be used (But not only) with the AutoCompleteTextView component from Android. The main point is that the adapter has a trigger (String) that starts the auto-complete list and will insert the user input + the suggestions from the list.
/**
* Our custom adapter in action
*/
viewAutoCompleteSuggestion.setAdapter(
SuggestionAdapter(
this,
R.layout.view_item,
suggestionsList,
"@" // The string that will trigger the search to display and filter the options
)
)
In order to add our module to your project, do the following steps.
- Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency:
dependencies {
implementation 'com.github.adrianokerber:suggestionadapter:v1.0.0'
}