mancj / mancj/MaterialSearchBar
Setting CustomSuggestionAdapter
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2k
- Forks
- 324
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am trying to define a customsuggestionadapter using the method MaterialSearchBar.setCustomSuggestionAdapter
`searchBar.setCustomSuggestionAdapter(suggestionsAdapter)`
I am trying to implement my own callbacklisteners for the custom suggestion adapter which implements com.mancj.materialsearchbar.adapter.SuggestionsAdapter
`suggestionsAdapter = DefaultSuggestionsAdapter(LayoutInflater.from(context))
.setListener(object: SuggestionsAdapter.OnItemViewClickListener{
override fun OnItemClickListener(position: Int, v: View?) {
TODO("Not yet implemented")
}
override fun OnItemDeleteListener(position: Int, v: View?) {
TODO("Not yet implemented")
}
})`
When I do this however I get an error saying Type mismatch: inferred type is Unit but SuggestionsAdapter<*, *>? was expected
I'm somewhat new to Android programming, so I suspect I'm missing something simple. What could be a good way to fix this?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the setCustomSuggestionAdapter entry point and the SuggestionsAdapter and DefaultSuggestionsAdapter declarations to determine the expected return types of the adapter and listener methods. The issue is resolved when the callback setup is compatible with the public API and the reported Kotlin type mismatch no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100